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 * @hw_value: hardware-specific value for the channel 84d3236553SJohannes Berg * @flags: channel flags from &enum ieee80211_channel_flags. 85d3236553SJohannes Berg * @orig_flags: channel flags at registration time, used by regulatory 86d3236553SJohannes Berg * code to support devices with additional restrictions 87d3236553SJohannes Berg * @band: band this channel belongs to. 88d3236553SJohannes Berg * @max_antenna_gain: maximum antenna gain in dBi 89d3236553SJohannes Berg * @max_power: maximum transmission power (in dBm) 90d3236553SJohannes Berg * @beacon_found: helper to regulatory code to indicate when a beacon 91d3236553SJohannes Berg * has been found on this channel. Use regulatory_hint_found_beacon() 92d3236553SJohannes Berg * to enable this, this is is useful only on 5 GHz band. 93d3236553SJohannes Berg * @orig_mag: internal use 94d3236553SJohannes Berg * @orig_mpwr: internal use 95d3236553SJohannes Berg */ 96d3236553SJohannes Berg struct ieee80211_channel { 97d3236553SJohannes Berg enum ieee80211_band band; 98d3236553SJohannes Berg u16 center_freq; 99d3236553SJohannes Berg u16 hw_value; 100d3236553SJohannes Berg u32 flags; 101d3236553SJohannes Berg int max_antenna_gain; 102d3236553SJohannes Berg int max_power; 103d3236553SJohannes Berg bool beacon_found; 104d3236553SJohannes Berg u32 orig_flags; 105d3236553SJohannes Berg int orig_mag, orig_mpwr; 106d3236553SJohannes Berg }; 107d3236553SJohannes Berg 108d3236553SJohannes Berg /** 109d3236553SJohannes Berg * enum ieee80211_rate_flags - rate flags 110d3236553SJohannes Berg * 111d3236553SJohannes Berg * Hardware/specification flags for rates. These are structured 112d3236553SJohannes Berg * in a way that allows using the same bitrate structure for 113d3236553SJohannes Berg * different bands/PHY modes. 114d3236553SJohannes Berg * 115d3236553SJohannes Berg * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short 116d3236553SJohannes Berg * preamble on this bitrate; only relevant in 2.4GHz band and 117d3236553SJohannes Berg * with CCK rates. 118d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate 119d3236553SJohannes Berg * when used with 802.11a (on the 5 GHz band); filled by the 120d3236553SJohannes Berg * core code when registering the wiphy. 121d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate 122d3236553SJohannes Berg * when used with 802.11b (on the 2.4 GHz band); filled by the 123d3236553SJohannes Berg * core code when registering the wiphy. 124d3236553SJohannes Berg * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate 125d3236553SJohannes Berg * when used with 802.11g (on the 2.4 GHz band); filled by the 126d3236553SJohannes Berg * core code when registering the wiphy. 127d3236553SJohannes Berg * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode. 128d3236553SJohannes Berg */ 129d3236553SJohannes Berg enum ieee80211_rate_flags { 130d3236553SJohannes Berg IEEE80211_RATE_SHORT_PREAMBLE = 1<<0, 131d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_A = 1<<1, 132d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_B = 1<<2, 133d3236553SJohannes Berg IEEE80211_RATE_MANDATORY_G = 1<<3, 134d3236553SJohannes Berg IEEE80211_RATE_ERP_G = 1<<4, 135d3236553SJohannes Berg }; 136d3236553SJohannes Berg 137d3236553SJohannes Berg /** 138d3236553SJohannes Berg * struct ieee80211_rate - bitrate definition 139d3236553SJohannes Berg * 140d3236553SJohannes Berg * This structure describes a bitrate that an 802.11 PHY can 141d3236553SJohannes Berg * operate with. The two values @hw_value and @hw_value_short 142d3236553SJohannes Berg * are only for driver use when pointers to this structure are 143d3236553SJohannes Berg * passed around. 144d3236553SJohannes Berg * 145d3236553SJohannes Berg * @flags: rate-specific flags 146d3236553SJohannes Berg * @bitrate: bitrate in units of 100 Kbps 147d3236553SJohannes Berg * @hw_value: driver/hardware value for this rate 148d3236553SJohannes Berg * @hw_value_short: driver/hardware value for this rate when 149d3236553SJohannes Berg * short preamble is used 150d3236553SJohannes Berg */ 151d3236553SJohannes Berg struct ieee80211_rate { 152d3236553SJohannes Berg u32 flags; 153d3236553SJohannes Berg u16 bitrate; 154d3236553SJohannes Berg u16 hw_value, hw_value_short; 155d3236553SJohannes Berg }; 156d3236553SJohannes Berg 157d3236553SJohannes Berg /** 158d3236553SJohannes Berg * struct ieee80211_sta_ht_cap - STA's HT capabilities 159d3236553SJohannes Berg * 160d3236553SJohannes Berg * This structure describes most essential parameters needed 161d3236553SJohannes Berg * to describe 802.11n HT capabilities for an STA. 162d3236553SJohannes Berg * 163d3236553SJohannes Berg * @ht_supported: is HT supported by the STA 164d3236553SJohannes Berg * @cap: HT capabilities map as described in 802.11n spec 165d3236553SJohannes Berg * @ampdu_factor: Maximum A-MPDU length factor 166d3236553SJohannes Berg * @ampdu_density: Minimum A-MPDU spacing 167d3236553SJohannes Berg * @mcs: Supported MCS rates 168d3236553SJohannes Berg */ 169d3236553SJohannes Berg struct ieee80211_sta_ht_cap { 170d3236553SJohannes Berg u16 cap; /* use IEEE80211_HT_CAP_ */ 171d3236553SJohannes Berg bool ht_supported; 172d3236553SJohannes Berg u8 ampdu_factor; 173d3236553SJohannes Berg u8 ampdu_density; 174d3236553SJohannes Berg struct ieee80211_mcs_info mcs; 175d3236553SJohannes Berg }; 176d3236553SJohannes Berg 177d3236553SJohannes Berg /** 178d3236553SJohannes Berg * struct ieee80211_supported_band - frequency band definition 179d3236553SJohannes Berg * 180d3236553SJohannes Berg * This structure describes a frequency band a wiphy 181d3236553SJohannes Berg * is able to operate in. 182d3236553SJohannes Berg * 183d3236553SJohannes Berg * @channels: Array of channels the hardware can operate in 184d3236553SJohannes Berg * in this band. 185d3236553SJohannes Berg * @band: the band this structure represents 186d3236553SJohannes Berg * @n_channels: Number of channels in @channels 187d3236553SJohannes Berg * @bitrates: Array of bitrates the hardware can operate with 188d3236553SJohannes Berg * in this band. Must be sorted to give a valid "supported 189d3236553SJohannes Berg * rates" IE, i.e. CCK rates first, then OFDM. 190d3236553SJohannes Berg * @n_bitrates: Number of bitrates in @bitrates 191d3236553SJohannes Berg */ 192d3236553SJohannes Berg struct ieee80211_supported_band { 193d3236553SJohannes Berg struct ieee80211_channel *channels; 194d3236553SJohannes Berg struct ieee80211_rate *bitrates; 195d3236553SJohannes Berg enum ieee80211_band band; 196d3236553SJohannes Berg int n_channels; 197d3236553SJohannes Berg int n_bitrates; 198d3236553SJohannes Berg struct ieee80211_sta_ht_cap ht_cap; 199d3236553SJohannes Berg }; 200d3236553SJohannes Berg 201d3236553SJohannes Berg /* 202d3236553SJohannes Berg * Wireless hardware/device configuration structures and methods 203704232c2SJohannes Berg */ 204704232c2SJohannes Berg 2052ec600d6SLuis Carlos Cobo /** 2062ec600d6SLuis Carlos Cobo * struct vif_params - describes virtual interface parameters 2072ec600d6SLuis Carlos Cobo * @mesh_id: mesh ID to use 2082ec600d6SLuis Carlos Cobo * @mesh_id_len: length of the mesh ID 2092ec600d6SLuis Carlos Cobo */ 2102ec600d6SLuis Carlos Cobo struct vif_params { 2112ec600d6SLuis Carlos Cobo u8 *mesh_id; 2122ec600d6SLuis Carlos Cobo int mesh_id_len; 2132ec600d6SLuis Carlos Cobo }; 2142ec600d6SLuis Carlos Cobo 21541ade00fSJohannes Berg /** 21641ade00fSJohannes Berg * struct key_params - key information 21741ade00fSJohannes Berg * 21841ade00fSJohannes Berg * Information about a key 21941ade00fSJohannes Berg * 22041ade00fSJohannes Berg * @key: key material 22141ade00fSJohannes Berg * @key_len: length of key material 22241ade00fSJohannes Berg * @cipher: cipher suite selector 22341ade00fSJohannes Berg * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used 22441ade00fSJohannes Berg * with the get_key() callback, must be in little endian, 22541ade00fSJohannes Berg * length given by @seq_len. 22641ade00fSJohannes Berg */ 22741ade00fSJohannes Berg struct key_params { 22841ade00fSJohannes Berg u8 *key; 22941ade00fSJohannes Berg u8 *seq; 23041ade00fSJohannes Berg int key_len; 23141ade00fSJohannes Berg int seq_len; 23241ade00fSJohannes Berg u32 cipher; 23341ade00fSJohannes Berg }; 23441ade00fSJohannes Berg 235ed1b6cc7SJohannes Berg /** 236ed1b6cc7SJohannes Berg * struct beacon_parameters - beacon parameters 237ed1b6cc7SJohannes Berg * 238ed1b6cc7SJohannes Berg * Used to configure the beacon for an interface. 239ed1b6cc7SJohannes Berg * 240ed1b6cc7SJohannes Berg * @head: head portion of beacon (before TIM IE) 241ed1b6cc7SJohannes Berg * or %NULL if not changed 242ed1b6cc7SJohannes Berg * @tail: tail portion of beacon (after TIM IE) 243ed1b6cc7SJohannes Berg * or %NULL if not changed 244ed1b6cc7SJohannes Berg * @interval: beacon interval or zero if not changed 245ed1b6cc7SJohannes Berg * @dtim_period: DTIM period or zero if not changed 246ed1b6cc7SJohannes Berg * @head_len: length of @head 247ed1b6cc7SJohannes Berg * @tail_len: length of @tail 248ed1b6cc7SJohannes Berg */ 249ed1b6cc7SJohannes Berg struct beacon_parameters { 250ed1b6cc7SJohannes Berg u8 *head, *tail; 251ed1b6cc7SJohannes Berg int interval, dtim_period; 252ed1b6cc7SJohannes Berg int head_len, tail_len; 253ed1b6cc7SJohannes Berg }; 254ed1b6cc7SJohannes Berg 2555727ef1bSJohannes Berg /** 2562ec600d6SLuis Carlos Cobo * enum plink_action - actions to perform in mesh peers 2572ec600d6SLuis Carlos Cobo * 2582ec600d6SLuis Carlos Cobo * @PLINK_ACTION_INVALID: action 0 is reserved 2592ec600d6SLuis Carlos Cobo * @PLINK_ACTION_OPEN: start mesh peer link establishment 2602ec600d6SLuis Carlos Cobo * @PLINK_ACTION_BLOCL: block traffic from this mesh peer 2612ec600d6SLuis Carlos Cobo */ 2622ec600d6SLuis Carlos Cobo enum plink_actions { 2632ec600d6SLuis Carlos Cobo PLINK_ACTION_INVALID, 2642ec600d6SLuis Carlos Cobo PLINK_ACTION_OPEN, 2652ec600d6SLuis Carlos Cobo PLINK_ACTION_BLOCK, 2662ec600d6SLuis Carlos Cobo }; 2672ec600d6SLuis Carlos Cobo 2682ec600d6SLuis Carlos Cobo /** 2695727ef1bSJohannes Berg * struct station_parameters - station parameters 2705727ef1bSJohannes Berg * 2715727ef1bSJohannes Berg * Used to change and create a new station. 2725727ef1bSJohannes Berg * 2735727ef1bSJohannes Berg * @vlan: vlan interface station should belong to 2745727ef1bSJohannes Berg * @supported_rates: supported rates in IEEE 802.11 format 2755727ef1bSJohannes Berg * (or NULL for no change) 2765727ef1bSJohannes Berg * @supported_rates_len: number of supported rates 277eccb8e8fSJohannes Berg * @sta_flags_mask: station flags that changed 278eccb8e8fSJohannes Berg * (bitmask of BIT(NL80211_STA_FLAG_...)) 279eccb8e8fSJohannes Berg * @sta_flags_set: station flags values 280eccb8e8fSJohannes Berg * (bitmask of BIT(NL80211_STA_FLAG_...)) 2815727ef1bSJohannes Berg * @listen_interval: listen interval or -1 for no change 2825727ef1bSJohannes Berg * @aid: AID or zero for no change 2835727ef1bSJohannes Berg */ 2845727ef1bSJohannes Berg struct station_parameters { 2855727ef1bSJohannes Berg u8 *supported_rates; 2865727ef1bSJohannes Berg struct net_device *vlan; 287eccb8e8fSJohannes Berg u32 sta_flags_mask, sta_flags_set; 2885727ef1bSJohannes Berg int listen_interval; 2895727ef1bSJohannes Berg u16 aid; 2905727ef1bSJohannes Berg u8 supported_rates_len; 2912ec600d6SLuis Carlos Cobo u8 plink_action; 29236aedc90SJouni Malinen struct ieee80211_ht_cap *ht_capa; 2935727ef1bSJohannes Berg }; 2945727ef1bSJohannes Berg 295fd5b74dcSJohannes Berg /** 2962ec600d6SLuis Carlos Cobo * enum station_info_flags - station information flags 297fd5b74dcSJohannes Berg * 2982ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct station_info 2992ec600d6SLuis Carlos Cobo * it has filled in during get_station() or dump_station(). 300fd5b74dcSJohannes Berg * 3012ec600d6SLuis Carlos Cobo * @STATION_INFO_INACTIVE_TIME: @inactive_time filled 3022ec600d6SLuis Carlos Cobo * @STATION_INFO_RX_BYTES: @rx_bytes filled 3032ec600d6SLuis Carlos Cobo * @STATION_INFO_TX_BYTES: @tx_bytes filled 3042ec600d6SLuis Carlos Cobo * @STATION_INFO_LLID: @llid filled 3052ec600d6SLuis Carlos Cobo * @STATION_INFO_PLID: @plid filled 3062ec600d6SLuis Carlos Cobo * @STATION_INFO_PLINK_STATE: @plink_state filled 307420e7fabSHenning Rogge * @STATION_INFO_SIGNAL: @signal filled 308420e7fabSHenning Rogge * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled 309420e7fabSHenning Rogge * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) 31098c8a60aSJouni Malinen * @STATION_INFO_RX_PACKETS: @rx_packets filled 31198c8a60aSJouni Malinen * @STATION_INFO_TX_PACKETS: @tx_packets filled 312fd5b74dcSJohannes Berg */ 3132ec600d6SLuis Carlos Cobo enum station_info_flags { 3142ec600d6SLuis Carlos Cobo STATION_INFO_INACTIVE_TIME = 1<<0, 3152ec600d6SLuis Carlos Cobo STATION_INFO_RX_BYTES = 1<<1, 3162ec600d6SLuis Carlos Cobo STATION_INFO_TX_BYTES = 1<<2, 3172ec600d6SLuis Carlos Cobo STATION_INFO_LLID = 1<<3, 3182ec600d6SLuis Carlos Cobo STATION_INFO_PLID = 1<<4, 3192ec600d6SLuis Carlos Cobo STATION_INFO_PLINK_STATE = 1<<5, 320420e7fabSHenning Rogge STATION_INFO_SIGNAL = 1<<6, 321420e7fabSHenning Rogge STATION_INFO_TX_BITRATE = 1<<7, 32298c8a60aSJouni Malinen STATION_INFO_RX_PACKETS = 1<<8, 32398c8a60aSJouni Malinen STATION_INFO_TX_PACKETS = 1<<9, 324420e7fabSHenning Rogge }; 325420e7fabSHenning Rogge 326420e7fabSHenning Rogge /** 327420e7fabSHenning Rogge * enum station_info_rate_flags - bitrate info flags 328420e7fabSHenning Rogge * 329420e7fabSHenning Rogge * Used by the driver to indicate the specific rate transmission 330420e7fabSHenning Rogge * type for 802.11n transmissions. 331420e7fabSHenning Rogge * 332420e7fabSHenning Rogge * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled 333420e7fabSHenning Rogge * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission 334420e7fabSHenning Rogge * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 335420e7fabSHenning Rogge */ 336420e7fabSHenning Rogge enum rate_info_flags { 337420e7fabSHenning Rogge RATE_INFO_FLAGS_MCS = 1<<0, 338420e7fabSHenning Rogge RATE_INFO_FLAGS_40_MHZ_WIDTH = 1<<1, 339420e7fabSHenning Rogge RATE_INFO_FLAGS_SHORT_GI = 1<<2, 340420e7fabSHenning Rogge }; 341420e7fabSHenning Rogge 342420e7fabSHenning Rogge /** 343420e7fabSHenning Rogge * struct rate_info - bitrate information 344420e7fabSHenning Rogge * 345420e7fabSHenning Rogge * Information about a receiving or transmitting bitrate 346420e7fabSHenning Rogge * 347420e7fabSHenning Rogge * @flags: bitflag of flags from &enum rate_info_flags 348420e7fabSHenning Rogge * @mcs: mcs index if struct describes a 802.11n bitrate 349420e7fabSHenning Rogge * @legacy: bitrate in 100kbit/s for 802.11abg 350420e7fabSHenning Rogge */ 351420e7fabSHenning Rogge struct rate_info { 352420e7fabSHenning Rogge u8 flags; 353420e7fabSHenning Rogge u8 mcs; 354420e7fabSHenning Rogge u16 legacy; 355fd5b74dcSJohannes Berg }; 356fd5b74dcSJohannes Berg 357fd5b74dcSJohannes Berg /** 3582ec600d6SLuis Carlos Cobo * struct station_info - station information 359fd5b74dcSJohannes Berg * 3602ec600d6SLuis Carlos Cobo * Station information filled by driver for get_station() and dump_station. 361fd5b74dcSJohannes Berg * 3622ec600d6SLuis Carlos Cobo * @filled: bitflag of flags from &enum station_info_flags 363fd5b74dcSJohannes Berg * @inactive_time: time since last station activity (tx/rx) in milliseconds 364fd5b74dcSJohannes Berg * @rx_bytes: bytes received from this station 365fd5b74dcSJohannes Berg * @tx_bytes: bytes transmitted to this station 3662ec600d6SLuis Carlos Cobo * @llid: mesh local link id 3672ec600d6SLuis Carlos Cobo * @plid: mesh peer link id 3682ec600d6SLuis Carlos Cobo * @plink_state: mesh peer link state 369420e7fabSHenning Rogge * @signal: signal strength of last received packet in dBm 370420e7fabSHenning Rogge * @txrate: current unicast bitrate to this station 37198c8a60aSJouni Malinen * @rx_packets: packets received from this station 37298c8a60aSJouni Malinen * @tx_packets: packets transmitted to this station 373f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 374f5ea9120SJohannes Berg * This number should increase every time the list of stations 375f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 376f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 377fd5b74dcSJohannes Berg */ 3782ec600d6SLuis Carlos Cobo struct station_info { 379fd5b74dcSJohannes Berg u32 filled; 380fd5b74dcSJohannes Berg u32 inactive_time; 381fd5b74dcSJohannes Berg u32 rx_bytes; 382fd5b74dcSJohannes Berg u32 tx_bytes; 3832ec600d6SLuis Carlos Cobo u16 llid; 3842ec600d6SLuis Carlos Cobo u16 plid; 3852ec600d6SLuis Carlos Cobo u8 plink_state; 386420e7fabSHenning Rogge s8 signal; 387420e7fabSHenning Rogge struct rate_info txrate; 38898c8a60aSJouni Malinen u32 rx_packets; 38998c8a60aSJouni Malinen u32 tx_packets; 390f5ea9120SJohannes Berg 391f5ea9120SJohannes Berg int generation; 392fd5b74dcSJohannes Berg }; 393fd5b74dcSJohannes Berg 39466f7ac50SMichael Wu /** 39566f7ac50SMichael Wu * enum monitor_flags - monitor flags 39666f7ac50SMichael Wu * 39766f7ac50SMichael Wu * Monitor interface configuration flags. Note that these must be the bits 39866f7ac50SMichael Wu * according to the nl80211 flags. 39966f7ac50SMichael Wu * 40066f7ac50SMichael Wu * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS 40166f7ac50SMichael Wu * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP 40266f7ac50SMichael Wu * @MONITOR_FLAG_CONTROL: pass control frames 40366f7ac50SMichael Wu * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering 40466f7ac50SMichael Wu * @MONITOR_FLAG_COOK_FRAMES: report frames after processing 40566f7ac50SMichael Wu */ 40666f7ac50SMichael Wu enum monitor_flags { 40766f7ac50SMichael Wu MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL, 40866f7ac50SMichael Wu MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL, 40966f7ac50SMichael Wu MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL, 41066f7ac50SMichael Wu MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS, 41166f7ac50SMichael Wu MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES, 41266f7ac50SMichael Wu }; 41366f7ac50SMichael Wu 4142ec600d6SLuis Carlos Cobo /** 4152ec600d6SLuis Carlos Cobo * enum mpath_info_flags - mesh path information flags 4162ec600d6SLuis Carlos Cobo * 4172ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct mpath_info it has filled 4182ec600d6SLuis Carlos Cobo * in during get_station() or dump_station(). 4192ec600d6SLuis Carlos Cobo * 4202ec600d6SLuis Carlos Cobo * MPATH_INFO_FRAME_QLEN: @frame_qlen filled 4212ec600d6SLuis Carlos Cobo * MPATH_INFO_DSN: @dsn filled 4222ec600d6SLuis Carlos Cobo * MPATH_INFO_METRIC: @metric filled 4232ec600d6SLuis Carlos Cobo * MPATH_INFO_EXPTIME: @exptime filled 4242ec600d6SLuis Carlos Cobo * MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 4252ec600d6SLuis Carlos Cobo * MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled 4262ec600d6SLuis Carlos Cobo * MPATH_INFO_FLAGS: @flags filled 4272ec600d6SLuis Carlos Cobo */ 4282ec600d6SLuis Carlos Cobo enum mpath_info_flags { 4292ec600d6SLuis Carlos Cobo MPATH_INFO_FRAME_QLEN = BIT(0), 4302ec600d6SLuis Carlos Cobo MPATH_INFO_DSN = BIT(1), 4312ec600d6SLuis Carlos Cobo MPATH_INFO_METRIC = BIT(2), 4322ec600d6SLuis Carlos Cobo MPATH_INFO_EXPTIME = BIT(3), 4332ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), 4342ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_RETRIES = BIT(5), 4352ec600d6SLuis Carlos Cobo MPATH_INFO_FLAGS = BIT(6), 4362ec600d6SLuis Carlos Cobo }; 4372ec600d6SLuis Carlos Cobo 4382ec600d6SLuis Carlos Cobo /** 4392ec600d6SLuis Carlos Cobo * struct mpath_info - mesh path information 4402ec600d6SLuis Carlos Cobo * 4412ec600d6SLuis Carlos Cobo * Mesh path information filled by driver for get_mpath() and dump_mpath(). 4422ec600d6SLuis Carlos Cobo * 4432ec600d6SLuis Carlos Cobo * @filled: bitfield of flags from &enum mpath_info_flags 4442ec600d6SLuis Carlos Cobo * @frame_qlen: number of queued frames for this destination 4452ec600d6SLuis Carlos Cobo * @dsn: destination sequence number 4462ec600d6SLuis Carlos Cobo * @metric: metric (cost) of this mesh path 4472ec600d6SLuis Carlos Cobo * @exptime: expiration time for the mesh path from now, in msecs 4482ec600d6SLuis Carlos Cobo * @flags: mesh path flags 4492ec600d6SLuis Carlos Cobo * @discovery_timeout: total mesh path discovery timeout, in msecs 4502ec600d6SLuis Carlos Cobo * @discovery_retries: mesh path discovery retries 451f5ea9120SJohannes Berg * @generation: generation number for nl80211 dumps. 452f5ea9120SJohannes Berg * This number should increase every time the list of mesh paths 453f5ea9120SJohannes Berg * changes, i.e. when a station is added or removed, so that 454f5ea9120SJohannes Berg * userspace can tell whether it got a consistent snapshot. 4552ec600d6SLuis Carlos Cobo */ 4562ec600d6SLuis Carlos Cobo struct mpath_info { 4572ec600d6SLuis Carlos Cobo u32 filled; 4582ec600d6SLuis Carlos Cobo u32 frame_qlen; 4592ec600d6SLuis Carlos Cobo u32 dsn; 4602ec600d6SLuis Carlos Cobo u32 metric; 4612ec600d6SLuis Carlos Cobo u32 exptime; 4622ec600d6SLuis Carlos Cobo u32 discovery_timeout; 4632ec600d6SLuis Carlos Cobo u8 discovery_retries; 4642ec600d6SLuis Carlos Cobo u8 flags; 465f5ea9120SJohannes Berg 466f5ea9120SJohannes Berg int generation; 4672ec600d6SLuis Carlos Cobo }; 4682ec600d6SLuis Carlos Cobo 4699f1ba906SJouni Malinen /** 4709f1ba906SJouni Malinen * struct bss_parameters - BSS parameters 4719f1ba906SJouni Malinen * 4729f1ba906SJouni Malinen * Used to change BSS parameters (mainly for AP mode). 4739f1ba906SJouni Malinen * 4749f1ba906SJouni Malinen * @use_cts_prot: Whether to use CTS protection 4759f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 4769f1ba906SJouni Malinen * @use_short_preamble: Whether the use of short preambles is allowed 4779f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 4789f1ba906SJouni Malinen * @use_short_slot_time: Whether the use of short slot time is allowed 4799f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 48090c97a04SJouni Malinen * @basic_rates: basic rates in IEEE 802.11 format 48190c97a04SJouni Malinen * (or NULL for no change) 48290c97a04SJouni Malinen * @basic_rates_len: number of basic rates 4839f1ba906SJouni Malinen */ 4849f1ba906SJouni Malinen struct bss_parameters { 4859f1ba906SJouni Malinen int use_cts_prot; 4869f1ba906SJouni Malinen int use_short_preamble; 4879f1ba906SJouni Malinen int use_short_slot_time; 48890c97a04SJouni Malinen u8 *basic_rates; 48990c97a04SJouni Malinen u8 basic_rates_len; 4909f1ba906SJouni Malinen }; 4912ec600d6SLuis Carlos Cobo 49293da9cc1Scolin@cozybit.com struct mesh_config { 49393da9cc1Scolin@cozybit.com /* Timeouts in ms */ 49493da9cc1Scolin@cozybit.com /* Mesh plink management parameters */ 49593da9cc1Scolin@cozybit.com u16 dot11MeshRetryTimeout; 49693da9cc1Scolin@cozybit.com u16 dot11MeshConfirmTimeout; 49793da9cc1Scolin@cozybit.com u16 dot11MeshHoldingTimeout; 49893da9cc1Scolin@cozybit.com u16 dot11MeshMaxPeerLinks; 49993da9cc1Scolin@cozybit.com u8 dot11MeshMaxRetries; 50093da9cc1Scolin@cozybit.com u8 dot11MeshTTL; 50193da9cc1Scolin@cozybit.com bool auto_open_plinks; 50293da9cc1Scolin@cozybit.com /* HWMP parameters */ 50393da9cc1Scolin@cozybit.com u8 dot11MeshHWMPmaxPREQretries; 50493da9cc1Scolin@cozybit.com u32 path_refresh_time; 50593da9cc1Scolin@cozybit.com u16 min_discovery_timeout; 50693da9cc1Scolin@cozybit.com u32 dot11MeshHWMPactivePathTimeout; 50793da9cc1Scolin@cozybit.com u16 dot11MeshHWMPpreqMinInterval; 50893da9cc1Scolin@cozybit.com u16 dot11MeshHWMPnetDiameterTraversalTime; 50993da9cc1Scolin@cozybit.com }; 51093da9cc1Scolin@cozybit.com 51131888487SJouni Malinen /** 51231888487SJouni Malinen * struct ieee80211_txq_params - TX queue parameters 51331888487SJouni Malinen * @queue: TX queue identifier (NL80211_TXQ_Q_*) 51431888487SJouni Malinen * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled 51531888487SJouni Malinen * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range 51631888487SJouni Malinen * 1..32767] 51731888487SJouni Malinen * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range 51831888487SJouni Malinen * 1..32767] 51931888487SJouni Malinen * @aifs: Arbitration interframe space [0..255] 52031888487SJouni Malinen */ 52131888487SJouni Malinen struct ieee80211_txq_params { 52231888487SJouni Malinen enum nl80211_txq_q queue; 52331888487SJouni Malinen u16 txop; 52431888487SJouni Malinen u16 cwmin; 52531888487SJouni Malinen u16 cwmax; 52631888487SJouni Malinen u8 aifs; 52731888487SJouni Malinen }; 52831888487SJouni Malinen 529704232c2SJohannes Berg /* from net/wireless.h */ 530704232c2SJohannes Berg struct wiphy; 531704232c2SJohannes Berg 53272bdcf34SJouni Malinen /* from net/ieee80211.h */ 53372bdcf34SJouni Malinen struct ieee80211_channel; 53472bdcf34SJouni Malinen 535704232c2SJohannes Berg /** 5362a519311SJohannes Berg * struct cfg80211_ssid - SSID description 5372a519311SJohannes Berg * @ssid: the SSID 5382a519311SJohannes Berg * @ssid_len: length of the ssid 5392a519311SJohannes Berg */ 5402a519311SJohannes Berg struct cfg80211_ssid { 5412a519311SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 5422a519311SJohannes Berg u8 ssid_len; 5432a519311SJohannes Berg }; 5442a519311SJohannes Berg 5452a519311SJohannes Berg /** 5462a519311SJohannes Berg * struct cfg80211_scan_request - scan request description 5472a519311SJohannes Berg * 5482a519311SJohannes Berg * @ssids: SSIDs to scan for (active scan only) 5492a519311SJohannes Berg * @n_ssids: number of SSIDs 5502a519311SJohannes Berg * @channels: channels to scan on. 551ca3dbc20SHelmut Schaa * @n_channels: total number of channels to scan 55270692ad2SJouni Malinen * @ie: optional information element(s) to add into Probe Request or %NULL 55370692ad2SJouni Malinen * @ie_len: length of ie in octets 5542a519311SJohannes Berg * @wiphy: the wiphy this was for 555463d0183SJohannes Berg * @dev: the interface 5562a519311SJohannes Berg */ 5572a519311SJohannes Berg struct cfg80211_scan_request { 5582a519311SJohannes Berg struct cfg80211_ssid *ssids; 5592a519311SJohannes Berg int n_ssids; 5602a519311SJohannes Berg u32 n_channels; 561de95a54bSJohannes Berg const u8 *ie; 56270692ad2SJouni Malinen size_t ie_len; 5632a519311SJohannes Berg 5642a519311SJohannes Berg /* internal */ 5652a519311SJohannes Berg struct wiphy *wiphy; 566463d0183SJohannes Berg struct net_device *dev; 567667503ddSJohannes Berg bool aborted; 5685ba63533SJohannes Berg 5695ba63533SJohannes Berg /* keep last */ 5705ba63533SJohannes Berg struct ieee80211_channel *channels[0]; 5712a519311SJohannes Berg }; 5722a519311SJohannes Berg 5732a519311SJohannes Berg /** 5742a519311SJohannes Berg * enum cfg80211_signal_type - signal type 5752a519311SJohannes Berg * 5762a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available 5772a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) 5782a519311SJohannes Berg * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100 5792a519311SJohannes Berg */ 5802a519311SJohannes Berg enum cfg80211_signal_type { 5812a519311SJohannes Berg CFG80211_SIGNAL_TYPE_NONE, 5822a519311SJohannes Berg CFG80211_SIGNAL_TYPE_MBM, 5832a519311SJohannes Berg CFG80211_SIGNAL_TYPE_UNSPEC, 5842a519311SJohannes Berg }; 5852a519311SJohannes Berg 5862a519311SJohannes Berg /** 5872a519311SJohannes Berg * struct cfg80211_bss - BSS description 5882a519311SJohannes Berg * 5892a519311SJohannes Berg * This structure describes a BSS (which may also be a mesh network) 5902a519311SJohannes Berg * for use in scan results and similar. 5912a519311SJohannes Berg * 5922a519311SJohannes Berg * @bssid: BSSID of the BSS 5932a519311SJohannes Berg * @tsf: timestamp of last received update 5942a519311SJohannes Berg * @beacon_interval: the beacon interval as from the frame 5952a519311SJohannes Berg * @capability: the capability field in host byte order 5962a519311SJohannes Berg * @information_elements: the information elements (Note that there 5972a519311SJohannes Berg * is no guarantee that these are well-formed!) 5982a519311SJohannes Berg * @len_information_elements: total length of the information elements 59977965c97SJohannes Berg * @signal: signal strength value (type depends on the wiphy's signal_type) 60078c1c7e1SJohannes Berg * @free_priv: function pointer to free private data 6012a519311SJohannes Berg * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 6022a519311SJohannes Berg */ 6032a519311SJohannes Berg struct cfg80211_bss { 6042a519311SJohannes Berg struct ieee80211_channel *channel; 6052a519311SJohannes Berg 6062a519311SJohannes Berg u8 bssid[ETH_ALEN]; 6072a519311SJohannes Berg u64 tsf; 6082a519311SJohannes Berg u16 beacon_interval; 6092a519311SJohannes Berg u16 capability; 6102a519311SJohannes Berg u8 *information_elements; 6112a519311SJohannes Berg size_t len_information_elements; 6122a519311SJohannes Berg 6132a519311SJohannes Berg s32 signal; 6142a519311SJohannes Berg 61578c1c7e1SJohannes Berg void (*free_priv)(struct cfg80211_bss *bss); 6162a519311SJohannes Berg u8 priv[0] __attribute__((__aligned__(sizeof(void *)))); 6172a519311SJohannes Berg }; 6182a519311SJohannes Berg 6192a519311SJohannes Berg /** 620517357c6SJohannes Berg * ieee80211_bss_get_ie - find IE with given ID 621517357c6SJohannes Berg * @bss: the bss to search 622517357c6SJohannes Berg * @ie: the IE ID 623517357c6SJohannes Berg * Returns %NULL if not found. 624517357c6SJohannes Berg */ 625517357c6SJohannes Berg const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); 626517357c6SJohannes Berg 627517357c6SJohannes Berg 628517357c6SJohannes Berg /** 629b23aa676SSamuel Ortiz * struct cfg80211_crypto_settings - Crypto settings 630b23aa676SSamuel Ortiz * @wpa_versions: indicates which, if any, WPA versions are enabled 631b23aa676SSamuel Ortiz * (from enum nl80211_wpa_versions) 632b23aa676SSamuel Ortiz * @cipher_group: group key cipher suite (or 0 if unset) 633b23aa676SSamuel Ortiz * @n_ciphers_pairwise: number of AP supported unicast ciphers 634b23aa676SSamuel Ortiz * @ciphers_pairwise: unicast key cipher suites 635b23aa676SSamuel Ortiz * @n_akm_suites: number of AKM suites 636b23aa676SSamuel Ortiz * @akm_suites: AKM suites 637b23aa676SSamuel Ortiz * @control_port: Whether user space controls IEEE 802.1X port, i.e., 638b23aa676SSamuel Ortiz * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 639b23aa676SSamuel Ortiz * required to assume that the port is unauthorized until authorized by 640b23aa676SSamuel Ortiz * user space. Otherwise, port is marked authorized by default. 641b23aa676SSamuel Ortiz */ 642b23aa676SSamuel Ortiz struct cfg80211_crypto_settings { 643b23aa676SSamuel Ortiz u32 wpa_versions; 644b23aa676SSamuel Ortiz u32 cipher_group; 645b23aa676SSamuel Ortiz int n_ciphers_pairwise; 646b23aa676SSamuel Ortiz u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES]; 647b23aa676SSamuel Ortiz int n_akm_suites; 648b23aa676SSamuel Ortiz u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; 649b23aa676SSamuel Ortiz bool control_port; 650b23aa676SSamuel Ortiz }; 651b23aa676SSamuel Ortiz 652b23aa676SSamuel Ortiz /** 653636a5d36SJouni Malinen * struct cfg80211_auth_request - Authentication request data 654636a5d36SJouni Malinen * 655636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 656636a5d36SJouni Malinen * authentication. 657636a5d36SJouni Malinen * 65819957bb3SJohannes Berg * @bss: The BSS to authenticate with. 659636a5d36SJouni Malinen * @auth_type: Authentication type (algorithm) 660636a5d36SJouni Malinen * @ie: Extra IEs to add to Authentication frame or %NULL 661636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 662fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 663fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 664fffd0934SJohannes Berg * @key: WEP key for shared key authentication 665636a5d36SJouni Malinen */ 666636a5d36SJouni Malinen struct cfg80211_auth_request { 66719957bb3SJohannes Berg struct cfg80211_bss *bss; 668636a5d36SJouni Malinen const u8 *ie; 669636a5d36SJouni Malinen size_t ie_len; 67019957bb3SJohannes Berg enum nl80211_auth_type auth_type; 671fffd0934SJohannes Berg const u8 *key; 672fffd0934SJohannes Berg u8 key_len, key_idx; 673636a5d36SJouni Malinen }; 674636a5d36SJouni Malinen 675636a5d36SJouni Malinen /** 676636a5d36SJouni Malinen * struct cfg80211_assoc_request - (Re)Association request data 677636a5d36SJouni Malinen * 678636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 679636a5d36SJouni Malinen * (re)association. 68019957bb3SJohannes Berg * @bss: The BSS to associate with. 681636a5d36SJouni Malinen * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 682636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 683dc6382ceSJouni Malinen * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 684b23aa676SSamuel Ortiz * @crypto: crypto settings 6853e5d7649SJohannes Berg * @prev_bssid: previous BSSID, if not %NULL use reassociate frame 686636a5d36SJouni Malinen */ 687636a5d36SJouni Malinen struct cfg80211_assoc_request { 68819957bb3SJohannes Berg struct cfg80211_bss *bss; 6893e5d7649SJohannes Berg const u8 *ie, *prev_bssid; 690636a5d36SJouni Malinen size_t ie_len; 691b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 69219957bb3SJohannes Berg bool use_mfp; 693636a5d36SJouni Malinen }; 694636a5d36SJouni Malinen 695636a5d36SJouni Malinen /** 696636a5d36SJouni Malinen * struct cfg80211_deauth_request - Deauthentication request data 697636a5d36SJouni Malinen * 698636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 699636a5d36SJouni Malinen * deauthentication. 700636a5d36SJouni Malinen * 70119957bb3SJohannes Berg * @bss: the BSS to deauthenticate from 702636a5d36SJouni Malinen * @ie: Extra IEs to add to Deauthentication frame or %NULL 703636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 70419957bb3SJohannes Berg * @reason_code: The reason code for the deauthentication 705636a5d36SJouni Malinen */ 706636a5d36SJouni Malinen struct cfg80211_deauth_request { 70719957bb3SJohannes Berg struct cfg80211_bss *bss; 708636a5d36SJouni Malinen const u8 *ie; 709636a5d36SJouni Malinen size_t ie_len; 71019957bb3SJohannes Berg u16 reason_code; 711636a5d36SJouni Malinen }; 712636a5d36SJouni Malinen 713636a5d36SJouni Malinen /** 714636a5d36SJouni Malinen * struct cfg80211_disassoc_request - Disassociation request data 715636a5d36SJouni Malinen * 716636a5d36SJouni Malinen * This structure provides information needed to complete IEEE 802.11 717636a5d36SJouni Malinen * disassocation. 718636a5d36SJouni Malinen * 71919957bb3SJohannes Berg * @bss: the BSS to disassociate from 720636a5d36SJouni Malinen * @ie: Extra IEs to add to Disassociation frame or %NULL 721636a5d36SJouni Malinen * @ie_len: Length of ie buffer in octets 72219957bb3SJohannes Berg * @reason_code: The reason code for the disassociation 723636a5d36SJouni Malinen */ 724636a5d36SJouni Malinen struct cfg80211_disassoc_request { 72519957bb3SJohannes Berg struct cfg80211_bss *bss; 726636a5d36SJouni Malinen const u8 *ie; 727636a5d36SJouni Malinen size_t ie_len; 72819957bb3SJohannes Berg u16 reason_code; 729636a5d36SJouni Malinen }; 730636a5d36SJouni Malinen 731636a5d36SJouni Malinen /** 73204a773adSJohannes Berg * struct cfg80211_ibss_params - IBSS parameters 73304a773adSJohannes Berg * 73404a773adSJohannes Berg * This structure defines the IBSS parameters for the join_ibss() 73504a773adSJohannes Berg * method. 73604a773adSJohannes Berg * 73704a773adSJohannes Berg * @ssid: The SSID, will always be non-null. 73804a773adSJohannes Berg * @ssid_len: The length of the SSID, will always be non-zero. 73904a773adSJohannes Berg * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not 74004a773adSJohannes Berg * search for IBSSs with a different BSSID. 74104a773adSJohannes Berg * @channel: The channel to use if no IBSS can be found to join. 74204a773adSJohannes Berg * @channel_fixed: The channel should be fixed -- do not search for 74304a773adSJohannes Berg * IBSSs to join on other channels. 74404a773adSJohannes Berg * @ie: information element(s) to include in the beacon 74504a773adSJohannes Berg * @ie_len: length of that 7468e30bc55SJohannes Berg * @beacon_interval: beacon interval to use 747fffd0934SJohannes Berg * @privacy: this is a protected network, keys will be configured 748fffd0934SJohannes Berg * after joining 74904a773adSJohannes Berg */ 75004a773adSJohannes Berg struct cfg80211_ibss_params { 75104a773adSJohannes Berg u8 *ssid; 75204a773adSJohannes Berg u8 *bssid; 75304a773adSJohannes Berg struct ieee80211_channel *channel; 75404a773adSJohannes Berg u8 *ie; 75504a773adSJohannes Berg u8 ssid_len, ie_len; 7568e30bc55SJohannes Berg u16 beacon_interval; 75704a773adSJohannes Berg bool channel_fixed; 758fffd0934SJohannes Berg bool privacy; 75904a773adSJohannes Berg }; 76004a773adSJohannes Berg 76104a773adSJohannes Berg /** 762b23aa676SSamuel Ortiz * struct cfg80211_connect_params - Connection parameters 763b23aa676SSamuel Ortiz * 764b23aa676SSamuel Ortiz * This structure provides information needed to complete IEEE 802.11 765b23aa676SSamuel Ortiz * authentication and association. 766b23aa676SSamuel Ortiz * 767b23aa676SSamuel Ortiz * @channel: The channel to use or %NULL if not specified (auto-select based 768b23aa676SSamuel Ortiz * on scan results) 769b23aa676SSamuel Ortiz * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan 770b23aa676SSamuel Ortiz * results) 771b23aa676SSamuel Ortiz * @ssid: SSID 772b23aa676SSamuel Ortiz * @ssid_len: Length of ssid in octets 773b23aa676SSamuel Ortiz * @auth_type: Authentication type (algorithm) 774b23aa676SSamuel Ortiz * @assoc_ie: IEs for association request 775b23aa676SSamuel Ortiz * @assoc_ie_len: Length of assoc_ie in octets 776b23aa676SSamuel Ortiz * @privacy: indicates whether privacy-enabled APs should be used 777b23aa676SSamuel Ortiz * @crypto: crypto settings 778fffd0934SJohannes Berg * @key_len: length of WEP key for shared key authentication 779fffd0934SJohannes Berg * @key_idx: index of WEP key for shared key authentication 780fffd0934SJohannes Berg * @key: WEP key for shared key authentication 781b23aa676SSamuel Ortiz */ 782b23aa676SSamuel Ortiz struct cfg80211_connect_params { 783b23aa676SSamuel Ortiz struct ieee80211_channel *channel; 784b23aa676SSamuel Ortiz u8 *bssid; 785b23aa676SSamuel Ortiz u8 *ssid; 786b23aa676SSamuel Ortiz size_t ssid_len; 787b23aa676SSamuel Ortiz enum nl80211_auth_type auth_type; 788b23aa676SSamuel Ortiz u8 *ie; 789b23aa676SSamuel Ortiz size_t ie_len; 790b23aa676SSamuel Ortiz bool privacy; 791b23aa676SSamuel Ortiz struct cfg80211_crypto_settings crypto; 792fffd0934SJohannes Berg const u8 *key; 793fffd0934SJohannes Berg u8 key_len, key_idx; 794b23aa676SSamuel Ortiz }; 795b23aa676SSamuel Ortiz 796b23aa676SSamuel Ortiz /** 797b9a5f8caSJouni Malinen * enum wiphy_params_flags - set_wiphy_params bitfield values 798b9a5f8caSJouni Malinen * WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed 799b9a5f8caSJouni Malinen * WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed 800b9a5f8caSJouni Malinen * WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed 801b9a5f8caSJouni Malinen * WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed 802b9a5f8caSJouni Malinen */ 803b9a5f8caSJouni Malinen enum wiphy_params_flags { 804b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_SHORT = 1 << 0, 805b9a5f8caSJouni Malinen WIPHY_PARAM_RETRY_LONG = 1 << 1, 806b9a5f8caSJouni Malinen WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, 807b9a5f8caSJouni Malinen WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, 808b9a5f8caSJouni Malinen }; 809b9a5f8caSJouni Malinen 810b9a5f8caSJouni Malinen /** 8117643a2c3SJohannes Berg * enum tx_power_setting - TX power adjustment 8127643a2c3SJohannes Berg * 8137643a2c3SJohannes Berg * @TX_POWER_AUTOMATIC: the dbm parameter is ignored 8147643a2c3SJohannes Berg * @TX_POWER_LIMITED: limit TX power by the dbm parameter 8157643a2c3SJohannes Berg * @TX_POWER_FIXED: fix TX power to the dbm parameter 8167643a2c3SJohannes Berg */ 8177643a2c3SJohannes Berg enum tx_power_setting { 8187643a2c3SJohannes Berg TX_POWER_AUTOMATIC, 8197643a2c3SJohannes Berg TX_POWER_LIMITED, 8207643a2c3SJohannes Berg TX_POWER_FIXED, 8217643a2c3SJohannes Berg }; 8227643a2c3SJohannes Berg 8239930380fSJohannes Berg /* 8249930380fSJohannes Berg * cfg80211_bitrate_mask - masks for bitrate control 8259930380fSJohannes Berg */ 8269930380fSJohannes Berg struct cfg80211_bitrate_mask { 8279930380fSJohannes Berg /* 8289930380fSJohannes Berg * As discussed in Berlin, this struct really 8299930380fSJohannes Berg * should look like this: 8309930380fSJohannes Berg 8319930380fSJohannes Berg struct { 8329930380fSJohannes Berg u32 legacy; 8339930380fSJohannes Berg u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; 8349930380fSJohannes Berg } control[IEEE80211_NUM_BANDS]; 8359930380fSJohannes Berg 8369930380fSJohannes Berg * Since we can always fix in-kernel users, let's keep 8379930380fSJohannes Berg * it simpler for now: 8389930380fSJohannes Berg */ 8399930380fSJohannes Berg u32 fixed; /* fixed bitrate, 0 == not fixed */ 8409930380fSJohannes Berg u32 maxrate; /* in kbps, 0 == no limit */ 8419930380fSJohannes Berg }; 8429930380fSJohannes Berg 8437643a2c3SJohannes Berg /** 844704232c2SJohannes Berg * struct cfg80211_ops - backend description for wireless configuration 845704232c2SJohannes Berg * 846704232c2SJohannes Berg * This struct is registered by fullmac card drivers and/or wireless stacks 847704232c2SJohannes Berg * in order to handle configuration requests on their interfaces. 848704232c2SJohannes Berg * 849704232c2SJohannes Berg * All callbacks except where otherwise noted should return 0 850704232c2SJohannes Berg * on success or a negative error code. 851704232c2SJohannes Berg * 85243fb45cbSJohannes Berg * All operations are currently invoked under rtnl for consistency with the 85343fb45cbSJohannes Berg * wireless extensions but this is subject to reevaluation as soon as this 85443fb45cbSJohannes Berg * code is used more widely and we have a first user without wext. 85543fb45cbSJohannes Berg * 8560378b3f1SJohannes Berg * @suspend: wiphy device needs to be suspended 8570378b3f1SJohannes Berg * @resume: wiphy device needs to be resumed 8580378b3f1SJohannes Berg * 85960719ffdSJohannes Berg * @add_virtual_intf: create a new virtual interface with the given name, 860463d0183SJohannes Berg * must set the struct wireless_dev's iftype. Beware: You must create 861463d0183SJohannes Berg * the new netdev in the wiphy's network namespace! 862704232c2SJohannes Berg * 863704232c2SJohannes Berg * @del_virtual_intf: remove the virtual interface determined by ifindex. 86455682965SJohannes Berg * 86560719ffdSJohannes Berg * @change_virtual_intf: change type/configuration of virtual interface, 86660719ffdSJohannes Berg * keep the struct wireless_dev's iftype updated. 86755682965SJohannes Berg * 86841ade00fSJohannes Berg * @add_key: add a key with the given parameters. @mac_addr will be %NULL 86941ade00fSJohannes Berg * when adding a group key. 87041ade00fSJohannes Berg * 87141ade00fSJohannes Berg * @get_key: get information about the key with the given parameters. 87241ade00fSJohannes Berg * @mac_addr will be %NULL when requesting information for a group 87341ade00fSJohannes Berg * key. All pointers given to the @callback function need not be valid 874e3da574aSJohannes Berg * after it returns. This function should return an error if it is 875e3da574aSJohannes Berg * not possible to retrieve the key, -ENOENT if it doesn't exist. 87641ade00fSJohannes Berg * 87741ade00fSJohannes Berg * @del_key: remove a key given the @mac_addr (%NULL for a group key) 878e3da574aSJohannes Berg * and @key_index, return -ENOENT if the key doesn't exist. 87941ade00fSJohannes Berg * 88041ade00fSJohannes Berg * @set_default_key: set the default key on an interface 881ed1b6cc7SJohannes Berg * 8823cfcf6acSJouni Malinen * @set_default_mgmt_key: set the default management frame key on an interface 8833cfcf6acSJouni Malinen * 884ed1b6cc7SJohannes Berg * @add_beacon: Add a beacon with given parameters, @head, @interval 885ed1b6cc7SJohannes Berg * and @dtim_period will be valid, @tail is optional. 886ed1b6cc7SJohannes Berg * @set_beacon: Change the beacon parameters for an access point mode 887ed1b6cc7SJohannes Berg * interface. This should reject the call when no beacon has been 888ed1b6cc7SJohannes Berg * configured. 889ed1b6cc7SJohannes Berg * @del_beacon: Remove beacon configuration and stop sending the beacon. 8905727ef1bSJohannes Berg * 8915727ef1bSJohannes Berg * @add_station: Add a new station. 8925727ef1bSJohannes Berg * 8935727ef1bSJohannes Berg * @del_station: Remove a station; @mac may be NULL to remove all stations. 8945727ef1bSJohannes Berg * 8955727ef1bSJohannes Berg * @change_station: Modify a given station. 8962ec600d6SLuis Carlos Cobo * 89793da9cc1Scolin@cozybit.com * @get_mesh_params: Put the current mesh parameters into *params 89893da9cc1Scolin@cozybit.com * 89993da9cc1Scolin@cozybit.com * @set_mesh_params: Set mesh parameters. 90093da9cc1Scolin@cozybit.com * The mask is a bitfield which tells us which parameters to 90193da9cc1Scolin@cozybit.com * set, and which to leave alone. 90293da9cc1Scolin@cozybit.com * 9032ec600d6SLuis Carlos Cobo * @set_mesh_cfg: set mesh parameters (by now, just mesh id) 9049f1ba906SJouni Malinen * 9059f1ba906SJouni Malinen * @change_bss: Modify parameters for a given BSS. 90631888487SJouni Malinen * 90731888487SJouni Malinen * @set_txq_params: Set TX queue parameters 90872bdcf34SJouni Malinen * 90972bdcf34SJouni Malinen * @set_channel: Set channel 9109aed3cc1SJouni Malinen * 9112a519311SJohannes Berg * @scan: Request to do a scan. If returning zero, the scan request is given 9122a519311SJohannes Berg * the driver, and will be valid until passed to cfg80211_scan_done(). 9132a519311SJohannes Berg * For scan results, call cfg80211_inform_bss(); you can call this outside 9142a519311SJohannes Berg * the scan/scan_done bracket too. 915636a5d36SJouni Malinen * 916636a5d36SJouni Malinen * @auth: Request to authenticate with the specified peer 917636a5d36SJouni Malinen * @assoc: Request to (re)associate with the specified peer 918636a5d36SJouni Malinen * @deauth: Request to deauthenticate from the specified peer 919636a5d36SJouni Malinen * @disassoc: Request to disassociate from the specified peer 92004a773adSJohannes Berg * 921b23aa676SSamuel Ortiz * @connect: Connect to the ESS with the specified parameters. When connected, 922b23aa676SSamuel Ortiz * call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS. 923b23aa676SSamuel Ortiz * If the connection fails for some reason, call cfg80211_connect_result() 924b23aa676SSamuel Ortiz * with the status from the AP. 925b23aa676SSamuel Ortiz * @disconnect: Disconnect from the BSS/ESS. 926b23aa676SSamuel Ortiz * 92704a773adSJohannes Berg * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 92804a773adSJohannes Berg * cfg80211_ibss_joined(), also call that function when changing BSSID due 92904a773adSJohannes Berg * to a merge. 93004a773adSJohannes Berg * @leave_ibss: Leave the IBSS. 931b9a5f8caSJouni Malinen * 932b9a5f8caSJouni Malinen * @set_wiphy_params: Notify that wiphy parameters have changed; 933b9a5f8caSJouni Malinen * @changed bitfield (see &enum wiphy_params_flags) describes which values 934b9a5f8caSJouni Malinen * have changed. The actual parameter values are available in 935b9a5f8caSJouni Malinen * struct wiphy. If returning an error, no value should be changed. 9367643a2c3SJohannes Berg * 9377643a2c3SJohannes Berg * @set_tx_power: set the transmit power according to the parameters 9387643a2c3SJohannes Berg * @get_tx_power: store the current TX power into the dbm variable; 9391f87f7d3SJohannes Berg * return 0 if successful 9401f87f7d3SJohannes Berg * 9411f87f7d3SJohannes Berg * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 9421f87f7d3SJohannes Berg * functions to adjust rfkill hw state 943aff89a9bSJohannes Berg * 944aff89a9bSJohannes Berg * @testmode_cmd: run a test mode command 945704232c2SJohannes Berg */ 946704232c2SJohannes Berg struct cfg80211_ops { 9470378b3f1SJohannes Berg int (*suspend)(struct wiphy *wiphy); 9480378b3f1SJohannes Berg int (*resume)(struct wiphy *wiphy); 9490378b3f1SJohannes Berg 950704232c2SJohannes Berg int (*add_virtual_intf)(struct wiphy *wiphy, char *name, 9512ec600d6SLuis Carlos Cobo enum nl80211_iftype type, u32 *flags, 9522ec600d6SLuis Carlos Cobo struct vif_params *params); 953463d0183SJohannes Berg int (*del_virtual_intf)(struct wiphy *wiphy, struct net_device *dev); 954e36d56b6SJohannes Berg int (*change_virtual_intf)(struct wiphy *wiphy, 955e36d56b6SJohannes Berg struct net_device *dev, 9562ec600d6SLuis Carlos Cobo enum nl80211_iftype type, u32 *flags, 9572ec600d6SLuis Carlos Cobo struct vif_params *params); 95841ade00fSJohannes Berg 95941ade00fSJohannes Berg int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 9604e943900SJohannes Berg u8 key_index, const u8 *mac_addr, 96141ade00fSJohannes Berg struct key_params *params); 96241ade00fSJohannes Berg int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 9634e943900SJohannes Berg u8 key_index, const u8 *mac_addr, void *cookie, 96441ade00fSJohannes Berg void (*callback)(void *cookie, struct key_params*)); 96541ade00fSJohannes Berg int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 9664e943900SJohannes Berg u8 key_index, const u8 *mac_addr); 96741ade00fSJohannes Berg int (*set_default_key)(struct wiphy *wiphy, 96841ade00fSJohannes Berg struct net_device *netdev, 96941ade00fSJohannes Berg u8 key_index); 9703cfcf6acSJouni Malinen int (*set_default_mgmt_key)(struct wiphy *wiphy, 9713cfcf6acSJouni Malinen struct net_device *netdev, 9723cfcf6acSJouni Malinen u8 key_index); 973ed1b6cc7SJohannes Berg 974ed1b6cc7SJohannes Berg int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev, 975ed1b6cc7SJohannes Berg struct beacon_parameters *info); 976ed1b6cc7SJohannes Berg int (*set_beacon)(struct wiphy *wiphy, struct net_device *dev, 977ed1b6cc7SJohannes Berg struct beacon_parameters *info); 978ed1b6cc7SJohannes Berg int (*del_beacon)(struct wiphy *wiphy, struct net_device *dev); 9795727ef1bSJohannes Berg 9805727ef1bSJohannes Berg 9815727ef1bSJohannes Berg int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 9825727ef1bSJohannes Berg u8 *mac, struct station_parameters *params); 9835727ef1bSJohannes Berg int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 9845727ef1bSJohannes Berg u8 *mac); 9855727ef1bSJohannes Berg int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 9865727ef1bSJohannes Berg u8 *mac, struct station_parameters *params); 987fd5b74dcSJohannes Berg int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 9882ec600d6SLuis Carlos Cobo u8 *mac, struct station_info *sinfo); 9892ec600d6SLuis Carlos Cobo int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, 9902ec600d6SLuis Carlos Cobo int idx, u8 *mac, struct station_info *sinfo); 9912ec600d6SLuis Carlos Cobo 9922ec600d6SLuis Carlos Cobo int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 9932ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop); 9942ec600d6SLuis Carlos Cobo int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 9952ec600d6SLuis Carlos Cobo u8 *dst); 9962ec600d6SLuis Carlos Cobo int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 9972ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop); 9982ec600d6SLuis Carlos Cobo int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 9992ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop, 10002ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 10012ec600d6SLuis Carlos Cobo int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 10022ec600d6SLuis Carlos Cobo int idx, u8 *dst, u8 *next_hop, 10032ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 100493da9cc1Scolin@cozybit.com int (*get_mesh_params)(struct wiphy *wiphy, 100593da9cc1Scolin@cozybit.com struct net_device *dev, 100693da9cc1Scolin@cozybit.com struct mesh_config *conf); 100793da9cc1Scolin@cozybit.com int (*set_mesh_params)(struct wiphy *wiphy, 100893da9cc1Scolin@cozybit.com struct net_device *dev, 100993da9cc1Scolin@cozybit.com const struct mesh_config *nconf, u32 mask); 10109f1ba906SJouni Malinen int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 10119f1ba906SJouni Malinen struct bss_parameters *params); 101231888487SJouni Malinen 101331888487SJouni Malinen int (*set_txq_params)(struct wiphy *wiphy, 101431888487SJouni Malinen struct ieee80211_txq_params *params); 101572bdcf34SJouni Malinen 101672bdcf34SJouni Malinen int (*set_channel)(struct wiphy *wiphy, 101772bdcf34SJouni Malinen struct ieee80211_channel *chan, 1018094d05dcSSujith enum nl80211_channel_type channel_type); 10199aed3cc1SJouni Malinen 10202a519311SJohannes Berg int (*scan)(struct wiphy *wiphy, struct net_device *dev, 10212a519311SJohannes Berg struct cfg80211_scan_request *request); 1022636a5d36SJouni Malinen 1023636a5d36SJouni Malinen int (*auth)(struct wiphy *wiphy, struct net_device *dev, 1024636a5d36SJouni Malinen struct cfg80211_auth_request *req); 1025636a5d36SJouni Malinen int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 1026636a5d36SJouni Malinen struct cfg80211_assoc_request *req); 1027636a5d36SJouni Malinen int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 1028667503ddSJohannes Berg struct cfg80211_deauth_request *req, 1029667503ddSJohannes Berg void *cookie); 1030636a5d36SJouni Malinen int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 1031667503ddSJohannes Berg struct cfg80211_disassoc_request *req, 1032667503ddSJohannes Berg void *cookie); 103304a773adSJohannes Berg 1034b23aa676SSamuel Ortiz int (*connect)(struct wiphy *wiphy, struct net_device *dev, 1035b23aa676SSamuel Ortiz struct cfg80211_connect_params *sme); 1036b23aa676SSamuel Ortiz int (*disconnect)(struct wiphy *wiphy, struct net_device *dev, 1037b23aa676SSamuel Ortiz u16 reason_code); 1038b23aa676SSamuel Ortiz 103904a773adSJohannes Berg int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, 104004a773adSJohannes Berg struct cfg80211_ibss_params *params); 104104a773adSJohannes Berg int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 1042b9a5f8caSJouni Malinen 1043b9a5f8caSJouni Malinen int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); 10447643a2c3SJohannes Berg 10457643a2c3SJohannes Berg int (*set_tx_power)(struct wiphy *wiphy, 10467643a2c3SJohannes Berg enum tx_power_setting type, int dbm); 10477643a2c3SJohannes Berg int (*get_tx_power)(struct wiphy *wiphy, int *dbm); 10481f87f7d3SJohannes Berg 1049ab737a4fSJohannes Berg int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, 1050ab737a4fSJohannes Berg u8 *addr); 1051ab737a4fSJohannes Berg 10521f87f7d3SJohannes Berg void (*rfkill_poll)(struct wiphy *wiphy); 1053aff89a9bSJohannes Berg 1054aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 1055aff89a9bSJohannes Berg int (*testmode_cmd)(struct wiphy *wiphy, void *data, int len); 1056aff89a9bSJohannes Berg #endif 1057bc92afd9SJohannes Berg 10589930380fSJohannes Berg int (*set_bitrate_mask)(struct wiphy *wiphy, 10599930380fSJohannes Berg struct net_device *dev, 10609930380fSJohannes Berg const u8 *peer, 10619930380fSJohannes Berg const struct cfg80211_bitrate_mask *mask); 10629930380fSJohannes Berg 1063bc92afd9SJohannes Berg /* some temporary stuff to finish wext */ 1064bc92afd9SJohannes Berg int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 1065bc92afd9SJohannes Berg bool enabled, int timeout); 1066704232c2SJohannes Berg }; 1067704232c2SJohannes Berg 1068d3236553SJohannes Berg /* 1069d3236553SJohannes Berg * wireless hardware and networking interfaces structures 1070d3236553SJohannes Berg * and registration/helper functions 1071d3236553SJohannes Berg */ 1072d3236553SJohannes Berg 1073d3236553SJohannes Berg /** 1074d3236553SJohannes Berg * struct wiphy - wireless hardware description 1075d3236553SJohannes Berg * @idx: the wiphy index assigned to this item 1076d3236553SJohannes Berg * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> 1077d3236553SJohannes Berg * @custom_regulatory: tells us the driver for this device 1078d3236553SJohannes Berg * has its own custom regulatory domain and cannot identify the 1079d3236553SJohannes Berg * ISO / IEC 3166 alpha2 it belongs to. When this is enabled 1080d3236553SJohannes Berg * we will disregard the first regulatory hint (when the 1081d3236553SJohannes Berg * initiator is %REGDOM_SET_BY_CORE). 1082d3236553SJohannes Berg * @strict_regulatory: tells us the driver for this device will ignore 1083d3236553SJohannes Berg * regulatory domain settings until it gets its own regulatory domain 1084d3236553SJohannes Berg * via its regulatory_hint(). After its gets its own regulatory domain 1085d3236553SJohannes Berg * it will only allow further regulatory domain settings to further 1086d3236553SJohannes Berg * enhance compliance. For example if channel 13 and 14 are disabled 1087d3236553SJohannes Berg * by this regulatory domain no user regulatory domain can enable these 1088d3236553SJohannes Berg * channels at a later time. This can be used for devices which do not 1089d3236553SJohannes Berg * have calibration information gauranteed for frequencies or settings 1090d3236553SJohannes Berg * outside of its regulatory domain. 109137184244SLuis R. Rodriguez * @disable_beacon_hints: enable this if your driver needs to ensure that 109237184244SLuis R. Rodriguez * passive scan flags and beaconing flags may not be lifted by cfg80211 109337184244SLuis R. Rodriguez * due to regulatory beacon hints. For more information on beacon 109437184244SLuis R. Rodriguez * hints read the documenation for regulatory_hint_found_beacon() 1095d3236553SJohannes Berg * @reg_notifier: the driver's regulatory notification callback 1096d3236553SJohannes Berg * @regd: the driver's regulatory domain, if one was requested via 1097d3236553SJohannes Berg * the regulatory_hint() API. This can be used by the driver 1098d3236553SJohannes Berg * on the reg_notifier() if it chooses to ignore future 1099d3236553SJohannes Berg * regulatory domain changes caused by other drivers. 1100d3236553SJohannes Berg * @signal_type: signal type reported in &struct cfg80211_bss. 1101d3236553SJohannes Berg * @cipher_suites: supported cipher suites 1102d3236553SJohannes Berg * @n_cipher_suites: number of supported cipher suites 1103b9a5f8caSJouni Malinen * @retry_short: Retry limit for short frames (dot11ShortRetryLimit) 1104b9a5f8caSJouni Malinen * @retry_long: Retry limit for long frames (dot11LongRetryLimit) 1105b9a5f8caSJouni Malinen * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 1106b9a5f8caSJouni Malinen * -1 = fragmentation disabled, only odd values >= 256 used 1107b9a5f8caSJouni Malinen * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 1108463d0183SJohannes Berg * @net: the network namespace this wiphy currently lives in 1109463d0183SJohannes Berg * @netnsok: if set to false, do not allow changing the netns of this 1110463d0183SJohannes Berg * wiphy at all 111116cb9d42SJohannes Berg * @ps_default: default for powersave, will be set depending on the 111216cb9d42SJohannes Berg * kernel's default on wiphy_new(), but can be changed by the 111316cb9d42SJohannes Berg * driver if it has a good reason to override the default 1114d3236553SJohannes Berg */ 1115d3236553SJohannes Berg struct wiphy { 1116d3236553SJohannes Berg /* assign these fields before you register the wiphy */ 1117d3236553SJohannes Berg 1118d3236553SJohannes Berg /* permanent MAC address */ 1119d3236553SJohannes Berg u8 perm_addr[ETH_ALEN]; 1120d3236553SJohannes Berg 1121d3236553SJohannes Berg /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 1122d3236553SJohannes Berg u16 interface_modes; 1123d3236553SJohannes Berg 1124d3236553SJohannes Berg bool custom_regulatory; 1125d3236553SJohannes Berg bool strict_regulatory; 112637184244SLuis R. Rodriguez bool disable_beacon_hints; 1127d3236553SJohannes Berg 1128463d0183SJohannes Berg bool netnsok; 112916cb9d42SJohannes Berg bool ps_default; 1130463d0183SJohannes Berg 1131d3236553SJohannes Berg enum cfg80211_signal_type signal_type; 1132d3236553SJohannes Berg 1133d3236553SJohannes Berg int bss_priv_size; 1134d3236553SJohannes Berg u8 max_scan_ssids; 1135d3236553SJohannes Berg u16 max_scan_ie_len; 1136d3236553SJohannes Berg 1137d3236553SJohannes Berg int n_cipher_suites; 1138d3236553SJohannes Berg const u32 *cipher_suites; 1139d3236553SJohannes Berg 1140b9a5f8caSJouni Malinen u8 retry_short; 1141b9a5f8caSJouni Malinen u8 retry_long; 1142b9a5f8caSJouni Malinen u32 frag_threshold; 1143b9a5f8caSJouni Malinen u32 rts_threshold; 1144b9a5f8caSJouni Malinen 1145d3236553SJohannes Berg /* If multiple wiphys are registered and you're handed e.g. 1146d3236553SJohannes Berg * a regular netdev with assigned ieee80211_ptr, you won't 1147d3236553SJohannes Berg * know whether it points to a wiphy your driver has registered 1148d3236553SJohannes Berg * or not. Assign this to something global to your driver to 1149d3236553SJohannes Berg * help determine whether you own this wiphy or not. */ 1150cf5aa2f1SDavid Kilroy const void *privid; 1151d3236553SJohannes Berg 1152d3236553SJohannes Berg struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; 1153d3236553SJohannes Berg 1154d3236553SJohannes Berg /* Lets us get back the wiphy on the callback */ 1155d3236553SJohannes Berg int (*reg_notifier)(struct wiphy *wiphy, 1156d3236553SJohannes Berg struct regulatory_request *request); 1157d3236553SJohannes Berg 1158d3236553SJohannes Berg /* fields below are read-only, assigned by cfg80211 */ 1159d3236553SJohannes Berg 1160d3236553SJohannes Berg const struct ieee80211_regdomain *regd; 1161d3236553SJohannes Berg 1162d3236553SJohannes Berg /* the item in /sys/class/ieee80211/ points to this, 1163d3236553SJohannes Berg * you need use set_wiphy_dev() (see below) */ 1164d3236553SJohannes Berg struct device dev; 1165d3236553SJohannes Berg 1166d3236553SJohannes Berg /* dir in debugfs: ieee80211/<wiphyname> */ 1167d3236553SJohannes Berg struct dentry *debugfsdir; 1168d3236553SJohannes Berg 1169463d0183SJohannes Berg #ifdef CONFIG_NET_NS 1170463d0183SJohannes Berg /* the network namespace this phy lives in currently */ 1171463d0183SJohannes Berg struct net *_net; 1172463d0183SJohannes Berg #endif 1173463d0183SJohannes Berg 1174d3236553SJohannes Berg char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); 1175d3236553SJohannes Berg }; 1176d3236553SJohannes Berg 1177463d0183SJohannes Berg #ifdef CONFIG_NET_NS 1178463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy) 1179463d0183SJohannes Berg { 1180463d0183SJohannes Berg return wiphy->_net; 1181463d0183SJohannes Berg } 1182463d0183SJohannes Berg 1183463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 1184463d0183SJohannes Berg { 1185463d0183SJohannes Berg wiphy->_net = net; 1186463d0183SJohannes Berg } 1187463d0183SJohannes Berg #else 1188463d0183SJohannes Berg static inline struct net *wiphy_net(struct wiphy *wiphy) 1189463d0183SJohannes Berg { 1190463d0183SJohannes Berg return &init_net; 1191463d0183SJohannes Berg } 1192463d0183SJohannes Berg 1193463d0183SJohannes Berg static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 1194463d0183SJohannes Berg { 1195463d0183SJohannes Berg } 1196463d0183SJohannes Berg #endif 1197463d0183SJohannes Berg 1198d3236553SJohannes Berg /** 1199d3236553SJohannes Berg * wiphy_priv - return priv from wiphy 1200d3236553SJohannes Berg * 1201d3236553SJohannes Berg * @wiphy: the wiphy whose priv pointer to return 1202d3236553SJohannes Berg */ 1203d3236553SJohannes Berg static inline void *wiphy_priv(struct wiphy *wiphy) 1204d3236553SJohannes Berg { 1205d3236553SJohannes Berg BUG_ON(!wiphy); 1206d3236553SJohannes Berg return &wiphy->priv; 1207d3236553SJohannes Berg } 1208d3236553SJohannes Berg 1209d3236553SJohannes Berg /** 1210f1f74825SDavid Kilroy * priv_to_wiphy - return the wiphy containing the priv 1211f1f74825SDavid Kilroy * 1212f1f74825SDavid Kilroy * @priv: a pointer previously returned by wiphy_priv 1213f1f74825SDavid Kilroy */ 1214f1f74825SDavid Kilroy static inline struct wiphy *priv_to_wiphy(void *priv) 1215f1f74825SDavid Kilroy { 1216f1f74825SDavid Kilroy BUG_ON(!priv); 1217f1f74825SDavid Kilroy return container_of(priv, struct wiphy, priv); 1218f1f74825SDavid Kilroy } 1219f1f74825SDavid Kilroy 1220f1f74825SDavid Kilroy /** 1221d3236553SJohannes Berg * set_wiphy_dev - set device pointer for wiphy 1222d3236553SJohannes Berg * 1223d3236553SJohannes Berg * @wiphy: The wiphy whose device to bind 1224d3236553SJohannes Berg * @dev: The device to parent it to 1225d3236553SJohannes Berg */ 1226d3236553SJohannes Berg static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) 1227d3236553SJohannes Berg { 1228d3236553SJohannes Berg wiphy->dev.parent = dev; 1229d3236553SJohannes Berg } 1230d3236553SJohannes Berg 1231d3236553SJohannes Berg /** 1232d3236553SJohannes Berg * wiphy_dev - get wiphy dev pointer 1233d3236553SJohannes Berg * 1234d3236553SJohannes Berg * @wiphy: The wiphy whose device struct to look up 1235d3236553SJohannes Berg */ 1236d3236553SJohannes Berg static inline struct device *wiphy_dev(struct wiphy *wiphy) 1237d3236553SJohannes Berg { 1238d3236553SJohannes Berg return wiphy->dev.parent; 1239d3236553SJohannes Berg } 1240d3236553SJohannes Berg 1241d3236553SJohannes Berg /** 1242d3236553SJohannes Berg * wiphy_name - get wiphy name 1243d3236553SJohannes Berg * 1244d3236553SJohannes Berg * @wiphy: The wiphy whose name to return 1245d3236553SJohannes Berg */ 1246d3236553SJohannes Berg static inline const char *wiphy_name(struct wiphy *wiphy) 1247d3236553SJohannes Berg { 1248d3236553SJohannes Berg return dev_name(&wiphy->dev); 1249d3236553SJohannes Berg } 1250d3236553SJohannes Berg 1251d3236553SJohannes Berg /** 1252d3236553SJohannes Berg * wiphy_new - create a new wiphy for use with cfg80211 1253d3236553SJohannes Berg * 1254d3236553SJohannes Berg * @ops: The configuration operations for this device 1255d3236553SJohannes Berg * @sizeof_priv: The size of the private area to allocate 1256d3236553SJohannes Berg * 1257d3236553SJohannes Berg * Create a new wiphy and associate the given operations with it. 1258d3236553SJohannes Berg * @sizeof_priv bytes are allocated for private use. 1259d3236553SJohannes Berg * 1260d3236553SJohannes Berg * The returned pointer must be assigned to each netdev's 1261d3236553SJohannes Berg * ieee80211_ptr for proper operation. 1262d3236553SJohannes Berg */ 12633dcf670bSDavid Kilroy struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv); 1264d3236553SJohannes Berg 1265d3236553SJohannes Berg /** 1266d3236553SJohannes Berg * wiphy_register - register a wiphy with cfg80211 1267d3236553SJohannes Berg * 1268d3236553SJohannes Berg * @wiphy: The wiphy to register. 1269d3236553SJohannes Berg * 1270d3236553SJohannes Berg * Returns a non-negative wiphy index or a negative error code. 1271d3236553SJohannes Berg */ 1272d3236553SJohannes Berg extern int wiphy_register(struct wiphy *wiphy); 1273d3236553SJohannes Berg 1274d3236553SJohannes Berg /** 1275d3236553SJohannes Berg * wiphy_unregister - deregister a wiphy from cfg80211 1276d3236553SJohannes Berg * 1277d3236553SJohannes Berg * @wiphy: The wiphy to unregister. 1278d3236553SJohannes Berg * 1279d3236553SJohannes Berg * After this call, no more requests can be made with this priv 1280d3236553SJohannes Berg * pointer, but the call may sleep to wait for an outstanding 1281d3236553SJohannes Berg * request that is being handled. 1282d3236553SJohannes Berg */ 1283d3236553SJohannes Berg extern void wiphy_unregister(struct wiphy *wiphy); 1284d3236553SJohannes Berg 1285d3236553SJohannes Berg /** 1286d3236553SJohannes Berg * wiphy_free - free wiphy 1287d3236553SJohannes Berg * 1288d3236553SJohannes Berg * @wiphy: The wiphy to free 1289d3236553SJohannes Berg */ 1290d3236553SJohannes Berg extern void wiphy_free(struct wiphy *wiphy); 1291d3236553SJohannes Berg 1292fffd0934SJohannes Berg /* internal structs */ 12936829c878SJohannes Berg struct cfg80211_conn; 129419957bb3SJohannes Berg struct cfg80211_internal_bss; 1295fffd0934SJohannes Berg struct cfg80211_cached_keys; 129619957bb3SJohannes Berg 129719957bb3SJohannes Berg #define MAX_AUTH_BSSES 4 12986829c878SJohannes Berg 1299d3236553SJohannes Berg /** 1300d3236553SJohannes Berg * struct wireless_dev - wireless per-netdev state 1301d3236553SJohannes Berg * 1302d3236553SJohannes Berg * This structure must be allocated by the driver/stack 1303d3236553SJohannes Berg * that uses the ieee80211_ptr field in struct net_device 1304d3236553SJohannes Berg * (this is intentional so it can be allocated along with 1305d3236553SJohannes Berg * the netdev.) 1306d3236553SJohannes Berg * 1307d3236553SJohannes Berg * @wiphy: pointer to hardware description 1308d3236553SJohannes Berg * @iftype: interface type 1309d3236553SJohannes Berg * @list: (private) Used to collect the interfaces 1310d3236553SJohannes Berg * @netdev: (private) Used to reference back to the netdev 1311d3236553SJohannes Berg * @current_bss: (private) Used by the internal configuration code 1312d3236553SJohannes Berg * @bssid: (private) Used by the internal configuration code 1313d3236553SJohannes Berg * @ssid: (private) Used by the internal configuration code 1314d3236553SJohannes Berg * @ssid_len: (private) Used by the internal configuration code 1315d3236553SJohannes Berg * @wext: (private) Used by the internal wireless extensions compat code 1316d3236553SJohannes Berg * @wext_bssid: (private) Used by the internal wireless extensions compat code 1317d3236553SJohannes Berg */ 1318d3236553SJohannes Berg struct wireless_dev { 1319d3236553SJohannes Berg struct wiphy *wiphy; 1320d3236553SJohannes Berg enum nl80211_iftype iftype; 1321d3236553SJohannes Berg 1322667503ddSJohannes Berg /* the remainder of this struct should be private to cfg80211 */ 1323d3236553SJohannes Berg struct list_head list; 1324d3236553SJohannes Berg struct net_device *netdev; 1325d3236553SJohannes Berg 1326667503ddSJohannes Berg struct mutex mtx; 1327667503ddSJohannes Berg 1328*ad002395SJohannes Berg struct work_struct cleanup_work; 1329*ad002395SJohannes Berg 1330b23aa676SSamuel Ortiz /* currently used for IBSS and SME - might be rearranged later */ 1331d3236553SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 1332d3236553SJohannes Berg u8 ssid_len; 1333b23aa676SSamuel Ortiz enum { 1334b23aa676SSamuel Ortiz CFG80211_SME_IDLE, 13356829c878SJohannes Berg CFG80211_SME_CONNECTING, 1336b23aa676SSamuel Ortiz CFG80211_SME_CONNECTED, 1337b23aa676SSamuel Ortiz } sme_state; 13386829c878SJohannes Berg struct cfg80211_conn *conn; 1339fffd0934SJohannes Berg struct cfg80211_cached_keys *connect_keys; 1340d3236553SJohannes Berg 1341667503ddSJohannes Berg struct list_head event_list; 1342667503ddSJohannes Berg spinlock_t event_lock; 1343667503ddSJohannes Berg 134419957bb3SJohannes Berg struct cfg80211_internal_bss *authtry_bsses[MAX_AUTH_BSSES]; 134519957bb3SJohannes Berg struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES]; 134619957bb3SJohannes Berg struct cfg80211_internal_bss *current_bss; /* associated / joined */ 134719957bb3SJohannes Berg 1348d3236553SJohannes Berg #ifdef CONFIG_WIRELESS_EXT 1349d3236553SJohannes Berg /* wext data */ 1350cbe8fa9cSJohannes Berg struct { 1351cbe8fa9cSJohannes Berg struct cfg80211_ibss_params ibss; 1352f2129354SJohannes Berg struct cfg80211_connect_params connect; 1353fffd0934SJohannes Berg struct cfg80211_cached_keys *keys; 1354f2129354SJohannes Berg u8 *ie; 1355f2129354SJohannes Berg size_t ie_len; 1356f401a6f7SJohannes Berg u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 1357f2129354SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 135808645126SJohannes Berg s8 default_key, default_mgmt_key; 1359f401a6f7SJohannes Berg bool ps, prev_bssid_valid; 1360bc92afd9SJohannes Berg int ps_timeout; 1361cbe8fa9cSJohannes Berg } wext; 1362d3236553SJohannes Berg #endif 1363d3236553SJohannes Berg }; 1364d3236553SJohannes Berg 1365d3236553SJohannes Berg /** 1366d3236553SJohannes Berg * wdev_priv - return wiphy priv from wireless_dev 1367d3236553SJohannes Berg * 1368d3236553SJohannes Berg * @wdev: The wireless device whose wiphy's priv pointer to return 1369d3236553SJohannes Berg */ 1370d3236553SJohannes Berg static inline void *wdev_priv(struct wireless_dev *wdev) 1371d3236553SJohannes Berg { 1372d3236553SJohannes Berg BUG_ON(!wdev); 1373d3236553SJohannes Berg return wiphy_priv(wdev->wiphy); 1374d3236553SJohannes Berg } 1375d3236553SJohannes Berg 1376d3236553SJohannes Berg /* 1377d3236553SJohannes Berg * Utility functions 1378d3236553SJohannes Berg */ 1379d3236553SJohannes Berg 1380d3236553SJohannes Berg /** 1381d3236553SJohannes Berg * ieee80211_channel_to_frequency - convert channel number to frequency 1382d3236553SJohannes Berg */ 1383d3236553SJohannes Berg extern int ieee80211_channel_to_frequency(int chan); 1384d3236553SJohannes Berg 1385d3236553SJohannes Berg /** 1386d3236553SJohannes Berg * ieee80211_frequency_to_channel - convert frequency to channel number 1387d3236553SJohannes Berg */ 1388d3236553SJohannes Berg extern int ieee80211_frequency_to_channel(int freq); 1389d3236553SJohannes Berg 1390d3236553SJohannes Berg /* 1391d3236553SJohannes Berg * Name indirection necessary because the ieee80211 code also has 1392d3236553SJohannes Berg * a function named "ieee80211_get_channel", so if you include 1393d3236553SJohannes Berg * cfg80211's header file you get cfg80211's version, if you try 1394d3236553SJohannes Berg * to include both header files you'll (rightfully!) get a symbol 1395d3236553SJohannes Berg * clash. 1396d3236553SJohannes Berg */ 1397d3236553SJohannes Berg extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, 1398d3236553SJohannes Berg int freq); 1399d3236553SJohannes Berg /** 1400d3236553SJohannes Berg * ieee80211_get_channel - get channel struct from wiphy for specified frequency 1401d3236553SJohannes Berg */ 1402d3236553SJohannes Berg static inline struct ieee80211_channel * 1403d3236553SJohannes Berg ieee80211_get_channel(struct wiphy *wiphy, int freq) 1404d3236553SJohannes Berg { 1405d3236553SJohannes Berg return __ieee80211_get_channel(wiphy, freq); 1406d3236553SJohannes Berg } 1407d3236553SJohannes Berg 1408d3236553SJohannes Berg /** 1409d3236553SJohannes Berg * ieee80211_get_response_rate - get basic rate for a given rate 1410d3236553SJohannes Berg * 1411d3236553SJohannes Berg * @sband: the band to look for rates in 1412d3236553SJohannes Berg * @basic_rates: bitmap of basic rates 1413d3236553SJohannes Berg * @bitrate: the bitrate for which to find the basic rate 1414d3236553SJohannes Berg * 1415d3236553SJohannes Berg * This function returns the basic rate corresponding to a given 1416d3236553SJohannes Berg * bitrate, that is the next lower bitrate contained in the basic 1417d3236553SJohannes Berg * rate map, which is, for this function, given as a bitmap of 1418d3236553SJohannes Berg * indices of rates in the band's bitrate table. 1419d3236553SJohannes Berg */ 1420d3236553SJohannes Berg struct ieee80211_rate * 1421d3236553SJohannes Berg ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 1422d3236553SJohannes Berg u32 basic_rates, int bitrate); 1423d3236553SJohannes Berg 1424d3236553SJohannes Berg /* 1425d3236553SJohannes Berg * Radiotap parsing functions -- for controlled injection support 1426d3236553SJohannes Berg * 1427d3236553SJohannes Berg * Implemented in net/wireless/radiotap.c 1428d3236553SJohannes Berg * Documentation in Documentation/networking/radiotap-headers.txt 1429d3236553SJohannes Berg */ 1430d3236553SJohannes Berg 1431d3236553SJohannes Berg /** 1432d3236553SJohannes Berg * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 1433d3236553SJohannes Berg * @rtheader: pointer to the radiotap header we are walking through 1434d3236553SJohannes Berg * @max_length: length of radiotap header in cpu byte ordering 1435d3236553SJohannes Berg * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg 1436d3236553SJohannes Berg * @this_arg: pointer to current radiotap arg 1437d3236553SJohannes Berg * @arg_index: internal next argument index 1438d3236553SJohannes Berg * @arg: internal next argument pointer 1439d3236553SJohannes Berg * @next_bitmap: internal pointer to next present u32 1440d3236553SJohannes Berg * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 1441d3236553SJohannes Berg */ 1442d3236553SJohannes Berg 1443d3236553SJohannes Berg struct ieee80211_radiotap_iterator { 1444d3236553SJohannes Berg struct ieee80211_radiotap_header *rtheader; 1445d3236553SJohannes Berg int max_length; 1446d3236553SJohannes Berg int this_arg_index; 1447d3236553SJohannes Berg u8 *this_arg; 1448d3236553SJohannes Berg 1449d3236553SJohannes Berg int arg_index; 1450d3236553SJohannes Berg u8 *arg; 1451d3236553SJohannes Berg __le32 *next_bitmap; 1452d3236553SJohannes Berg u32 bitmap_shifter; 1453d3236553SJohannes Berg }; 1454d3236553SJohannes Berg 1455d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_init( 1456d3236553SJohannes Berg struct ieee80211_radiotap_iterator *iterator, 1457d3236553SJohannes Berg struct ieee80211_radiotap_header *radiotap_header, 1458d3236553SJohannes Berg int max_length); 1459d3236553SJohannes Berg 1460d3236553SJohannes Berg extern int ieee80211_radiotap_iterator_next( 1461d3236553SJohannes Berg struct ieee80211_radiotap_iterator *iterator); 1462d3236553SJohannes Berg 1463e31a16d6SZhu Yi extern const unsigned char rfc1042_header[6]; 1464e31a16d6SZhu Yi extern const unsigned char bridge_tunnel_header[6]; 1465e31a16d6SZhu Yi 1466e31a16d6SZhu Yi /** 1467e31a16d6SZhu Yi * ieee80211_get_hdrlen_from_skb - get header length from data 1468e31a16d6SZhu Yi * 1469e31a16d6SZhu Yi * Given an skb with a raw 802.11 header at the data pointer this function 1470e31a16d6SZhu Yi * returns the 802.11 header length in bytes (not including encryption 1471e31a16d6SZhu Yi * headers). If the data in the sk_buff is too short to contain a valid 802.11 1472e31a16d6SZhu Yi * header the function returns 0. 1473e31a16d6SZhu Yi * 1474e31a16d6SZhu Yi * @skb: the frame 1475e31a16d6SZhu Yi */ 1476e31a16d6SZhu Yi unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); 1477e31a16d6SZhu Yi 1478e31a16d6SZhu Yi /** 1479e31a16d6SZhu Yi * ieee80211_hdrlen - get header length in bytes from frame control 1480e31a16d6SZhu Yi * @fc: frame control field in little-endian format 1481e31a16d6SZhu Yi */ 1482e31a16d6SZhu Yi unsigned int ieee80211_hdrlen(__le16 fc); 1483e31a16d6SZhu Yi 1484e31a16d6SZhu Yi /** 1485e31a16d6SZhu Yi * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 1486e31a16d6SZhu Yi * @skb: the 802.11 data frame 1487e31a16d6SZhu Yi * @addr: the device MAC address 1488e31a16d6SZhu Yi * @iftype: the virtual interface type 1489e31a16d6SZhu Yi */ 1490e31a16d6SZhu Yi int ieee80211_data_to_8023(struct sk_buff *skb, u8 *addr, 1491e31a16d6SZhu Yi enum nl80211_iftype iftype); 1492e31a16d6SZhu Yi 1493e31a16d6SZhu Yi /** 1494e31a16d6SZhu Yi * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11 1495e31a16d6SZhu Yi * @skb: the 802.3 frame 1496e31a16d6SZhu Yi * @addr: the device MAC address 1497e31a16d6SZhu Yi * @iftype: the virtual interface type 1498e31a16d6SZhu Yi * @bssid: the network bssid (used only for iftype STATION and ADHOC) 1499e31a16d6SZhu Yi * @qos: build 802.11 QoS data frame 1500e31a16d6SZhu Yi */ 1501e31a16d6SZhu Yi int ieee80211_data_from_8023(struct sk_buff *skb, u8 *addr, 1502e31a16d6SZhu Yi enum nl80211_iftype iftype, u8 *bssid, bool qos); 1503e31a16d6SZhu Yi 1504e31a16d6SZhu Yi /** 1505e31a16d6SZhu Yi * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame 1506e31a16d6SZhu Yi * @skb: the data frame 1507e31a16d6SZhu Yi */ 1508e31a16d6SZhu Yi unsigned int cfg80211_classify8021d(struct sk_buff *skb); 1509e31a16d6SZhu Yi 1510d3236553SJohannes Berg /* 1511d3236553SJohannes Berg * Regulatory helper functions for wiphys 1512d3236553SJohannes Berg */ 1513d3236553SJohannes Berg 1514d3236553SJohannes Berg /** 1515d3236553SJohannes Berg * regulatory_hint - driver hint to the wireless core a regulatory domain 1516d3236553SJohannes Berg * @wiphy: the wireless device giving the hint (used only for reporting 1517d3236553SJohannes Berg * conflicts) 1518d3236553SJohannes Berg * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain 1519d3236553SJohannes Berg * should be in. If @rd is set this should be NULL. Note that if you 1520d3236553SJohannes Berg * set this to NULL you should still set rd->alpha2 to some accepted 1521d3236553SJohannes Berg * alpha2. 1522d3236553SJohannes Berg * 1523d3236553SJohannes Berg * Wireless drivers can use this function to hint to the wireless core 1524d3236553SJohannes Berg * what it believes should be the current regulatory domain by 1525d3236553SJohannes Berg * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory 1526d3236553SJohannes Berg * domain should be in or by providing a completely build regulatory domain. 1527d3236553SJohannes Berg * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 1528d3236553SJohannes Berg * for a regulatory domain structure for the respective country. 1529d3236553SJohannes Berg * 1530d3236553SJohannes Berg * The wiphy must have been registered to cfg80211 prior to this call. 1531d3236553SJohannes Berg * For cfg80211 drivers this means you must first use wiphy_register(), 1532d3236553SJohannes Berg * for mac80211 drivers you must first use ieee80211_register_hw(). 1533d3236553SJohannes Berg * 1534d3236553SJohannes Berg * Drivers should check the return value, its possible you can get 1535d3236553SJohannes Berg * an -ENOMEM. 1536d3236553SJohannes Berg */ 1537d3236553SJohannes Berg extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 1538d3236553SJohannes Berg 1539d3236553SJohannes Berg /** 1540d3236553SJohannes Berg * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain 1541d3236553SJohannes Berg * @wiphy: the wireless device we want to process the regulatory domain on 1542d3236553SJohannes Berg * @regd: the custom regulatory domain to use for this wiphy 1543d3236553SJohannes Berg * 1544d3236553SJohannes Berg * Drivers can sometimes have custom regulatory domains which do not apply 1545d3236553SJohannes Berg * to a specific country. Drivers can use this to apply such custom regulatory 1546d3236553SJohannes Berg * domains. This routine must be called prior to wiphy registration. The 1547d3236553SJohannes Berg * custom regulatory domain will be trusted completely and as such previous 1548d3236553SJohannes Berg * default channel settings will be disregarded. If no rule is found for a 1549d3236553SJohannes Berg * channel on the regulatory domain the channel will be disabled. 1550d3236553SJohannes Berg */ 1551d3236553SJohannes Berg extern void wiphy_apply_custom_regulatory( 1552d3236553SJohannes Berg struct wiphy *wiphy, 1553d3236553SJohannes Berg const struct ieee80211_regdomain *regd); 1554d3236553SJohannes Berg 1555d3236553SJohannes Berg /** 1556d3236553SJohannes Berg * freq_reg_info - get regulatory information for the given frequency 1557d3236553SJohannes Berg * @wiphy: the wiphy for which we want to process this rule for 1558d3236553SJohannes Berg * @center_freq: Frequency in KHz for which we want regulatory information for 1559038659e7SLuis R. Rodriguez * @desired_bw_khz: the desired max bandwidth you want to use per 1560038659e7SLuis R. Rodriguez * channel. Note that this is still 20 MHz if you want to use HT40 1561038659e7SLuis R. Rodriguez * as HT40 makes use of two channels for its 40 MHz width bandwidth. 1562038659e7SLuis R. Rodriguez * If set to 0 we'll assume you want the standard 20 MHz. 1563d3236553SJohannes Berg * @reg_rule: the regulatory rule which we have for this frequency 1564d3236553SJohannes Berg * 1565d3236553SJohannes Berg * Use this function to get the regulatory rule for a specific frequency on 1566d3236553SJohannes Berg * a given wireless device. If the device has a specific regulatory domain 1567d3236553SJohannes Berg * it wants to follow we respect that unless a country IE has been received 1568d3236553SJohannes Berg * and processed already. 1569d3236553SJohannes Berg * 1570d3236553SJohannes Berg * Returns 0 if it was able to find a valid regulatory rule which does 1571d3236553SJohannes Berg * apply to the given center_freq otherwise it returns non-zero. It will 1572d3236553SJohannes Berg * also return -ERANGE if we determine the given center_freq does not even have 1573d3236553SJohannes Berg * a regulatory rule for a frequency range in the center_freq's band. See 1574d3236553SJohannes Berg * freq_in_rule_band() for our current definition of a band -- this is purely 1575d3236553SJohannes Berg * subjective and right now its 802.11 specific. 1576d3236553SJohannes Berg */ 1577038659e7SLuis R. Rodriguez extern int freq_reg_info(struct wiphy *wiphy, 1578038659e7SLuis R. Rodriguez u32 center_freq, 1579038659e7SLuis R. Rodriguez u32 desired_bw_khz, 1580d3236553SJohannes Berg const struct ieee80211_reg_rule **reg_rule); 1581d3236553SJohannes Berg 1582d3236553SJohannes Berg /* 1583d3236553SJohannes Berg * Temporary wext handlers & helper functions 1584d3236553SJohannes Berg * 1585d3236553SJohannes Berg * In the future cfg80211 will simply assign the entire wext handler 1586d3236553SJohannes Berg * structure to netdevs it manages, but we're not there yet. 1587d3236553SJohannes Berg */ 1588fee52678SJohannes Berg int cfg80211_wext_giwname(struct net_device *dev, 1589fee52678SJohannes Berg struct iw_request_info *info, 1590fee52678SJohannes Berg char *name, char *extra); 1591e60c7744SJohannes Berg int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info, 1592e60c7744SJohannes Berg u32 *mode, char *extra); 1593e60c7744SJohannes Berg int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info, 1594e60c7744SJohannes Berg u32 *mode, char *extra); 15952a519311SJohannes Berg int cfg80211_wext_siwscan(struct net_device *dev, 15962a519311SJohannes Berg struct iw_request_info *info, 15972a519311SJohannes Berg union iwreq_data *wrqu, char *extra); 15982a519311SJohannes Berg int cfg80211_wext_giwscan(struct net_device *dev, 15992a519311SJohannes Berg struct iw_request_info *info, 16002a519311SJohannes Berg struct iw_point *data, char *extra); 1601691597cbSJohannes Berg int cfg80211_wext_siwmlme(struct net_device *dev, 1602691597cbSJohannes Berg struct iw_request_info *info, 1603691597cbSJohannes Berg struct iw_point *data, char *extra); 16044aa188e1SJohannes Berg int cfg80211_wext_giwrange(struct net_device *dev, 16054aa188e1SJohannes Berg struct iw_request_info *info, 16064aa188e1SJohannes Berg struct iw_point *data, char *extra); 1607f2129354SJohannes Berg int cfg80211_wext_siwgenie(struct net_device *dev, 1608f2129354SJohannes Berg struct iw_request_info *info, 1609f2129354SJohannes Berg struct iw_point *data, char *extra); 1610f2129354SJohannes Berg int cfg80211_wext_siwauth(struct net_device *dev, 1611f2129354SJohannes Berg struct iw_request_info *info, 1612f2129354SJohannes Berg struct iw_param *data, char *extra); 1613f2129354SJohannes Berg int cfg80211_wext_giwauth(struct net_device *dev, 1614f2129354SJohannes Berg struct iw_request_info *info, 1615f2129354SJohannes Berg struct iw_param *data, char *extra); 1616f2129354SJohannes Berg 16170e82ffe3SJohannes Berg int cfg80211_wext_siwfreq(struct net_device *dev, 16180e82ffe3SJohannes Berg struct iw_request_info *info, 16190e82ffe3SJohannes Berg struct iw_freq *freq, char *extra); 16200e82ffe3SJohannes Berg int cfg80211_wext_giwfreq(struct net_device *dev, 16210e82ffe3SJohannes Berg struct iw_request_info *info, 16220e82ffe3SJohannes Berg struct iw_freq *freq, char *extra); 16231f9298f9SJohannes Berg int cfg80211_wext_siwessid(struct net_device *dev, 16241f9298f9SJohannes Berg struct iw_request_info *info, 16251f9298f9SJohannes Berg struct iw_point *data, char *ssid); 16261f9298f9SJohannes Berg int cfg80211_wext_giwessid(struct net_device *dev, 16271f9298f9SJohannes Berg struct iw_request_info *info, 16281f9298f9SJohannes Berg struct iw_point *data, char *ssid); 16299930380fSJohannes Berg int cfg80211_wext_siwrate(struct net_device *dev, 16309930380fSJohannes Berg struct iw_request_info *info, 16319930380fSJohannes Berg struct iw_param *rate, char *extra); 16329930380fSJohannes Berg int cfg80211_wext_giwrate(struct net_device *dev, 16339930380fSJohannes Berg struct iw_request_info *info, 16349930380fSJohannes Berg struct iw_param *rate, char *extra); 16359930380fSJohannes Berg 1636b9a5f8caSJouni Malinen int cfg80211_wext_siwrts(struct net_device *dev, 1637b9a5f8caSJouni Malinen struct iw_request_info *info, 1638b9a5f8caSJouni Malinen struct iw_param *rts, char *extra); 1639b9a5f8caSJouni Malinen int cfg80211_wext_giwrts(struct net_device *dev, 1640b9a5f8caSJouni Malinen struct iw_request_info *info, 1641b9a5f8caSJouni Malinen struct iw_param *rts, char *extra); 1642b9a5f8caSJouni Malinen int cfg80211_wext_siwfrag(struct net_device *dev, 1643b9a5f8caSJouni Malinen struct iw_request_info *info, 1644b9a5f8caSJouni Malinen struct iw_param *frag, char *extra); 1645b9a5f8caSJouni Malinen int cfg80211_wext_giwfrag(struct net_device *dev, 1646b9a5f8caSJouni Malinen struct iw_request_info *info, 1647b9a5f8caSJouni Malinen struct iw_param *frag, char *extra); 1648b9a5f8caSJouni Malinen int cfg80211_wext_siwretry(struct net_device *dev, 1649b9a5f8caSJouni Malinen struct iw_request_info *info, 1650b9a5f8caSJouni Malinen struct iw_param *retry, char *extra); 1651b9a5f8caSJouni Malinen int cfg80211_wext_giwretry(struct net_device *dev, 1652b9a5f8caSJouni Malinen struct iw_request_info *info, 1653b9a5f8caSJouni Malinen struct iw_param *retry, char *extra); 165408645126SJohannes Berg int cfg80211_wext_siwencodeext(struct net_device *dev, 165508645126SJohannes Berg struct iw_request_info *info, 165608645126SJohannes Berg struct iw_point *erq, char *extra); 165708645126SJohannes Berg int cfg80211_wext_siwencode(struct net_device *dev, 165808645126SJohannes Berg struct iw_request_info *info, 165908645126SJohannes Berg struct iw_point *erq, char *keybuf); 166008645126SJohannes Berg int cfg80211_wext_giwencode(struct net_device *dev, 166108645126SJohannes Berg struct iw_request_info *info, 166208645126SJohannes Berg struct iw_point *erq, char *keybuf); 16637643a2c3SJohannes Berg int cfg80211_wext_siwtxpower(struct net_device *dev, 16647643a2c3SJohannes Berg struct iw_request_info *info, 16657643a2c3SJohannes Berg union iwreq_data *data, char *keybuf); 16667643a2c3SJohannes Berg int cfg80211_wext_giwtxpower(struct net_device *dev, 16677643a2c3SJohannes Berg struct iw_request_info *info, 16687643a2c3SJohannes Berg union iwreq_data *data, char *keybuf); 16698990646dSJohannes Berg struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev); 1670b9a5f8caSJouni Malinen 1671bc92afd9SJohannes Berg int cfg80211_wext_siwpower(struct net_device *dev, 1672bc92afd9SJohannes Berg struct iw_request_info *info, 1673bc92afd9SJohannes Berg struct iw_param *wrq, char *extra); 1674bc92afd9SJohannes Berg int cfg80211_wext_giwpower(struct net_device *dev, 1675bc92afd9SJohannes Berg struct iw_request_info *info, 1676bc92afd9SJohannes Berg struct iw_param *wrq, char *extra); 1677bc92afd9SJohannes Berg 1678562e4822SJohannes Berg int cfg80211_wext_siwap(struct net_device *dev, 1679ab737a4fSJohannes Berg struct iw_request_info *info, 1680562e4822SJohannes Berg struct sockaddr *ap_addr, char *extra); 1681562e4822SJohannes Berg int cfg80211_wext_giwap(struct net_device *dev, 1682ab737a4fSJohannes Berg struct iw_request_info *info, 1683562e4822SJohannes Berg struct sockaddr *ap_addr, char *extra); 1684ab737a4fSJohannes Berg 1685d3236553SJohannes Berg /* 1686d3236553SJohannes Berg * callbacks for asynchronous cfg80211 methods, notification 1687d3236553SJohannes Berg * functions and BSS handling helpers 1688d3236553SJohannes Berg */ 1689d3236553SJohannes Berg 16902a519311SJohannes Berg /** 16912a519311SJohannes Berg * cfg80211_scan_done - notify that scan finished 16922a519311SJohannes Berg * 16932a519311SJohannes Berg * @request: the corresponding scan request 16942a519311SJohannes Berg * @aborted: set to true if the scan was aborted for any reason, 16952a519311SJohannes Berg * userspace will be notified of that 16962a519311SJohannes Berg */ 16972a519311SJohannes Berg void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted); 16982a519311SJohannes Berg 16992a519311SJohannes Berg /** 17002a519311SJohannes Berg * cfg80211_inform_bss - inform cfg80211 of a new BSS 17012a519311SJohannes Berg * 17022a519311SJohannes Berg * @wiphy: the wiphy reporting the BSS 17032a519311SJohannes Berg * @bss: the found BSS 170477965c97SJohannes Berg * @signal: the signal strength, type depends on the wiphy's signal_type 17052a519311SJohannes Berg * @gfp: context flags 17062a519311SJohannes Berg * 17072a519311SJohannes Berg * This informs cfg80211 that BSS information was found and 17082a519311SJohannes Berg * the BSS should be updated/added. 17092a519311SJohannes Berg */ 17102a519311SJohannes Berg struct cfg80211_bss* 17112a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy, 17122a519311SJohannes Berg struct ieee80211_channel *channel, 17132a519311SJohannes Berg struct ieee80211_mgmt *mgmt, size_t len, 171477965c97SJohannes Berg s32 signal, gfp_t gfp); 17152a519311SJohannes Berg 171606aa7afaSJussi Kivilinna struct cfg80211_bss* 171706aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy, 171806aa7afaSJussi Kivilinna struct ieee80211_channel *channel, 171906aa7afaSJussi Kivilinna const u8 *bssid, 172006aa7afaSJussi Kivilinna u64 timestamp, u16 capability, u16 beacon_interval, 172106aa7afaSJussi Kivilinna const u8 *ie, size_t ielen, 172206aa7afaSJussi Kivilinna s32 signal, gfp_t gfp); 172306aa7afaSJussi Kivilinna 17242a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 17252a519311SJohannes Berg struct ieee80211_channel *channel, 17262a519311SJohannes Berg const u8 *bssid, 172779420f09SJohannes Berg const u8 *ssid, size_t ssid_len, 172879420f09SJohannes Berg u16 capa_mask, u16 capa_val); 172979420f09SJohannes Berg static inline struct cfg80211_bss * 173079420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy, 173179420f09SJohannes Berg struct ieee80211_channel *channel, 173279420f09SJohannes Berg const u8 *ssid, size_t ssid_len) 173379420f09SJohannes Berg { 173479420f09SJohannes Berg return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len, 173579420f09SJohannes Berg WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS); 173679420f09SJohannes Berg } 173779420f09SJohannes Berg 17382a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy, 17392a519311SJohannes Berg struct ieee80211_channel *channel, 17402a519311SJohannes Berg const u8 *meshid, size_t meshidlen, 17412a519311SJohannes Berg const u8 *meshcfg); 17422a519311SJohannes Berg void cfg80211_put_bss(struct cfg80211_bss *bss); 1743d3236553SJohannes Berg 1744d491af19SJohannes Berg /** 1745d491af19SJohannes Berg * cfg80211_unlink_bss - unlink BSS from internal data structures 1746d491af19SJohannes Berg * @wiphy: the wiphy 1747d491af19SJohannes Berg * @bss: the bss to remove 1748d491af19SJohannes Berg * 1749d491af19SJohannes Berg * This function removes the given BSS from the internal data structures 1750d491af19SJohannes Berg * thereby making it no longer show up in scan results etc. Use this 1751d491af19SJohannes Berg * function when you detect a BSS is gone. Normally BSSes will also time 1752d491af19SJohannes Berg * out, so it is not necessary to use this function at all. 1753d491af19SJohannes Berg */ 1754d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 1755fee52678SJohannes Berg 17566039f6d2SJouni Malinen /** 17576039f6d2SJouni Malinen * cfg80211_send_rx_auth - notification of processed authentication 17586039f6d2SJouni Malinen * @dev: network device 17596039f6d2SJouni Malinen * @buf: authentication frame (header + body) 17606039f6d2SJouni Malinen * @len: length of the frame data 17616039f6d2SJouni Malinen * 17626039f6d2SJouni Malinen * This function is called whenever an authentication has been processed in 17631965c853SJouni Malinen * station mode. The driver is required to call either this function or 17641965c853SJouni Malinen * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth() 1765cb0b4bebSJohannes Berg * call. This function may sleep. 17666039f6d2SJouni Malinen */ 1767cb0b4bebSJohannes Berg void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); 17686039f6d2SJouni Malinen 17696039f6d2SJouni Malinen /** 17701965c853SJouni Malinen * cfg80211_send_auth_timeout - notification of timed out authentication 17711965c853SJouni Malinen * @dev: network device 17721965c853SJouni Malinen * @addr: The MAC address of the device with which the authentication timed out 1773cb0b4bebSJohannes Berg * 1774cb0b4bebSJohannes Berg * This function may sleep. 17751965c853SJouni Malinen */ 1776cb0b4bebSJohannes Berg void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); 17771965c853SJouni Malinen 17781965c853SJouni Malinen /** 17796039f6d2SJouni Malinen * cfg80211_send_rx_assoc - notification of processed association 17806039f6d2SJouni Malinen * @dev: network device 17816039f6d2SJouni Malinen * @buf: (re)association response frame (header + body) 17826039f6d2SJouni Malinen * @len: length of the frame data 17836039f6d2SJouni Malinen * 17846039f6d2SJouni Malinen * This function is called whenever a (re)association response has been 17851965c853SJouni Malinen * processed in station mode. The driver is required to call either this 17861965c853SJouni Malinen * function or cfg80211_send_assoc_timeout() to indicate the result of 1787cb0b4bebSJohannes Berg * cfg80211_ops::assoc() call. This function may sleep. 17886039f6d2SJouni Malinen */ 1789cb0b4bebSJohannes Berg void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len); 17906039f6d2SJouni Malinen 17916039f6d2SJouni Malinen /** 17921965c853SJouni Malinen * cfg80211_send_assoc_timeout - notification of timed out association 17931965c853SJouni Malinen * @dev: network device 17941965c853SJouni Malinen * @addr: The MAC address of the device with which the association timed out 1795cb0b4bebSJohannes Berg * 1796cb0b4bebSJohannes Berg * This function may sleep. 17971965c853SJouni Malinen */ 1798cb0b4bebSJohannes Berg void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr); 17991965c853SJouni Malinen 18001965c853SJouni Malinen /** 180153b46b84SJouni Malinen * cfg80211_send_deauth - notification of processed deauthentication 18026039f6d2SJouni Malinen * @dev: network device 18036039f6d2SJouni Malinen * @buf: deauthentication frame (header + body) 18046039f6d2SJouni Malinen * @len: length of the frame data 1805667503ddSJohannes Berg * @cookie: cookie from ->deauth if called within that callback, 1806667503ddSJohannes Berg * %NULL otherwise 18076039f6d2SJouni Malinen * 18086039f6d2SJouni Malinen * This function is called whenever deauthentication has been processed in 180953b46b84SJouni Malinen * station mode. This includes both received deauthentication frames and 1810cb0b4bebSJohannes Berg * locally generated ones. This function may sleep. 18116039f6d2SJouni Malinen */ 1812667503ddSJohannes Berg void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len, 1813667503ddSJohannes Berg void *cookie); 18146039f6d2SJouni Malinen 18156039f6d2SJouni Malinen /** 181653b46b84SJouni Malinen * cfg80211_send_disassoc - notification of processed disassociation 18176039f6d2SJouni Malinen * @dev: network device 18186039f6d2SJouni Malinen * @buf: disassociation response frame (header + body) 18196039f6d2SJouni Malinen * @len: length of the frame data 1820667503ddSJohannes Berg * @cookie: cookie from ->disassoc if called within that callback, 1821667503ddSJohannes Berg * %NULL otherwise 18226039f6d2SJouni Malinen * 18236039f6d2SJouni Malinen * This function is called whenever disassociation has been processed in 182453b46b84SJouni Malinen * station mode. This includes both received disassociation frames and locally 1825cb0b4bebSJohannes Berg * generated ones. This function may sleep. 18266039f6d2SJouni Malinen */ 1827667503ddSJohannes Berg void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len, 1828667503ddSJohannes Berg void *cookie); 18296039f6d2SJouni Malinen 1830a08c1c1aSKalle Valo /** 1831a3b8b056SJouni Malinen * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 1832a3b8b056SJouni Malinen * @dev: network device 1833a3b8b056SJouni Malinen * @addr: The source MAC address of the frame 1834a3b8b056SJouni Malinen * @key_type: The key type that the received frame used 1835a3b8b056SJouni Malinen * @key_id: Key identifier (0..3) 1836a3b8b056SJouni Malinen * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) 1837e6d6e342SJohannes Berg * @gfp: allocation flags 1838a3b8b056SJouni Malinen * 1839a3b8b056SJouni Malinen * This function is called whenever the local MAC detects a MIC failure in a 1840a3b8b056SJouni Malinen * received frame. This matches with MLME-MICHAELMICFAILURE.indication() 1841a3b8b056SJouni Malinen * primitive. 1842a3b8b056SJouni Malinen */ 1843a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, 1844a3b8b056SJouni Malinen enum nl80211_key_type key_type, int key_id, 1845e6d6e342SJohannes Berg const u8 *tsc, gfp_t gfp); 1846a3b8b056SJouni Malinen 184704a773adSJohannes Berg /** 184804a773adSJohannes Berg * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS 184904a773adSJohannes Berg * 185004a773adSJohannes Berg * @dev: network device 185104a773adSJohannes Berg * @bssid: the BSSID of the IBSS joined 185204a773adSJohannes Berg * @gfp: allocation flags 185304a773adSJohannes Berg * 185404a773adSJohannes Berg * This function notifies cfg80211 that the device joined an IBSS or 185504a773adSJohannes Berg * switched to a different BSSID. Before this function can be called, 185604a773adSJohannes Berg * either a beacon has to have been received from the IBSS, or one of 185704a773adSJohannes Berg * the cfg80211_inform_bss{,_frame} functions must have been called 185804a773adSJohannes Berg * with the locally generated beacon -- this guarantees that there is 185904a773adSJohannes Berg * always a scan result for this IBSS. cfg80211 will handle the rest. 186004a773adSJohannes Berg */ 186104a773adSJohannes Berg void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp); 186204a773adSJohannes Berg 18631f87f7d3SJohannes Berg /** 18641f87f7d3SJohannes Berg * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state 18651f87f7d3SJohannes Berg * @wiphy: the wiphy 18661f87f7d3SJohannes Berg * @blocked: block status 18671f87f7d3SJohannes Berg */ 18681f87f7d3SJohannes Berg void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked); 18691f87f7d3SJohannes Berg 18701f87f7d3SJohannes Berg /** 18711f87f7d3SJohannes Berg * wiphy_rfkill_start_polling - start polling rfkill 18721f87f7d3SJohannes Berg * @wiphy: the wiphy 18731f87f7d3SJohannes Berg */ 18741f87f7d3SJohannes Berg void wiphy_rfkill_start_polling(struct wiphy *wiphy); 18751f87f7d3SJohannes Berg 18761f87f7d3SJohannes Berg /** 18771f87f7d3SJohannes Berg * wiphy_rfkill_stop_polling - stop polling rfkill 18781f87f7d3SJohannes Berg * @wiphy: the wiphy 18791f87f7d3SJohannes Berg */ 18801f87f7d3SJohannes Berg void wiphy_rfkill_stop_polling(struct wiphy *wiphy); 18811f87f7d3SJohannes Berg 1882aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE 1883aff89a9bSJohannes Berg /** 1884aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb - allocate testmode reply 1885aff89a9bSJohannes Berg * @wiphy: the wiphy 1886aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 1887aff89a9bSJohannes Berg * be put into the skb 1888aff89a9bSJohannes Berg * 1889aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for a reply to 1890aff89a9bSJohannes Berg * the testmode command. Since it is intended for a reply, calling 1891aff89a9bSJohannes Berg * it outside of the @testmode_cmd operation is invalid. 1892aff89a9bSJohannes Berg * 1893aff89a9bSJohannes Berg * The returned skb (or %NULL if any errors happen) is pre-filled 1894aff89a9bSJohannes Berg * with the wiphy index and set up in a way that any data that is 1895aff89a9bSJohannes Berg * put into the skb (with skb_put(), nla_put() or similar) will end 1896aff89a9bSJohannes Berg * up being within the %NL80211_ATTR_TESTDATA attribute, so all that 1897aff89a9bSJohannes Berg * needs to be done with the skb is adding data for the corresponding 1898aff89a9bSJohannes Berg * userspace tool which can then read that data out of the testdata 1899aff89a9bSJohannes Berg * attribute. You must not modify the skb in any other way. 1900aff89a9bSJohannes Berg * 1901aff89a9bSJohannes Berg * When done, call cfg80211_testmode_reply() with the skb and return 1902aff89a9bSJohannes Berg * its error code as the result of the @testmode_cmd operation. 1903aff89a9bSJohannes Berg */ 1904aff89a9bSJohannes Berg struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, 1905aff89a9bSJohannes Berg int approxlen); 1906aff89a9bSJohannes Berg 1907aff89a9bSJohannes Berg /** 1908aff89a9bSJohannes Berg * cfg80211_testmode_reply - send the reply skb 1909aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 1910aff89a9bSJohannes Berg * cfg80211_testmode_alloc_reply_skb() 1911aff89a9bSJohannes Berg * 1912aff89a9bSJohannes Berg * Returns an error code or 0 on success, since calling this 1913aff89a9bSJohannes Berg * function will usually be the last thing before returning 1914aff89a9bSJohannes Berg * from the @testmode_cmd you should return the error code. 1915aff89a9bSJohannes Berg * Note that this function consumes the skb regardless of the 1916aff89a9bSJohannes Berg * return value. 1917aff89a9bSJohannes Berg */ 1918aff89a9bSJohannes Berg int cfg80211_testmode_reply(struct sk_buff *skb); 1919aff89a9bSJohannes Berg 1920aff89a9bSJohannes Berg /** 1921aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb - allocate testmode event 1922aff89a9bSJohannes Berg * @wiphy: the wiphy 1923aff89a9bSJohannes Berg * @approxlen: an upper bound of the length of the data that will 1924aff89a9bSJohannes Berg * be put into the skb 1925aff89a9bSJohannes Berg * @gfp: allocation flags 1926aff89a9bSJohannes Berg * 1927aff89a9bSJohannes Berg * This function allocates and pre-fills an skb for an event on the 1928aff89a9bSJohannes Berg * testmode multicast group. 1929aff89a9bSJohannes Berg * 1930aff89a9bSJohannes Berg * The returned skb (or %NULL if any errors happen) is set up in the 1931aff89a9bSJohannes Berg * same way as with cfg80211_testmode_alloc_reply_skb() but prepared 1932aff89a9bSJohannes Berg * for an event. As there, you should simply add data to it that will 1933aff89a9bSJohannes Berg * then end up in the %NL80211_ATTR_TESTDATA attribute. Again, you must 1934aff89a9bSJohannes Berg * not modify the skb in any other way. 1935aff89a9bSJohannes Berg * 1936aff89a9bSJohannes Berg * When done filling the skb, call cfg80211_testmode_event() with the 1937aff89a9bSJohannes Berg * skb to send the event. 1938aff89a9bSJohannes Berg */ 1939aff89a9bSJohannes Berg struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, 1940aff89a9bSJohannes Berg int approxlen, gfp_t gfp); 1941aff89a9bSJohannes Berg 1942aff89a9bSJohannes Berg /** 1943aff89a9bSJohannes Berg * cfg80211_testmode_event - send the event 1944aff89a9bSJohannes Berg * @skb: The skb, must have been allocated with 1945aff89a9bSJohannes Berg * cfg80211_testmode_alloc_event_skb() 1946aff89a9bSJohannes Berg * @gfp: allocation flags 1947aff89a9bSJohannes Berg * 1948aff89a9bSJohannes Berg * This function sends the given @skb, which must have been allocated 1949aff89a9bSJohannes Berg * by cfg80211_testmode_alloc_event_skb(), as an event. It always 1950aff89a9bSJohannes Berg * consumes it. 1951aff89a9bSJohannes Berg */ 1952aff89a9bSJohannes Berg void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp); 1953aff89a9bSJohannes Berg 1954aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd), 1955aff89a9bSJohannes Berg #else 1956aff89a9bSJohannes Berg #define CFG80211_TESTMODE_CMD(cmd) 1957aff89a9bSJohannes Berg #endif 1958aff89a9bSJohannes Berg 1959b23aa676SSamuel Ortiz /** 1960b23aa676SSamuel Ortiz * cfg80211_connect_result - notify cfg80211 of connection result 1961b23aa676SSamuel Ortiz * 1962b23aa676SSamuel Ortiz * @dev: network device 1963b23aa676SSamuel Ortiz * @bssid: the BSSID of the AP 1964b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 1965b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 1966b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 1967b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 1968b23aa676SSamuel Ortiz * @status: status code, 0 for successful connection, use 1969b23aa676SSamuel Ortiz * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 1970b23aa676SSamuel Ortiz * the real status code for failures. 1971b23aa676SSamuel Ortiz * @gfp: allocation flags 1972b23aa676SSamuel Ortiz * 1973b23aa676SSamuel Ortiz * It should be called by the underlying driver whenever connect() has 1974b23aa676SSamuel Ortiz * succeeded. 1975b23aa676SSamuel Ortiz */ 1976b23aa676SSamuel Ortiz void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, 1977b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 1978b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, 1979b23aa676SSamuel Ortiz u16 status, gfp_t gfp); 1980b23aa676SSamuel Ortiz 1981b23aa676SSamuel Ortiz /** 1982b23aa676SSamuel Ortiz * cfg80211_roamed - notify cfg80211 of roaming 1983b23aa676SSamuel Ortiz * 1984b23aa676SSamuel Ortiz * @dev: network device 1985b23aa676SSamuel Ortiz * @bssid: the BSSID of the new AP 1986b23aa676SSamuel Ortiz * @req_ie: association request IEs (maybe be %NULL) 1987b23aa676SSamuel Ortiz * @req_ie_len: association request IEs length 1988b23aa676SSamuel Ortiz * @resp_ie: association response IEs (may be %NULL) 1989b23aa676SSamuel Ortiz * @resp_ie_len: assoc response IEs length 1990b23aa676SSamuel Ortiz * @gfp: allocation flags 1991b23aa676SSamuel Ortiz * 1992b23aa676SSamuel Ortiz * It should be called by the underlying driver whenever it roamed 1993b23aa676SSamuel Ortiz * from one AP to another while connected. 1994b23aa676SSamuel Ortiz */ 1995b23aa676SSamuel Ortiz void cfg80211_roamed(struct net_device *dev, const u8 *bssid, 1996b23aa676SSamuel Ortiz const u8 *req_ie, size_t req_ie_len, 1997b23aa676SSamuel Ortiz const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 1998b23aa676SSamuel Ortiz 1999b23aa676SSamuel Ortiz /** 2000b23aa676SSamuel Ortiz * cfg80211_disconnected - notify cfg80211 that connection was dropped 2001b23aa676SSamuel Ortiz * 2002b23aa676SSamuel Ortiz * @dev: network device 2003b23aa676SSamuel Ortiz * @ie: information elements of the deauth/disassoc frame (may be %NULL) 2004b23aa676SSamuel Ortiz * @ie_len: length of IEs 2005b23aa676SSamuel Ortiz * @reason: reason code for the disconnection, set it to 0 if unknown 2006b23aa676SSamuel Ortiz * @gfp: allocation flags 2007b23aa676SSamuel Ortiz * 2008b23aa676SSamuel Ortiz * After it calls this function, the driver should enter an idle state 2009b23aa676SSamuel Ortiz * and not try to connect to any AP any more. 2010b23aa676SSamuel Ortiz */ 2011b23aa676SSamuel Ortiz void cfg80211_disconnected(struct net_device *dev, u16 reason, 2012b23aa676SSamuel Ortiz u8 *ie, size_t ie_len, gfp_t gfp); 2013b23aa676SSamuel Ortiz 2014b23aa676SSamuel Ortiz 2015704232c2SJohannes Berg #endif /* __NET_CFG80211_H */ 2016