1704232c2SJohannes Berg #ifndef __NET_CFG80211_H 2704232c2SJohannes Berg #define __NET_CFG80211_H 3704232c2SJohannes Berg 4704232c2SJohannes Berg #include <linux/netlink.h> 5704232c2SJohannes Berg #include <linux/skbuff.h> 655682965SJohannes Berg #include <linux/nl80211.h> 7704232c2SJohannes Berg #include <net/genetlink.h> 8fee52678SJohannes Berg /* remove once we remove the wext stuff */ 9fee52678SJohannes Berg #include <net/iw_handler.h> 10704232c2SJohannes Berg 11704232c2SJohannes Berg /* 12704232c2SJohannes Berg * 802.11 configuration in-kernel interface 13704232c2SJohannes Berg * 1455682965SJohannes Berg * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net> 15704232c2SJohannes Berg */ 16704232c2SJohannes Berg 172ec600d6SLuis Carlos Cobo /** 182ec600d6SLuis Carlos Cobo * struct vif_params - describes virtual interface parameters 192ec600d6SLuis Carlos Cobo * @mesh_id: mesh ID to use 202ec600d6SLuis Carlos Cobo * @mesh_id_len: length of the mesh ID 212ec600d6SLuis Carlos Cobo */ 222ec600d6SLuis Carlos Cobo struct vif_params { 232ec600d6SLuis Carlos Cobo u8 *mesh_id; 242ec600d6SLuis Carlos Cobo int mesh_id_len; 252ec600d6SLuis Carlos Cobo }; 262ec600d6SLuis Carlos Cobo 27179f831bSAndy Green /* Radiotap header iteration 28179f831bSAndy Green * implemented in net/wireless/radiotap.c 29179f831bSAndy Green * docs in Documentation/networking/radiotap-headers.txt 30179f831bSAndy Green */ 31179f831bSAndy Green /** 32179f831bSAndy Green * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 33179f831bSAndy Green * @rtheader: pointer to the radiotap header we are walking through 34179f831bSAndy Green * @max_length: length of radiotap header in cpu byte ordering 35179f831bSAndy Green * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg 36179f831bSAndy Green * @this_arg: pointer to current radiotap arg 37179f831bSAndy Green * @arg_index: internal next argument index 38179f831bSAndy Green * @arg: internal next argument pointer 39179f831bSAndy Green * @next_bitmap: internal pointer to next present u32 40179f831bSAndy Green * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 41179f831bSAndy Green */ 42179f831bSAndy Green 43179f831bSAndy Green struct ieee80211_radiotap_iterator { 44179f831bSAndy Green struct ieee80211_radiotap_header *rtheader; 45179f831bSAndy Green int max_length; 46179f831bSAndy Green int this_arg_index; 47179f831bSAndy Green u8 *this_arg; 48179f831bSAndy Green 49179f831bSAndy Green int arg_index; 50179f831bSAndy Green u8 *arg; 51179f831bSAndy Green __le32 *next_bitmap; 52179f831bSAndy Green u32 bitmap_shifter; 53179f831bSAndy Green }; 54179f831bSAndy Green 55179f831bSAndy Green extern int ieee80211_radiotap_iterator_init( 56179f831bSAndy Green struct ieee80211_radiotap_iterator *iterator, 57179f831bSAndy Green struct ieee80211_radiotap_header *radiotap_header, 58179f831bSAndy Green int max_length); 59179f831bSAndy Green 60179f831bSAndy Green extern int ieee80211_radiotap_iterator_next( 61179f831bSAndy Green struct ieee80211_radiotap_iterator *iterator); 62179f831bSAndy Green 63179f831bSAndy Green 6441ade00fSJohannes Berg /** 6541ade00fSJohannes Berg * struct key_params - key information 6641ade00fSJohannes Berg * 6741ade00fSJohannes Berg * Information about a key 6841ade00fSJohannes Berg * 6941ade00fSJohannes Berg * @key: key material 7041ade00fSJohannes Berg * @key_len: length of key material 7141ade00fSJohannes Berg * @cipher: cipher suite selector 7241ade00fSJohannes Berg * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used 7341ade00fSJohannes Berg * with the get_key() callback, must be in little endian, 7441ade00fSJohannes Berg * length given by @seq_len. 7541ade00fSJohannes Berg */ 7641ade00fSJohannes Berg struct key_params { 7741ade00fSJohannes Berg u8 *key; 7841ade00fSJohannes Berg u8 *seq; 7941ade00fSJohannes Berg int key_len; 8041ade00fSJohannes Berg int seq_len; 8141ade00fSJohannes Berg u32 cipher; 8241ade00fSJohannes Berg }; 8341ade00fSJohannes Berg 84ed1b6cc7SJohannes Berg /** 85ed1b6cc7SJohannes Berg * struct beacon_parameters - beacon parameters 86ed1b6cc7SJohannes Berg * 87ed1b6cc7SJohannes Berg * Used to configure the beacon for an interface. 88ed1b6cc7SJohannes Berg * 89ed1b6cc7SJohannes Berg * @head: head portion of beacon (before TIM IE) 90ed1b6cc7SJohannes Berg * or %NULL if not changed 91ed1b6cc7SJohannes Berg * @tail: tail portion of beacon (after TIM IE) 92ed1b6cc7SJohannes Berg * or %NULL if not changed 93ed1b6cc7SJohannes Berg * @interval: beacon interval or zero if not changed 94ed1b6cc7SJohannes Berg * @dtim_period: DTIM period or zero if not changed 95ed1b6cc7SJohannes Berg * @head_len: length of @head 96ed1b6cc7SJohannes Berg * @tail_len: length of @tail 97ed1b6cc7SJohannes Berg */ 98ed1b6cc7SJohannes Berg struct beacon_parameters { 99ed1b6cc7SJohannes Berg u8 *head, *tail; 100ed1b6cc7SJohannes Berg int interval, dtim_period; 101ed1b6cc7SJohannes Berg int head_len, tail_len; 102ed1b6cc7SJohannes Berg }; 103ed1b6cc7SJohannes Berg 1045727ef1bSJohannes Berg /** 1055727ef1bSJohannes Berg * enum station_flags - station flags 1065727ef1bSJohannes Berg * 1075727ef1bSJohannes Berg * Station capability flags. Note that these must be the bits 1085727ef1bSJohannes Berg * according to the nl80211 flags. 1095727ef1bSJohannes Berg * 1105727ef1bSJohannes Berg * @STATION_FLAG_CHANGED: station flags were changed 1115727ef1bSJohannes Berg * @STATION_FLAG_AUTHORIZED: station is authorized to send frames (802.1X) 1125727ef1bSJohannes Berg * @STATION_FLAG_SHORT_PREAMBLE: station is capable of receiving frames 1135727ef1bSJohannes Berg * with short preambles 1145727ef1bSJohannes Berg * @STATION_FLAG_WME: station is WME/QoS capable 1155727ef1bSJohannes Berg */ 1165727ef1bSJohannes Berg enum station_flags { 1175727ef1bSJohannes Berg STATION_FLAG_CHANGED = 1<<0, 1185727ef1bSJohannes Berg STATION_FLAG_AUTHORIZED = 1<<NL80211_STA_FLAG_AUTHORIZED, 1195727ef1bSJohannes Berg STATION_FLAG_SHORT_PREAMBLE = 1<<NL80211_STA_FLAG_SHORT_PREAMBLE, 1205727ef1bSJohannes Berg STATION_FLAG_WME = 1<<NL80211_STA_FLAG_WME, 1215727ef1bSJohannes Berg }; 1225727ef1bSJohannes Berg 1235727ef1bSJohannes Berg /** 1242ec600d6SLuis Carlos Cobo * enum plink_action - actions to perform in mesh peers 1252ec600d6SLuis Carlos Cobo * 1262ec600d6SLuis Carlos Cobo * @PLINK_ACTION_INVALID: action 0 is reserved 1272ec600d6SLuis Carlos Cobo * @PLINK_ACTION_OPEN: start mesh peer link establishment 1282ec600d6SLuis Carlos Cobo * @PLINK_ACTION_BLOCL: block traffic from this mesh peer 1292ec600d6SLuis Carlos Cobo */ 1302ec600d6SLuis Carlos Cobo enum plink_actions { 1312ec600d6SLuis Carlos Cobo PLINK_ACTION_INVALID, 1322ec600d6SLuis Carlos Cobo PLINK_ACTION_OPEN, 1332ec600d6SLuis Carlos Cobo PLINK_ACTION_BLOCK, 1342ec600d6SLuis Carlos Cobo }; 1352ec600d6SLuis Carlos Cobo 1362ec600d6SLuis Carlos Cobo /** 1375727ef1bSJohannes Berg * struct station_parameters - station parameters 1385727ef1bSJohannes Berg * 1395727ef1bSJohannes Berg * Used to change and create a new station. 1405727ef1bSJohannes Berg * 1415727ef1bSJohannes Berg * @vlan: vlan interface station should belong to 1425727ef1bSJohannes Berg * @supported_rates: supported rates in IEEE 802.11 format 1435727ef1bSJohannes Berg * (or NULL for no change) 1445727ef1bSJohannes Berg * @supported_rates_len: number of supported rates 1455727ef1bSJohannes Berg * @station_flags: station flags (see &enum station_flags) 1465727ef1bSJohannes Berg * @listen_interval: listen interval or -1 for no change 1475727ef1bSJohannes Berg * @aid: AID or zero for no change 1485727ef1bSJohannes Berg */ 1495727ef1bSJohannes Berg struct station_parameters { 1505727ef1bSJohannes Berg u8 *supported_rates; 1515727ef1bSJohannes Berg struct net_device *vlan; 1525727ef1bSJohannes Berg u32 station_flags; 1535727ef1bSJohannes Berg int listen_interval; 1545727ef1bSJohannes Berg u16 aid; 1555727ef1bSJohannes Berg u8 supported_rates_len; 1562ec600d6SLuis Carlos Cobo u8 plink_action; 15736aedc90SJouni Malinen struct ieee80211_ht_cap *ht_capa; 1585727ef1bSJohannes Berg }; 1595727ef1bSJohannes Berg 160fd5b74dcSJohannes Berg /** 1612ec600d6SLuis Carlos Cobo * enum station_info_flags - station information flags 162fd5b74dcSJohannes Berg * 1632ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct station_info 1642ec600d6SLuis Carlos Cobo * it has filled in during get_station() or dump_station(). 165fd5b74dcSJohannes Berg * 1662ec600d6SLuis Carlos Cobo * @STATION_INFO_INACTIVE_TIME: @inactive_time filled 1672ec600d6SLuis Carlos Cobo * @STATION_INFO_RX_BYTES: @rx_bytes filled 1682ec600d6SLuis Carlos Cobo * @STATION_INFO_TX_BYTES: @tx_bytes filled 1692ec600d6SLuis Carlos Cobo * @STATION_INFO_LLID: @llid filled 1702ec600d6SLuis Carlos Cobo * @STATION_INFO_PLID: @plid filled 1712ec600d6SLuis Carlos Cobo * @STATION_INFO_PLINK_STATE: @plink_state filled 172fd5b74dcSJohannes Berg */ 1732ec600d6SLuis Carlos Cobo enum station_info_flags { 1742ec600d6SLuis Carlos Cobo STATION_INFO_INACTIVE_TIME = 1<<0, 1752ec600d6SLuis Carlos Cobo STATION_INFO_RX_BYTES = 1<<1, 1762ec600d6SLuis Carlos Cobo STATION_INFO_TX_BYTES = 1<<2, 1772ec600d6SLuis Carlos Cobo STATION_INFO_LLID = 1<<3, 1782ec600d6SLuis Carlos Cobo STATION_INFO_PLID = 1<<4, 1792ec600d6SLuis Carlos Cobo STATION_INFO_PLINK_STATE = 1<<5, 180fd5b74dcSJohannes Berg }; 181fd5b74dcSJohannes Berg 182fd5b74dcSJohannes Berg /** 1832ec600d6SLuis Carlos Cobo * struct station_info - station information 184fd5b74dcSJohannes Berg * 1852ec600d6SLuis Carlos Cobo * Station information filled by driver for get_station() and dump_station. 186fd5b74dcSJohannes Berg * 1872ec600d6SLuis Carlos Cobo * @filled: bitflag of flags from &enum station_info_flags 188fd5b74dcSJohannes Berg * @inactive_time: time since last station activity (tx/rx) in milliseconds 189fd5b74dcSJohannes Berg * @rx_bytes: bytes received from this station 190fd5b74dcSJohannes Berg * @tx_bytes: bytes transmitted to this station 1912ec600d6SLuis Carlos Cobo * @llid: mesh local link id 1922ec600d6SLuis Carlos Cobo * @plid: mesh peer link id 1932ec600d6SLuis Carlos Cobo * @plink_state: mesh peer link state 194fd5b74dcSJohannes Berg */ 1952ec600d6SLuis Carlos Cobo struct station_info { 196fd5b74dcSJohannes Berg u32 filled; 197fd5b74dcSJohannes Berg u32 inactive_time; 198fd5b74dcSJohannes Berg u32 rx_bytes; 199fd5b74dcSJohannes Berg u32 tx_bytes; 2002ec600d6SLuis Carlos Cobo u16 llid; 2012ec600d6SLuis Carlos Cobo u16 plid; 2022ec600d6SLuis Carlos Cobo u8 plink_state; 203fd5b74dcSJohannes Berg }; 204fd5b74dcSJohannes Berg 20566f7ac50SMichael Wu /** 20666f7ac50SMichael Wu * enum monitor_flags - monitor flags 20766f7ac50SMichael Wu * 20866f7ac50SMichael Wu * Monitor interface configuration flags. Note that these must be the bits 20966f7ac50SMichael Wu * according to the nl80211 flags. 21066f7ac50SMichael Wu * 21166f7ac50SMichael Wu * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS 21266f7ac50SMichael Wu * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP 21366f7ac50SMichael Wu * @MONITOR_FLAG_CONTROL: pass control frames 21466f7ac50SMichael Wu * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering 21566f7ac50SMichael Wu * @MONITOR_FLAG_COOK_FRAMES: report frames after processing 21666f7ac50SMichael Wu */ 21766f7ac50SMichael Wu enum monitor_flags { 21866f7ac50SMichael Wu MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL, 21966f7ac50SMichael Wu MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL, 22066f7ac50SMichael Wu MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL, 22166f7ac50SMichael Wu MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS, 22266f7ac50SMichael Wu MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES, 22366f7ac50SMichael Wu }; 22466f7ac50SMichael Wu 2252ec600d6SLuis Carlos Cobo /** 2262ec600d6SLuis Carlos Cobo * enum mpath_info_flags - mesh path information flags 2272ec600d6SLuis Carlos Cobo * 2282ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct mpath_info it has filled 2292ec600d6SLuis Carlos Cobo * in during get_station() or dump_station(). 2302ec600d6SLuis Carlos Cobo * 2312ec600d6SLuis Carlos Cobo * MPATH_INFO_FRAME_QLEN: @frame_qlen filled 2322ec600d6SLuis Carlos Cobo * MPATH_INFO_DSN: @dsn filled 2332ec600d6SLuis Carlos Cobo * MPATH_INFO_METRIC: @metric filled 2342ec600d6SLuis Carlos Cobo * MPATH_INFO_EXPTIME: @exptime filled 2352ec600d6SLuis Carlos Cobo * MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 2362ec600d6SLuis Carlos Cobo * MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled 2372ec600d6SLuis Carlos Cobo * MPATH_INFO_FLAGS: @flags filled 2382ec600d6SLuis Carlos Cobo */ 2392ec600d6SLuis Carlos Cobo enum mpath_info_flags { 2402ec600d6SLuis Carlos Cobo MPATH_INFO_FRAME_QLEN = BIT(0), 2412ec600d6SLuis Carlos Cobo MPATH_INFO_DSN = BIT(1), 2422ec600d6SLuis Carlos Cobo MPATH_INFO_METRIC = BIT(2), 2432ec600d6SLuis Carlos Cobo MPATH_INFO_EXPTIME = BIT(3), 2442ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), 2452ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_RETRIES = BIT(5), 2462ec600d6SLuis Carlos Cobo MPATH_INFO_FLAGS = BIT(6), 2472ec600d6SLuis Carlos Cobo }; 2482ec600d6SLuis Carlos Cobo 2492ec600d6SLuis Carlos Cobo /** 2502ec600d6SLuis Carlos Cobo * struct mpath_info - mesh path information 2512ec600d6SLuis Carlos Cobo * 2522ec600d6SLuis Carlos Cobo * Mesh path information filled by driver for get_mpath() and dump_mpath(). 2532ec600d6SLuis Carlos Cobo * 2542ec600d6SLuis Carlos Cobo * @filled: bitfield of flags from &enum mpath_info_flags 2552ec600d6SLuis Carlos Cobo * @frame_qlen: number of queued frames for this destination 2562ec600d6SLuis Carlos Cobo * @dsn: destination sequence number 2572ec600d6SLuis Carlos Cobo * @metric: metric (cost) of this mesh path 2582ec600d6SLuis Carlos Cobo * @exptime: expiration time for the mesh path from now, in msecs 2592ec600d6SLuis Carlos Cobo * @flags: mesh path flags 2602ec600d6SLuis Carlos Cobo * @discovery_timeout: total mesh path discovery timeout, in msecs 2612ec600d6SLuis Carlos Cobo * @discovery_retries: mesh path discovery retries 2622ec600d6SLuis Carlos Cobo */ 2632ec600d6SLuis Carlos Cobo struct mpath_info { 2642ec600d6SLuis Carlos Cobo u32 filled; 2652ec600d6SLuis Carlos Cobo u32 frame_qlen; 2662ec600d6SLuis Carlos Cobo u32 dsn; 2672ec600d6SLuis Carlos Cobo u32 metric; 2682ec600d6SLuis Carlos Cobo u32 exptime; 2692ec600d6SLuis Carlos Cobo u32 discovery_timeout; 2702ec600d6SLuis Carlos Cobo u8 discovery_retries; 2712ec600d6SLuis Carlos Cobo u8 flags; 2722ec600d6SLuis Carlos Cobo }; 2732ec600d6SLuis Carlos Cobo 2749f1ba906SJouni Malinen /** 2759f1ba906SJouni Malinen * struct bss_parameters - BSS parameters 2769f1ba906SJouni Malinen * 2779f1ba906SJouni Malinen * Used to change BSS parameters (mainly for AP mode). 2789f1ba906SJouni Malinen * 2799f1ba906SJouni Malinen * @use_cts_prot: Whether to use CTS protection 2809f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 2819f1ba906SJouni Malinen * @use_short_preamble: Whether the use of short preambles is allowed 2829f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 2839f1ba906SJouni Malinen * @use_short_slot_time: Whether the use of short slot time is allowed 2849f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 28590c97a04SJouni Malinen * @basic_rates: basic rates in IEEE 802.11 format 28690c97a04SJouni Malinen * (or NULL for no change) 28790c97a04SJouni Malinen * @basic_rates_len: number of basic rates 2889f1ba906SJouni Malinen */ 2899f1ba906SJouni Malinen struct bss_parameters { 2909f1ba906SJouni Malinen int use_cts_prot; 2919f1ba906SJouni Malinen int use_short_preamble; 2929f1ba906SJouni Malinen int use_short_slot_time; 29390c97a04SJouni Malinen u8 *basic_rates; 29490c97a04SJouni Malinen u8 basic_rates_len; 2959f1ba906SJouni Malinen }; 2962ec600d6SLuis Carlos Cobo 297b2e1b302SLuis R. Rodriguez /** 298b2e1b302SLuis R. Rodriguez * enum reg_set_by - Indicates who is trying to set the regulatory domain 299b2e1b302SLuis R. Rodriguez * @REGDOM_SET_BY_INIT: regulatory domain was set by initialization. We will be 300b2e1b302SLuis R. Rodriguez * using a static world regulatory domain by default. 301b2e1b302SLuis R. Rodriguez * @REGDOM_SET_BY_CORE: Core queried CRDA for a dynamic world regulatory domain. 302b2e1b302SLuis R. Rodriguez * @REGDOM_SET_BY_USER: User asked the wireless core to set the 303b2e1b302SLuis R. Rodriguez * regulatory domain. 304b2e1b302SLuis R. Rodriguez * @REGDOM_SET_BY_DRIVER: a wireless drivers has hinted to the wireless core 305b2e1b302SLuis R. Rodriguez * it thinks its knows the regulatory domain we should be in. 306b2e1b302SLuis R. Rodriguez * @REGDOM_SET_BY_COUNTRY_IE: the wireless core has received an 802.11 country 307b2e1b302SLuis R. Rodriguez * information element with regulatory information it thinks we 308b2e1b302SLuis R. Rodriguez * should consider. 309b2e1b302SLuis R. Rodriguez */ 310b2e1b302SLuis R. Rodriguez enum reg_set_by { 311b2e1b302SLuis R. Rodriguez REGDOM_SET_BY_INIT, 312b2e1b302SLuis R. Rodriguez REGDOM_SET_BY_CORE, 313b2e1b302SLuis R. Rodriguez REGDOM_SET_BY_USER, 314b2e1b302SLuis R. Rodriguez REGDOM_SET_BY_DRIVER, 315b2e1b302SLuis R. Rodriguez REGDOM_SET_BY_COUNTRY_IE, 316b2e1b302SLuis R. Rodriguez }; 317b2e1b302SLuis R. Rodriguez 318b2e1b302SLuis R. Rodriguez struct ieee80211_freq_range { 319b2e1b302SLuis R. Rodriguez u32 start_freq_khz; 320b2e1b302SLuis R. Rodriguez u32 end_freq_khz; 321b2e1b302SLuis R. Rodriguez u32 max_bandwidth_khz; 322b2e1b302SLuis R. Rodriguez }; 323b2e1b302SLuis R. Rodriguez 324b2e1b302SLuis R. Rodriguez struct ieee80211_power_rule { 325b2e1b302SLuis R. Rodriguez u32 max_antenna_gain; 326b2e1b302SLuis R. Rodriguez u32 max_eirp; 327b2e1b302SLuis R. Rodriguez }; 328b2e1b302SLuis R. Rodriguez 329b2e1b302SLuis R. Rodriguez struct ieee80211_reg_rule { 330b2e1b302SLuis R. Rodriguez struct ieee80211_freq_range freq_range; 331b2e1b302SLuis R. Rodriguez struct ieee80211_power_rule power_rule; 332b2e1b302SLuis R. Rodriguez u32 flags; 333b2e1b302SLuis R. Rodriguez }; 334b2e1b302SLuis R. Rodriguez 335b2e1b302SLuis R. Rodriguez struct ieee80211_regdomain { 336b2e1b302SLuis R. Rodriguez u32 n_reg_rules; 337b2e1b302SLuis R. Rodriguez char alpha2[2]; 338b2e1b302SLuis R. Rodriguez struct ieee80211_reg_rule reg_rules[]; 339b2e1b302SLuis R. Rodriguez }; 340b2e1b302SLuis R. Rodriguez 341b219cee1SLuis R. Rodriguez #define MHZ_TO_KHZ(freq) ((freq) * 1000) 342b219cee1SLuis R. Rodriguez #define KHZ_TO_MHZ(freq) ((freq) / 1000) 343b219cee1SLuis R. Rodriguez #define DBI_TO_MBI(gain) ((gain) * 100) 344b219cee1SLuis R. Rodriguez #define MBI_TO_DBI(gain) ((gain) / 100) 345b219cee1SLuis R. Rodriguez #define DBM_TO_MBM(gain) ((gain) * 100) 346b219cee1SLuis R. Rodriguez #define MBM_TO_DBM(gain) ((gain) / 100) 347b2e1b302SLuis R. Rodriguez 348b2e1b302SLuis R. Rodriguez #define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \ 349b219cee1SLuis R. Rodriguez .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \ 350b219cee1SLuis R. Rodriguez .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \ 351b219cee1SLuis R. Rodriguez .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \ 352b219cee1SLuis R. Rodriguez .power_rule.max_antenna_gain = DBI_TO_MBI(gain), \ 353b219cee1SLuis R. Rodriguez .power_rule.max_eirp = DBM_TO_MBM(eirp), \ 354b2e1b302SLuis R. Rodriguez .flags = reg_flags, \ 355b2e1b302SLuis R. Rodriguez } 356b2e1b302SLuis R. Rodriguez 35793da9cc1Scolin@cozybit.com struct mesh_config { 35893da9cc1Scolin@cozybit.com /* Timeouts in ms */ 35993da9cc1Scolin@cozybit.com /* Mesh plink management parameters */ 36093da9cc1Scolin@cozybit.com u16 dot11MeshRetryTimeout; 36193da9cc1Scolin@cozybit.com u16 dot11MeshConfirmTimeout; 36293da9cc1Scolin@cozybit.com u16 dot11MeshHoldingTimeout; 36393da9cc1Scolin@cozybit.com u16 dot11MeshMaxPeerLinks; 36493da9cc1Scolin@cozybit.com u8 dot11MeshMaxRetries; 36593da9cc1Scolin@cozybit.com u8 dot11MeshTTL; 36693da9cc1Scolin@cozybit.com bool auto_open_plinks; 36793da9cc1Scolin@cozybit.com /* HWMP parameters */ 36893da9cc1Scolin@cozybit.com u8 dot11MeshHWMPmaxPREQretries; 36993da9cc1Scolin@cozybit.com u32 path_refresh_time; 37093da9cc1Scolin@cozybit.com u16 min_discovery_timeout; 37193da9cc1Scolin@cozybit.com u32 dot11MeshHWMPactivePathTimeout; 37293da9cc1Scolin@cozybit.com u16 dot11MeshHWMPpreqMinInterval; 37393da9cc1Scolin@cozybit.com u16 dot11MeshHWMPnetDiameterTraversalTime; 37493da9cc1Scolin@cozybit.com }; 37593da9cc1Scolin@cozybit.com 37631888487SJouni Malinen /** 37731888487SJouni Malinen * struct ieee80211_txq_params - TX queue parameters 37831888487SJouni Malinen * @queue: TX queue identifier (NL80211_TXQ_Q_*) 37931888487SJouni Malinen * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled 38031888487SJouni Malinen * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range 38131888487SJouni Malinen * 1..32767] 38231888487SJouni Malinen * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range 38331888487SJouni Malinen * 1..32767] 38431888487SJouni Malinen * @aifs: Arbitration interframe space [0..255] 38531888487SJouni Malinen */ 38631888487SJouni Malinen struct ieee80211_txq_params { 38731888487SJouni Malinen enum nl80211_txq_q queue; 38831888487SJouni Malinen u16 txop; 38931888487SJouni Malinen u16 cwmin; 39031888487SJouni Malinen u16 cwmax; 39131888487SJouni Malinen u8 aifs; 39231888487SJouni Malinen }; 39331888487SJouni Malinen 394704232c2SJohannes Berg /* from net/wireless.h */ 395704232c2SJohannes Berg struct wiphy; 396704232c2SJohannes Berg 39772bdcf34SJouni Malinen /* from net/ieee80211.h */ 39872bdcf34SJouni Malinen struct ieee80211_channel; 39972bdcf34SJouni Malinen 400704232c2SJohannes Berg /** 401704232c2SJohannes Berg * struct cfg80211_ops - backend description for wireless configuration 402704232c2SJohannes Berg * 403704232c2SJohannes Berg * This struct is registered by fullmac card drivers and/or wireless stacks 404704232c2SJohannes Berg * in order to handle configuration requests on their interfaces. 405704232c2SJohannes Berg * 406704232c2SJohannes Berg * All callbacks except where otherwise noted should return 0 407704232c2SJohannes Berg * on success or a negative error code. 408704232c2SJohannes Berg * 40943fb45cbSJohannes Berg * All operations are currently invoked under rtnl for consistency with the 41043fb45cbSJohannes Berg * wireless extensions but this is subject to reevaluation as soon as this 41143fb45cbSJohannes Berg * code is used more widely and we have a first user without wext. 41243fb45cbSJohannes Berg * 41360719ffdSJohannes Berg * @add_virtual_intf: create a new virtual interface with the given name, 41460719ffdSJohannes Berg * must set the struct wireless_dev's iftype. 415704232c2SJohannes Berg * 416704232c2SJohannes Berg * @del_virtual_intf: remove the virtual interface determined by ifindex. 41755682965SJohannes Berg * 41860719ffdSJohannes Berg * @change_virtual_intf: change type/configuration of virtual interface, 41960719ffdSJohannes Berg * keep the struct wireless_dev's iftype updated. 42055682965SJohannes Berg * 42141ade00fSJohannes Berg * @add_key: add a key with the given parameters. @mac_addr will be %NULL 42241ade00fSJohannes Berg * when adding a group key. 42341ade00fSJohannes Berg * 42441ade00fSJohannes Berg * @get_key: get information about the key with the given parameters. 42541ade00fSJohannes Berg * @mac_addr will be %NULL when requesting information for a group 42641ade00fSJohannes Berg * key. All pointers given to the @callback function need not be valid 42741ade00fSJohannes Berg * after it returns. 42841ade00fSJohannes Berg * 42941ade00fSJohannes Berg * @del_key: remove a key given the @mac_addr (%NULL for a group key) 43041ade00fSJohannes Berg * and @key_index 43141ade00fSJohannes Berg * 43241ade00fSJohannes Berg * @set_default_key: set the default key on an interface 433ed1b6cc7SJohannes Berg * 434ed1b6cc7SJohannes Berg * @add_beacon: Add a beacon with given parameters, @head, @interval 435ed1b6cc7SJohannes Berg * and @dtim_period will be valid, @tail is optional. 436ed1b6cc7SJohannes Berg * @set_beacon: Change the beacon parameters for an access point mode 437ed1b6cc7SJohannes Berg * interface. This should reject the call when no beacon has been 438ed1b6cc7SJohannes Berg * configured. 439ed1b6cc7SJohannes Berg * @del_beacon: Remove beacon configuration and stop sending the beacon. 4405727ef1bSJohannes Berg * 4415727ef1bSJohannes Berg * @add_station: Add a new station. 4425727ef1bSJohannes Berg * 4435727ef1bSJohannes Berg * @del_station: Remove a station; @mac may be NULL to remove all stations. 4445727ef1bSJohannes Berg * 4455727ef1bSJohannes Berg * @change_station: Modify a given station. 4462ec600d6SLuis Carlos Cobo * 44793da9cc1Scolin@cozybit.com * @get_mesh_params: Put the current mesh parameters into *params 44893da9cc1Scolin@cozybit.com * 44993da9cc1Scolin@cozybit.com * @set_mesh_params: Set mesh parameters. 45093da9cc1Scolin@cozybit.com * The mask is a bitfield which tells us which parameters to 45193da9cc1Scolin@cozybit.com * set, and which to leave alone. 45293da9cc1Scolin@cozybit.com * 4532ec600d6SLuis Carlos Cobo * @set_mesh_cfg: set mesh parameters (by now, just mesh id) 4549f1ba906SJouni Malinen * 4559f1ba906SJouni Malinen * @change_bss: Modify parameters for a given BSS. 45631888487SJouni Malinen * 45731888487SJouni Malinen * @set_txq_params: Set TX queue parameters 45872bdcf34SJouni Malinen * 45972bdcf34SJouni Malinen * @set_channel: Set channel 460704232c2SJohannes Berg */ 461704232c2SJohannes Berg struct cfg80211_ops { 462704232c2SJohannes Berg int (*add_virtual_intf)(struct wiphy *wiphy, char *name, 4632ec600d6SLuis Carlos Cobo enum nl80211_iftype type, u32 *flags, 4642ec600d6SLuis Carlos Cobo struct vif_params *params); 465704232c2SJohannes Berg int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex); 46655682965SJohannes Berg int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex, 4672ec600d6SLuis Carlos Cobo enum nl80211_iftype type, u32 *flags, 4682ec600d6SLuis Carlos Cobo struct vif_params *params); 46941ade00fSJohannes Berg 47041ade00fSJohannes Berg int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 47141ade00fSJohannes Berg u8 key_index, u8 *mac_addr, 47241ade00fSJohannes Berg struct key_params *params); 47341ade00fSJohannes Berg int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 47441ade00fSJohannes Berg u8 key_index, u8 *mac_addr, void *cookie, 47541ade00fSJohannes Berg void (*callback)(void *cookie, struct key_params*)); 47641ade00fSJohannes Berg int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 47741ade00fSJohannes Berg u8 key_index, u8 *mac_addr); 47841ade00fSJohannes Berg int (*set_default_key)(struct wiphy *wiphy, 47941ade00fSJohannes Berg struct net_device *netdev, 48041ade00fSJohannes Berg u8 key_index); 481ed1b6cc7SJohannes Berg 482ed1b6cc7SJohannes Berg int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev, 483ed1b6cc7SJohannes Berg struct beacon_parameters *info); 484ed1b6cc7SJohannes Berg int (*set_beacon)(struct wiphy *wiphy, struct net_device *dev, 485ed1b6cc7SJohannes Berg struct beacon_parameters *info); 486ed1b6cc7SJohannes Berg int (*del_beacon)(struct wiphy *wiphy, struct net_device *dev); 4875727ef1bSJohannes Berg 4885727ef1bSJohannes Berg 4895727ef1bSJohannes Berg int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 4905727ef1bSJohannes Berg u8 *mac, struct station_parameters *params); 4915727ef1bSJohannes Berg int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 4925727ef1bSJohannes Berg u8 *mac); 4935727ef1bSJohannes Berg int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 4945727ef1bSJohannes Berg u8 *mac, struct station_parameters *params); 495fd5b74dcSJohannes Berg int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 4962ec600d6SLuis Carlos Cobo u8 *mac, struct station_info *sinfo); 4972ec600d6SLuis Carlos Cobo int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, 4982ec600d6SLuis Carlos Cobo int idx, u8 *mac, struct station_info *sinfo); 4992ec600d6SLuis Carlos Cobo 5002ec600d6SLuis Carlos Cobo int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 5012ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop); 5022ec600d6SLuis Carlos Cobo int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 5032ec600d6SLuis Carlos Cobo u8 *dst); 5042ec600d6SLuis Carlos Cobo int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 5052ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop); 5062ec600d6SLuis Carlos Cobo int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 5072ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop, 5082ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 5092ec600d6SLuis Carlos Cobo int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 5102ec600d6SLuis Carlos Cobo int idx, u8 *dst, u8 *next_hop, 5112ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 51293da9cc1Scolin@cozybit.com int (*get_mesh_params)(struct wiphy *wiphy, 51393da9cc1Scolin@cozybit.com struct net_device *dev, 51493da9cc1Scolin@cozybit.com struct mesh_config *conf); 51593da9cc1Scolin@cozybit.com int (*set_mesh_params)(struct wiphy *wiphy, 51693da9cc1Scolin@cozybit.com struct net_device *dev, 51793da9cc1Scolin@cozybit.com const struct mesh_config *nconf, u32 mask); 5189f1ba906SJouni Malinen int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 5199f1ba906SJouni Malinen struct bss_parameters *params); 52031888487SJouni Malinen 52131888487SJouni Malinen int (*set_txq_params)(struct wiphy *wiphy, 52231888487SJouni Malinen struct ieee80211_txq_params *params); 52372bdcf34SJouni Malinen 52472bdcf34SJouni Malinen int (*set_channel)(struct wiphy *wiphy, 52572bdcf34SJouni Malinen struct ieee80211_channel *chan, 52672bdcf34SJouni Malinen enum nl80211_sec_chan_offset); 527704232c2SJohannes Berg }; 528704232c2SJohannes Berg 529fee52678SJohannes Berg /* temporary wext handlers */ 530fee52678SJohannes Berg int cfg80211_wext_giwname(struct net_device *dev, 531fee52678SJohannes Berg struct iw_request_info *info, 532fee52678SJohannes Berg char *name, char *extra); 533*e60c7744SJohannes Berg int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info, 534*e60c7744SJohannes Berg u32 *mode, char *extra); 535*e60c7744SJohannes Berg int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info, 536*e60c7744SJohannes Berg u32 *mode, char *extra); 537fee52678SJohannes Berg 538704232c2SJohannes Berg #endif /* __NET_CFG80211_H */ 539