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> 8704232c2SJohannes Berg 9704232c2SJohannes Berg /* 10704232c2SJohannes Berg * 802.11 configuration in-kernel interface 11704232c2SJohannes Berg * 1255682965SJohannes Berg * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net> 13704232c2SJohannes Berg */ 14704232c2SJohannes Berg 152ec600d6SLuis Carlos Cobo /** 162ec600d6SLuis Carlos Cobo * struct vif_params - describes virtual interface parameters 172ec600d6SLuis Carlos Cobo * @mesh_id: mesh ID to use 182ec600d6SLuis Carlos Cobo * @mesh_id_len: length of the mesh ID 192ec600d6SLuis Carlos Cobo */ 202ec600d6SLuis Carlos Cobo struct vif_params { 212ec600d6SLuis Carlos Cobo u8 *mesh_id; 222ec600d6SLuis Carlos Cobo int mesh_id_len; 232ec600d6SLuis Carlos Cobo }; 242ec600d6SLuis Carlos Cobo 25179f831bSAndy Green /* Radiotap header iteration 26179f831bSAndy Green * implemented in net/wireless/radiotap.c 27179f831bSAndy Green * docs in Documentation/networking/radiotap-headers.txt 28179f831bSAndy Green */ 29179f831bSAndy Green /** 30179f831bSAndy Green * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 31179f831bSAndy Green * @rtheader: pointer to the radiotap header we are walking through 32179f831bSAndy Green * @max_length: length of radiotap header in cpu byte ordering 33179f831bSAndy Green * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg 34179f831bSAndy Green * @this_arg: pointer to current radiotap arg 35179f831bSAndy Green * @arg_index: internal next argument index 36179f831bSAndy Green * @arg: internal next argument pointer 37179f831bSAndy Green * @next_bitmap: internal pointer to next present u32 38179f831bSAndy Green * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 39179f831bSAndy Green */ 40179f831bSAndy Green 41179f831bSAndy Green struct ieee80211_radiotap_iterator { 42179f831bSAndy Green struct ieee80211_radiotap_header *rtheader; 43179f831bSAndy Green int max_length; 44179f831bSAndy Green int this_arg_index; 45179f831bSAndy Green u8 *this_arg; 46179f831bSAndy Green 47179f831bSAndy Green int arg_index; 48179f831bSAndy Green u8 *arg; 49179f831bSAndy Green __le32 *next_bitmap; 50179f831bSAndy Green u32 bitmap_shifter; 51179f831bSAndy Green }; 52179f831bSAndy Green 53179f831bSAndy Green extern int ieee80211_radiotap_iterator_init( 54179f831bSAndy Green struct ieee80211_radiotap_iterator *iterator, 55179f831bSAndy Green struct ieee80211_radiotap_header *radiotap_header, 56179f831bSAndy Green int max_length); 57179f831bSAndy Green 58179f831bSAndy Green extern int ieee80211_radiotap_iterator_next( 59179f831bSAndy Green struct ieee80211_radiotap_iterator *iterator); 60179f831bSAndy Green 61179f831bSAndy Green 6241ade00fSJohannes Berg /** 6341ade00fSJohannes Berg * struct key_params - key information 6441ade00fSJohannes Berg * 6541ade00fSJohannes Berg * Information about a key 6641ade00fSJohannes Berg * 6741ade00fSJohannes Berg * @key: key material 6841ade00fSJohannes Berg * @key_len: length of key material 6941ade00fSJohannes Berg * @cipher: cipher suite selector 7041ade00fSJohannes Berg * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used 7141ade00fSJohannes Berg * with the get_key() callback, must be in little endian, 7241ade00fSJohannes Berg * length given by @seq_len. 7341ade00fSJohannes Berg */ 7441ade00fSJohannes Berg struct key_params { 7541ade00fSJohannes Berg u8 *key; 7641ade00fSJohannes Berg u8 *seq; 7741ade00fSJohannes Berg int key_len; 7841ade00fSJohannes Berg int seq_len; 7941ade00fSJohannes Berg u32 cipher; 8041ade00fSJohannes Berg }; 8141ade00fSJohannes Berg 82ed1b6cc7SJohannes Berg /** 83ed1b6cc7SJohannes Berg * struct beacon_parameters - beacon parameters 84ed1b6cc7SJohannes Berg * 85ed1b6cc7SJohannes Berg * Used to configure the beacon for an interface. 86ed1b6cc7SJohannes Berg * 87ed1b6cc7SJohannes Berg * @head: head portion of beacon (before TIM IE) 88ed1b6cc7SJohannes Berg * or %NULL if not changed 89ed1b6cc7SJohannes Berg * @tail: tail portion of beacon (after TIM IE) 90ed1b6cc7SJohannes Berg * or %NULL if not changed 91ed1b6cc7SJohannes Berg * @interval: beacon interval or zero if not changed 92ed1b6cc7SJohannes Berg * @dtim_period: DTIM period or zero if not changed 93ed1b6cc7SJohannes Berg * @head_len: length of @head 94ed1b6cc7SJohannes Berg * @tail_len: length of @tail 95ed1b6cc7SJohannes Berg */ 96ed1b6cc7SJohannes Berg struct beacon_parameters { 97ed1b6cc7SJohannes Berg u8 *head, *tail; 98ed1b6cc7SJohannes Berg int interval, dtim_period; 99ed1b6cc7SJohannes Berg int head_len, tail_len; 100ed1b6cc7SJohannes Berg }; 101ed1b6cc7SJohannes Berg 1025727ef1bSJohannes Berg /** 1035727ef1bSJohannes Berg * enum station_flags - station flags 1045727ef1bSJohannes Berg * 1055727ef1bSJohannes Berg * Station capability flags. Note that these must be the bits 1065727ef1bSJohannes Berg * according to the nl80211 flags. 1075727ef1bSJohannes Berg * 1085727ef1bSJohannes Berg * @STATION_FLAG_CHANGED: station flags were changed 1095727ef1bSJohannes Berg * @STATION_FLAG_AUTHORIZED: station is authorized to send frames (802.1X) 1105727ef1bSJohannes Berg * @STATION_FLAG_SHORT_PREAMBLE: station is capable of receiving frames 1115727ef1bSJohannes Berg * with short preambles 1125727ef1bSJohannes Berg * @STATION_FLAG_WME: station is WME/QoS capable 1135727ef1bSJohannes Berg */ 1145727ef1bSJohannes Berg enum station_flags { 1155727ef1bSJohannes Berg STATION_FLAG_CHANGED = 1<<0, 1165727ef1bSJohannes Berg STATION_FLAG_AUTHORIZED = 1<<NL80211_STA_FLAG_AUTHORIZED, 1175727ef1bSJohannes Berg STATION_FLAG_SHORT_PREAMBLE = 1<<NL80211_STA_FLAG_SHORT_PREAMBLE, 1185727ef1bSJohannes Berg STATION_FLAG_WME = 1<<NL80211_STA_FLAG_WME, 1195727ef1bSJohannes Berg }; 1205727ef1bSJohannes Berg 1215727ef1bSJohannes Berg /** 1222ec600d6SLuis Carlos Cobo * enum plink_action - actions to perform in mesh peers 1232ec600d6SLuis Carlos Cobo * 1242ec600d6SLuis Carlos Cobo * @PLINK_ACTION_INVALID: action 0 is reserved 1252ec600d6SLuis Carlos Cobo * @PLINK_ACTION_OPEN: start mesh peer link establishment 1262ec600d6SLuis Carlos Cobo * @PLINK_ACTION_BLOCL: block traffic from this mesh peer 1272ec600d6SLuis Carlos Cobo */ 1282ec600d6SLuis Carlos Cobo enum plink_actions { 1292ec600d6SLuis Carlos Cobo PLINK_ACTION_INVALID, 1302ec600d6SLuis Carlos Cobo PLINK_ACTION_OPEN, 1312ec600d6SLuis Carlos Cobo PLINK_ACTION_BLOCK, 1322ec600d6SLuis Carlos Cobo }; 1332ec600d6SLuis Carlos Cobo 1342ec600d6SLuis Carlos Cobo /** 1355727ef1bSJohannes Berg * struct station_parameters - station parameters 1365727ef1bSJohannes Berg * 1375727ef1bSJohannes Berg * Used to change and create a new station. 1385727ef1bSJohannes Berg * 1395727ef1bSJohannes Berg * @vlan: vlan interface station should belong to 1405727ef1bSJohannes Berg * @supported_rates: supported rates in IEEE 802.11 format 1415727ef1bSJohannes Berg * (or NULL for no change) 1425727ef1bSJohannes Berg * @supported_rates_len: number of supported rates 1435727ef1bSJohannes Berg * @station_flags: station flags (see &enum station_flags) 1445727ef1bSJohannes Berg * @listen_interval: listen interval or -1 for no change 1455727ef1bSJohannes Berg * @aid: AID or zero for no change 1465727ef1bSJohannes Berg */ 1475727ef1bSJohannes Berg struct station_parameters { 1485727ef1bSJohannes Berg u8 *supported_rates; 1495727ef1bSJohannes Berg struct net_device *vlan; 1505727ef1bSJohannes Berg u32 station_flags; 1515727ef1bSJohannes Berg int listen_interval; 1525727ef1bSJohannes Berg u16 aid; 1535727ef1bSJohannes Berg u8 supported_rates_len; 1542ec600d6SLuis Carlos Cobo u8 plink_action; 15536aedc90SJouni Malinen struct ieee80211_ht_cap *ht_capa; 1565727ef1bSJohannes Berg }; 1575727ef1bSJohannes Berg 158fd5b74dcSJohannes Berg /** 1592ec600d6SLuis Carlos Cobo * enum station_info_flags - station information flags 160fd5b74dcSJohannes Berg * 1612ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct station_info 1622ec600d6SLuis Carlos Cobo * it has filled in during get_station() or dump_station(). 163fd5b74dcSJohannes Berg * 1642ec600d6SLuis Carlos Cobo * @STATION_INFO_INACTIVE_TIME: @inactive_time filled 1652ec600d6SLuis Carlos Cobo * @STATION_INFO_RX_BYTES: @rx_bytes filled 1662ec600d6SLuis Carlos Cobo * @STATION_INFO_TX_BYTES: @tx_bytes filled 1672ec600d6SLuis Carlos Cobo * @STATION_INFO_LLID: @llid filled 1682ec600d6SLuis Carlos Cobo * @STATION_INFO_PLID: @plid filled 1692ec600d6SLuis Carlos Cobo * @STATION_INFO_PLINK_STATE: @plink_state filled 170fd5b74dcSJohannes Berg */ 1712ec600d6SLuis Carlos Cobo enum station_info_flags { 1722ec600d6SLuis Carlos Cobo STATION_INFO_INACTIVE_TIME = 1<<0, 1732ec600d6SLuis Carlos Cobo STATION_INFO_RX_BYTES = 1<<1, 1742ec600d6SLuis Carlos Cobo STATION_INFO_TX_BYTES = 1<<2, 1752ec600d6SLuis Carlos Cobo STATION_INFO_LLID = 1<<3, 1762ec600d6SLuis Carlos Cobo STATION_INFO_PLID = 1<<4, 1772ec600d6SLuis Carlos Cobo STATION_INFO_PLINK_STATE = 1<<5, 178fd5b74dcSJohannes Berg }; 179fd5b74dcSJohannes Berg 180fd5b74dcSJohannes Berg /** 1812ec600d6SLuis Carlos Cobo * struct station_info - station information 182fd5b74dcSJohannes Berg * 1832ec600d6SLuis Carlos Cobo * Station information filled by driver for get_station() and dump_station. 184fd5b74dcSJohannes Berg * 1852ec600d6SLuis Carlos Cobo * @filled: bitflag of flags from &enum station_info_flags 186fd5b74dcSJohannes Berg * @inactive_time: time since last station activity (tx/rx) in milliseconds 187fd5b74dcSJohannes Berg * @rx_bytes: bytes received from this station 188fd5b74dcSJohannes Berg * @tx_bytes: bytes transmitted to this station 1892ec600d6SLuis Carlos Cobo * @llid: mesh local link id 1902ec600d6SLuis Carlos Cobo * @plid: mesh peer link id 1912ec600d6SLuis Carlos Cobo * @plink_state: mesh peer link state 192fd5b74dcSJohannes Berg */ 1932ec600d6SLuis Carlos Cobo struct station_info { 194fd5b74dcSJohannes Berg u32 filled; 195fd5b74dcSJohannes Berg u32 inactive_time; 196fd5b74dcSJohannes Berg u32 rx_bytes; 197fd5b74dcSJohannes Berg u32 tx_bytes; 1982ec600d6SLuis Carlos Cobo u16 llid; 1992ec600d6SLuis Carlos Cobo u16 plid; 2002ec600d6SLuis Carlos Cobo u8 plink_state; 201fd5b74dcSJohannes Berg }; 202fd5b74dcSJohannes Berg 20366f7ac50SMichael Wu /** 20466f7ac50SMichael Wu * enum monitor_flags - monitor flags 20566f7ac50SMichael Wu * 20666f7ac50SMichael Wu * Monitor interface configuration flags. Note that these must be the bits 20766f7ac50SMichael Wu * according to the nl80211 flags. 20866f7ac50SMichael Wu * 20966f7ac50SMichael Wu * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS 21066f7ac50SMichael Wu * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP 21166f7ac50SMichael Wu * @MONITOR_FLAG_CONTROL: pass control frames 21266f7ac50SMichael Wu * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering 21366f7ac50SMichael Wu * @MONITOR_FLAG_COOK_FRAMES: report frames after processing 21466f7ac50SMichael Wu */ 21566f7ac50SMichael Wu enum monitor_flags { 21666f7ac50SMichael Wu MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL, 21766f7ac50SMichael Wu MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL, 21866f7ac50SMichael Wu MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL, 21966f7ac50SMichael Wu MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS, 22066f7ac50SMichael Wu MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES, 22166f7ac50SMichael Wu }; 22266f7ac50SMichael Wu 2232ec600d6SLuis Carlos Cobo /** 2242ec600d6SLuis Carlos Cobo * enum mpath_info_flags - mesh path information flags 2252ec600d6SLuis Carlos Cobo * 2262ec600d6SLuis Carlos Cobo * Used by the driver to indicate which info in &struct mpath_info it has filled 2272ec600d6SLuis Carlos Cobo * in during get_station() or dump_station(). 2282ec600d6SLuis Carlos Cobo * 2292ec600d6SLuis Carlos Cobo * MPATH_INFO_FRAME_QLEN: @frame_qlen filled 2302ec600d6SLuis Carlos Cobo * MPATH_INFO_DSN: @dsn filled 2312ec600d6SLuis Carlos Cobo * MPATH_INFO_METRIC: @metric filled 2322ec600d6SLuis Carlos Cobo * MPATH_INFO_EXPTIME: @exptime filled 2332ec600d6SLuis Carlos Cobo * MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 2342ec600d6SLuis Carlos Cobo * MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled 2352ec600d6SLuis Carlos Cobo * MPATH_INFO_FLAGS: @flags filled 2362ec600d6SLuis Carlos Cobo */ 2372ec600d6SLuis Carlos Cobo enum mpath_info_flags { 2382ec600d6SLuis Carlos Cobo MPATH_INFO_FRAME_QLEN = BIT(0), 2392ec600d6SLuis Carlos Cobo MPATH_INFO_DSN = BIT(1), 2402ec600d6SLuis Carlos Cobo MPATH_INFO_METRIC = BIT(2), 2412ec600d6SLuis Carlos Cobo MPATH_INFO_EXPTIME = BIT(3), 2422ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), 2432ec600d6SLuis Carlos Cobo MPATH_INFO_DISCOVERY_RETRIES = BIT(5), 2442ec600d6SLuis Carlos Cobo MPATH_INFO_FLAGS = BIT(6), 2452ec600d6SLuis Carlos Cobo }; 2462ec600d6SLuis Carlos Cobo 2472ec600d6SLuis Carlos Cobo /** 2482ec600d6SLuis Carlos Cobo * struct mpath_info - mesh path information 2492ec600d6SLuis Carlos Cobo * 2502ec600d6SLuis Carlos Cobo * Mesh path information filled by driver for get_mpath() and dump_mpath(). 2512ec600d6SLuis Carlos Cobo * 2522ec600d6SLuis Carlos Cobo * @filled: bitfield of flags from &enum mpath_info_flags 2532ec600d6SLuis Carlos Cobo * @frame_qlen: number of queued frames for this destination 2542ec600d6SLuis Carlos Cobo * @dsn: destination sequence number 2552ec600d6SLuis Carlos Cobo * @metric: metric (cost) of this mesh path 2562ec600d6SLuis Carlos Cobo * @exptime: expiration time for the mesh path from now, in msecs 2572ec600d6SLuis Carlos Cobo * @flags: mesh path flags 2582ec600d6SLuis Carlos Cobo * @discovery_timeout: total mesh path discovery timeout, in msecs 2592ec600d6SLuis Carlos Cobo * @discovery_retries: mesh path discovery retries 2602ec600d6SLuis Carlos Cobo */ 2612ec600d6SLuis Carlos Cobo struct mpath_info { 2622ec600d6SLuis Carlos Cobo u32 filled; 2632ec600d6SLuis Carlos Cobo u32 frame_qlen; 2642ec600d6SLuis Carlos Cobo u32 dsn; 2652ec600d6SLuis Carlos Cobo u32 metric; 2662ec600d6SLuis Carlos Cobo u32 exptime; 2672ec600d6SLuis Carlos Cobo u32 discovery_timeout; 2682ec600d6SLuis Carlos Cobo u8 discovery_retries; 2692ec600d6SLuis Carlos Cobo u8 flags; 2702ec600d6SLuis Carlos Cobo }; 2712ec600d6SLuis Carlos Cobo 2729f1ba906SJouni Malinen /** 2739f1ba906SJouni Malinen * struct bss_parameters - BSS parameters 2749f1ba906SJouni Malinen * 2759f1ba906SJouni Malinen * Used to change BSS parameters (mainly for AP mode). 2769f1ba906SJouni Malinen * 2779f1ba906SJouni Malinen * @use_cts_prot: Whether to use CTS protection 2789f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 2799f1ba906SJouni Malinen * @use_short_preamble: Whether the use of short preambles is allowed 2809f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 2819f1ba906SJouni Malinen * @use_short_slot_time: Whether the use of short slot time is allowed 2829f1ba906SJouni Malinen * (0 = no, 1 = yes, -1 = do not change) 2839f1ba906SJouni Malinen */ 2849f1ba906SJouni Malinen struct bss_parameters { 2859f1ba906SJouni Malinen int use_cts_prot; 2869f1ba906SJouni Malinen int use_short_preamble; 2879f1ba906SJouni Malinen int use_short_slot_time; 2889f1ba906SJouni Malinen }; 2892ec600d6SLuis Carlos Cobo 290*b2e1b302SLuis R. Rodriguez /** 291*b2e1b302SLuis R. Rodriguez * enum reg_set_by - Indicates who is trying to set the regulatory domain 292*b2e1b302SLuis R. Rodriguez * @REGDOM_SET_BY_INIT: regulatory domain was set by initialization. We will be 293*b2e1b302SLuis R. Rodriguez * using a static world regulatory domain by default. 294*b2e1b302SLuis R. Rodriguez * @REGDOM_SET_BY_CORE: Core queried CRDA for a dynamic world regulatory domain. 295*b2e1b302SLuis R. Rodriguez * @REGDOM_SET_BY_USER: User asked the wireless core to set the 296*b2e1b302SLuis R. Rodriguez * regulatory domain. 297*b2e1b302SLuis R. Rodriguez * @REGDOM_SET_BY_DRIVER: a wireless drivers has hinted to the wireless core 298*b2e1b302SLuis R. Rodriguez * it thinks its knows the regulatory domain we should be in. 299*b2e1b302SLuis R. Rodriguez * @REGDOM_SET_BY_COUNTRY_IE: the wireless core has received an 802.11 country 300*b2e1b302SLuis R. Rodriguez * information element with regulatory information it thinks we 301*b2e1b302SLuis R. Rodriguez * should consider. 302*b2e1b302SLuis R. Rodriguez */ 303*b2e1b302SLuis R. Rodriguez enum reg_set_by { 304*b2e1b302SLuis R. Rodriguez REGDOM_SET_BY_INIT, 305*b2e1b302SLuis R. Rodriguez REGDOM_SET_BY_CORE, 306*b2e1b302SLuis R. Rodriguez REGDOM_SET_BY_USER, 307*b2e1b302SLuis R. Rodriguez REGDOM_SET_BY_DRIVER, 308*b2e1b302SLuis R. Rodriguez REGDOM_SET_BY_COUNTRY_IE, 309*b2e1b302SLuis R. Rodriguez }; 310*b2e1b302SLuis R. Rodriguez 311*b2e1b302SLuis R. Rodriguez struct ieee80211_freq_range { 312*b2e1b302SLuis R. Rodriguez u32 start_freq_khz; 313*b2e1b302SLuis R. Rodriguez u32 end_freq_khz; 314*b2e1b302SLuis R. Rodriguez u32 max_bandwidth_khz; 315*b2e1b302SLuis R. Rodriguez }; 316*b2e1b302SLuis R. Rodriguez 317*b2e1b302SLuis R. Rodriguez struct ieee80211_power_rule { 318*b2e1b302SLuis R. Rodriguez u32 max_antenna_gain; 319*b2e1b302SLuis R. Rodriguez u32 max_eirp; 320*b2e1b302SLuis R. Rodriguez }; 321*b2e1b302SLuis R. Rodriguez 322*b2e1b302SLuis R. Rodriguez struct ieee80211_reg_rule { 323*b2e1b302SLuis R. Rodriguez struct ieee80211_freq_range freq_range; 324*b2e1b302SLuis R. Rodriguez struct ieee80211_power_rule power_rule; 325*b2e1b302SLuis R. Rodriguez u32 flags; 326*b2e1b302SLuis R. Rodriguez }; 327*b2e1b302SLuis R. Rodriguez 328*b2e1b302SLuis R. Rodriguez struct ieee80211_regdomain { 329*b2e1b302SLuis R. Rodriguez u32 n_reg_rules; 330*b2e1b302SLuis R. Rodriguez char alpha2[2]; 331*b2e1b302SLuis R. Rodriguez struct ieee80211_reg_rule reg_rules[]; 332*b2e1b302SLuis R. Rodriguez }; 333*b2e1b302SLuis R. Rodriguez 334*b2e1b302SLuis R. Rodriguez #define MHZ_TO_KHZ(freq) (freq * 1000) 335*b2e1b302SLuis R. Rodriguez #define KHZ_TO_MHZ(freq) (freq / 1000) 336*b2e1b302SLuis R. Rodriguez #define DBI_TO_MBI(gain) (gain * 100) 337*b2e1b302SLuis R. Rodriguez #define MBI_TO_DBI(gain) (gain / 100) 338*b2e1b302SLuis R. Rodriguez #define DBM_TO_MBM(gain) (gain * 100) 339*b2e1b302SLuis R. Rodriguez #define MBM_TO_DBM(gain) (gain / 100) 340*b2e1b302SLuis R. Rodriguez 341*b2e1b302SLuis R. Rodriguez #define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \ 342*b2e1b302SLuis R. Rodriguez .freq_range.start_freq_khz = (start) * 1000, \ 343*b2e1b302SLuis R. Rodriguez .freq_range.end_freq_khz = (end) * 1000, \ 344*b2e1b302SLuis R. Rodriguez .freq_range.max_bandwidth_khz = (bw) * 1000, \ 345*b2e1b302SLuis R. Rodriguez .power_rule.max_antenna_gain = (gain) * 100, \ 346*b2e1b302SLuis R. Rodriguez .power_rule.max_eirp = (eirp) * 100, \ 347*b2e1b302SLuis R. Rodriguez .flags = reg_flags, \ 348*b2e1b302SLuis R. Rodriguez } 349*b2e1b302SLuis R. Rodriguez 350704232c2SJohannes Berg /* from net/wireless.h */ 351704232c2SJohannes Berg struct wiphy; 352704232c2SJohannes Berg 353704232c2SJohannes Berg /** 354704232c2SJohannes Berg * struct cfg80211_ops - backend description for wireless configuration 355704232c2SJohannes Berg * 356704232c2SJohannes Berg * This struct is registered by fullmac card drivers and/or wireless stacks 357704232c2SJohannes Berg * in order to handle configuration requests on their interfaces. 358704232c2SJohannes Berg * 359704232c2SJohannes Berg * All callbacks except where otherwise noted should return 0 360704232c2SJohannes Berg * on success or a negative error code. 361704232c2SJohannes Berg * 36243fb45cbSJohannes Berg * All operations are currently invoked under rtnl for consistency with the 36343fb45cbSJohannes Berg * wireless extensions but this is subject to reevaluation as soon as this 36443fb45cbSJohannes Berg * code is used more widely and we have a first user without wext. 36543fb45cbSJohannes Berg * 366704232c2SJohannes Berg * @add_virtual_intf: create a new virtual interface with the given name 367704232c2SJohannes Berg * 368704232c2SJohannes Berg * @del_virtual_intf: remove the virtual interface determined by ifindex. 36955682965SJohannes Berg * 37055682965SJohannes Berg * @change_virtual_intf: change type of virtual interface 37155682965SJohannes Berg * 37241ade00fSJohannes Berg * @add_key: add a key with the given parameters. @mac_addr will be %NULL 37341ade00fSJohannes Berg * when adding a group key. 37441ade00fSJohannes Berg * 37541ade00fSJohannes Berg * @get_key: get information about the key with the given parameters. 37641ade00fSJohannes Berg * @mac_addr will be %NULL when requesting information for a group 37741ade00fSJohannes Berg * key. All pointers given to the @callback function need not be valid 37841ade00fSJohannes Berg * after it returns. 37941ade00fSJohannes Berg * 38041ade00fSJohannes Berg * @del_key: remove a key given the @mac_addr (%NULL for a group key) 38141ade00fSJohannes Berg * and @key_index 38241ade00fSJohannes Berg * 38341ade00fSJohannes Berg * @set_default_key: set the default key on an interface 384ed1b6cc7SJohannes Berg * 385ed1b6cc7SJohannes Berg * @add_beacon: Add a beacon with given parameters, @head, @interval 386ed1b6cc7SJohannes Berg * and @dtim_period will be valid, @tail is optional. 387ed1b6cc7SJohannes Berg * @set_beacon: Change the beacon parameters for an access point mode 388ed1b6cc7SJohannes Berg * interface. This should reject the call when no beacon has been 389ed1b6cc7SJohannes Berg * configured. 390ed1b6cc7SJohannes Berg * @del_beacon: Remove beacon configuration and stop sending the beacon. 3915727ef1bSJohannes Berg * 3925727ef1bSJohannes Berg * @add_station: Add a new station. 3935727ef1bSJohannes Berg * 3945727ef1bSJohannes Berg * @del_station: Remove a station; @mac may be NULL to remove all stations. 3955727ef1bSJohannes Berg * 3965727ef1bSJohannes Berg * @change_station: Modify a given station. 3972ec600d6SLuis Carlos Cobo * 3982ec600d6SLuis Carlos Cobo * @set_mesh_cfg: set mesh parameters (by now, just mesh id) 3999f1ba906SJouni Malinen * 4009f1ba906SJouni Malinen * @change_bss: Modify parameters for a given BSS. 401704232c2SJohannes Berg */ 402704232c2SJohannes Berg struct cfg80211_ops { 403704232c2SJohannes Berg int (*add_virtual_intf)(struct wiphy *wiphy, char *name, 4042ec600d6SLuis Carlos Cobo enum nl80211_iftype type, u32 *flags, 4052ec600d6SLuis Carlos Cobo struct vif_params *params); 406704232c2SJohannes Berg int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex); 40755682965SJohannes Berg int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex, 4082ec600d6SLuis Carlos Cobo enum nl80211_iftype type, u32 *flags, 4092ec600d6SLuis Carlos Cobo struct vif_params *params); 41041ade00fSJohannes Berg 41141ade00fSJohannes Berg int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 41241ade00fSJohannes Berg u8 key_index, u8 *mac_addr, 41341ade00fSJohannes Berg struct key_params *params); 41441ade00fSJohannes Berg int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 41541ade00fSJohannes Berg u8 key_index, u8 *mac_addr, void *cookie, 41641ade00fSJohannes Berg void (*callback)(void *cookie, struct key_params*)); 41741ade00fSJohannes Berg int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 41841ade00fSJohannes Berg u8 key_index, u8 *mac_addr); 41941ade00fSJohannes Berg int (*set_default_key)(struct wiphy *wiphy, 42041ade00fSJohannes Berg struct net_device *netdev, 42141ade00fSJohannes Berg u8 key_index); 422ed1b6cc7SJohannes Berg 423ed1b6cc7SJohannes Berg int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev, 424ed1b6cc7SJohannes Berg struct beacon_parameters *info); 425ed1b6cc7SJohannes Berg int (*set_beacon)(struct wiphy *wiphy, struct net_device *dev, 426ed1b6cc7SJohannes Berg struct beacon_parameters *info); 427ed1b6cc7SJohannes Berg int (*del_beacon)(struct wiphy *wiphy, struct net_device *dev); 4285727ef1bSJohannes Berg 4295727ef1bSJohannes Berg 4305727ef1bSJohannes Berg int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 4315727ef1bSJohannes Berg u8 *mac, struct station_parameters *params); 4325727ef1bSJohannes Berg int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 4335727ef1bSJohannes Berg u8 *mac); 4345727ef1bSJohannes Berg int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 4355727ef1bSJohannes Berg u8 *mac, struct station_parameters *params); 436fd5b74dcSJohannes Berg int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 4372ec600d6SLuis Carlos Cobo u8 *mac, struct station_info *sinfo); 4382ec600d6SLuis Carlos Cobo int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, 4392ec600d6SLuis Carlos Cobo int idx, u8 *mac, struct station_info *sinfo); 4402ec600d6SLuis Carlos Cobo 4412ec600d6SLuis Carlos Cobo int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 4422ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop); 4432ec600d6SLuis Carlos Cobo int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 4442ec600d6SLuis Carlos Cobo u8 *dst); 4452ec600d6SLuis Carlos Cobo int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 4462ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop); 4472ec600d6SLuis Carlos Cobo int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 4482ec600d6SLuis Carlos Cobo u8 *dst, u8 *next_hop, 4492ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 4502ec600d6SLuis Carlos Cobo int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 4512ec600d6SLuis Carlos Cobo int idx, u8 *dst, u8 *next_hop, 4522ec600d6SLuis Carlos Cobo struct mpath_info *pinfo); 4539f1ba906SJouni Malinen 4549f1ba906SJouni Malinen int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 4559f1ba906SJouni Malinen struct bss_parameters *params); 456704232c2SJohannes Berg }; 457704232c2SJohannes Berg 458704232c2SJohannes Berg #endif /* __NET_CFG80211_H */ 459