cfg80211.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831
  1. #ifndef __NET_CFG80211_H
  2. #define __NET_CFG80211_H
  3. #include <linux/netlink.h>
  4. #include <linux/skbuff.h>
  5. #include <linux/nl80211.h>
  6. #include <linux/if_ether.h>
  7. #include <linux/ieee80211.h>
  8. #include <linux/wireless.h>
  9. #include <net/iw_handler.h>
  10. #include <net/genetlink.h>
  11. /* remove once we remove the wext stuff */
  12. #include <net/iw_handler.h>
  13. /*
  14. * 802.11 configuration in-kernel interface
  15. *
  16. * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net>
  17. */
  18. /**
  19. * struct vif_params - describes virtual interface parameters
  20. * @mesh_id: mesh ID to use
  21. * @mesh_id_len: length of the mesh ID
  22. */
  23. struct vif_params {
  24. u8 *mesh_id;
  25. int mesh_id_len;
  26. };
  27. /* Radiotap header iteration
  28. * implemented in net/wireless/radiotap.c
  29. * docs in Documentation/networking/radiotap-headers.txt
  30. */
  31. /**
  32. * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
  33. * @rtheader: pointer to the radiotap header we are walking through
  34. * @max_length: length of radiotap header in cpu byte ordering
  35. * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg
  36. * @this_arg: pointer to current radiotap arg
  37. * @arg_index: internal next argument index
  38. * @arg: internal next argument pointer
  39. * @next_bitmap: internal pointer to next present u32
  40. * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
  41. */
  42. struct ieee80211_radiotap_iterator {
  43. struct ieee80211_radiotap_header *rtheader;
  44. int max_length;
  45. int this_arg_index;
  46. u8 *this_arg;
  47. int arg_index;
  48. u8 *arg;
  49. __le32 *next_bitmap;
  50. u32 bitmap_shifter;
  51. };
  52. extern int ieee80211_radiotap_iterator_init(
  53. struct ieee80211_radiotap_iterator *iterator,
  54. struct ieee80211_radiotap_header *radiotap_header,
  55. int max_length);
  56. extern int ieee80211_radiotap_iterator_next(
  57. struct ieee80211_radiotap_iterator *iterator);
  58. /**
  59. * struct key_params - key information
  60. *
  61. * Information about a key
  62. *
  63. * @key: key material
  64. * @key_len: length of key material
  65. * @cipher: cipher suite selector
  66. * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
  67. * with the get_key() callback, must be in little endian,
  68. * length given by @seq_len.
  69. */
  70. struct key_params {
  71. u8 *key;
  72. u8 *seq;
  73. int key_len;
  74. int seq_len;
  75. u32 cipher;
  76. };
  77. /**
  78. * struct beacon_parameters - beacon parameters
  79. *
  80. * Used to configure the beacon for an interface.
  81. *
  82. * @head: head portion of beacon (before TIM IE)
  83. * or %NULL if not changed
  84. * @tail: tail portion of beacon (after TIM IE)
  85. * or %NULL if not changed
  86. * @interval: beacon interval or zero if not changed
  87. * @dtim_period: DTIM period or zero if not changed
  88. * @head_len: length of @head
  89. * @tail_len: length of @tail
  90. */
  91. struct beacon_parameters {
  92. u8 *head, *tail;
  93. int interval, dtim_period;
  94. int head_len, tail_len;
  95. };
  96. /**
  97. * enum station_flags - station flags
  98. *
  99. * Station capability flags. Note that these must be the bits
  100. * according to the nl80211 flags.
  101. *
  102. * @STATION_FLAG_CHANGED: station flags were changed
  103. * @STATION_FLAG_AUTHORIZED: station is authorized to send frames (802.1X)
  104. * @STATION_FLAG_SHORT_PREAMBLE: station is capable of receiving frames
  105. * with short preambles
  106. * @STATION_FLAG_WME: station is WME/QoS capable
  107. * @STATION_FLAG_MFP: station uses management frame protection
  108. */
  109. enum station_flags {
  110. STATION_FLAG_CHANGED = 1<<0,
  111. STATION_FLAG_AUTHORIZED = 1<<NL80211_STA_FLAG_AUTHORIZED,
  112. STATION_FLAG_SHORT_PREAMBLE = 1<<NL80211_STA_FLAG_SHORT_PREAMBLE,
  113. STATION_FLAG_WME = 1<<NL80211_STA_FLAG_WME,
  114. STATION_FLAG_MFP = 1<<NL80211_STA_FLAG_MFP,
  115. };
  116. /**
  117. * enum plink_action - actions to perform in mesh peers
  118. *
  119. * @PLINK_ACTION_INVALID: action 0 is reserved
  120. * @PLINK_ACTION_OPEN: start mesh peer link establishment
  121. * @PLINK_ACTION_BLOCL: block traffic from this mesh peer
  122. */
  123. enum plink_actions {
  124. PLINK_ACTION_INVALID,
  125. PLINK_ACTION_OPEN,
  126. PLINK_ACTION_BLOCK,
  127. };
  128. /**
  129. * struct station_parameters - station parameters
  130. *
  131. * Used to change and create a new station.
  132. *
  133. * @vlan: vlan interface station should belong to
  134. * @supported_rates: supported rates in IEEE 802.11 format
  135. * (or NULL for no change)
  136. * @supported_rates_len: number of supported rates
  137. * @station_flags: station flags (see &enum station_flags)
  138. * @listen_interval: listen interval or -1 for no change
  139. * @aid: AID or zero for no change
  140. */
  141. struct station_parameters {
  142. u8 *supported_rates;
  143. struct net_device *vlan;
  144. u32 station_flags;
  145. int listen_interval;
  146. u16 aid;
  147. u8 supported_rates_len;
  148. u8 plink_action;
  149. struct ieee80211_ht_cap *ht_capa;
  150. };
  151. /**
  152. * enum station_info_flags - station information flags
  153. *
  154. * Used by the driver to indicate which info in &struct station_info
  155. * it has filled in during get_station() or dump_station().
  156. *
  157. * @STATION_INFO_INACTIVE_TIME: @inactive_time filled
  158. * @STATION_INFO_RX_BYTES: @rx_bytes filled
  159. * @STATION_INFO_TX_BYTES: @tx_bytes filled
  160. * @STATION_INFO_LLID: @llid filled
  161. * @STATION_INFO_PLID: @plid filled
  162. * @STATION_INFO_PLINK_STATE: @plink_state filled
  163. * @STATION_INFO_SIGNAL: @signal filled
  164. * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled
  165. * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs)
  166. * @STATION_INFO_RX_PACKETS: @rx_packets filled
  167. * @STATION_INFO_TX_PACKETS: @tx_packets filled
  168. */
  169. enum station_info_flags {
  170. STATION_INFO_INACTIVE_TIME = 1<<0,
  171. STATION_INFO_RX_BYTES = 1<<1,
  172. STATION_INFO_TX_BYTES = 1<<2,
  173. STATION_INFO_LLID = 1<<3,
  174. STATION_INFO_PLID = 1<<4,
  175. STATION_INFO_PLINK_STATE = 1<<5,
  176. STATION_INFO_SIGNAL = 1<<6,
  177. STATION_INFO_TX_BITRATE = 1<<7,
  178. STATION_INFO_RX_PACKETS = 1<<8,
  179. STATION_INFO_TX_PACKETS = 1<<9,
  180. };
  181. /**
  182. * enum station_info_rate_flags - bitrate info flags
  183. *
  184. * Used by the driver to indicate the specific rate transmission
  185. * type for 802.11n transmissions.
  186. *
  187. * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled
  188. * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission
  189. * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
  190. */
  191. enum rate_info_flags {
  192. RATE_INFO_FLAGS_MCS = 1<<0,
  193. RATE_INFO_FLAGS_40_MHZ_WIDTH = 1<<1,
  194. RATE_INFO_FLAGS_SHORT_GI = 1<<2,
  195. };
  196. /**
  197. * struct rate_info - bitrate information
  198. *
  199. * Information about a receiving or transmitting bitrate
  200. *
  201. * @flags: bitflag of flags from &enum rate_info_flags
  202. * @mcs: mcs index if struct describes a 802.11n bitrate
  203. * @legacy: bitrate in 100kbit/s for 802.11abg
  204. */
  205. struct rate_info {
  206. u8 flags;
  207. u8 mcs;
  208. u16 legacy;
  209. };
  210. /**
  211. * struct station_info - station information
  212. *
  213. * Station information filled by driver for get_station() and dump_station.
  214. *
  215. * @filled: bitflag of flags from &enum station_info_flags
  216. * @inactive_time: time since last station activity (tx/rx) in milliseconds
  217. * @rx_bytes: bytes received from this station
  218. * @tx_bytes: bytes transmitted to this station
  219. * @llid: mesh local link id
  220. * @plid: mesh peer link id
  221. * @plink_state: mesh peer link state
  222. * @signal: signal strength of last received packet in dBm
  223. * @txrate: current unicast bitrate to this station
  224. * @rx_packets: packets received from this station
  225. * @tx_packets: packets transmitted to this station
  226. */
  227. struct station_info {
  228. u32 filled;
  229. u32 inactive_time;
  230. u32 rx_bytes;
  231. u32 tx_bytes;
  232. u16 llid;
  233. u16 plid;
  234. u8 plink_state;
  235. s8 signal;
  236. struct rate_info txrate;
  237. u32 rx_packets;
  238. u32 tx_packets;
  239. };
  240. /**
  241. * enum monitor_flags - monitor flags
  242. *
  243. * Monitor interface configuration flags. Note that these must be the bits
  244. * according to the nl80211 flags.
  245. *
  246. * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
  247. * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
  248. * @MONITOR_FLAG_CONTROL: pass control frames
  249. * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
  250. * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
  251. */
  252. enum monitor_flags {
  253. MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL,
  254. MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL,
  255. MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL,
  256. MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS,
  257. MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
  258. };
  259. /**
  260. * enum mpath_info_flags - mesh path information flags
  261. *
  262. * Used by the driver to indicate which info in &struct mpath_info it has filled
  263. * in during get_station() or dump_station().
  264. *
  265. * MPATH_INFO_FRAME_QLEN: @frame_qlen filled
  266. * MPATH_INFO_DSN: @dsn filled
  267. * MPATH_INFO_METRIC: @metric filled
  268. * MPATH_INFO_EXPTIME: @exptime filled
  269. * MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
  270. * MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
  271. * MPATH_INFO_FLAGS: @flags filled
  272. */
  273. enum mpath_info_flags {
  274. MPATH_INFO_FRAME_QLEN = BIT(0),
  275. MPATH_INFO_DSN = BIT(1),
  276. MPATH_INFO_METRIC = BIT(2),
  277. MPATH_INFO_EXPTIME = BIT(3),
  278. MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4),
  279. MPATH_INFO_DISCOVERY_RETRIES = BIT(5),
  280. MPATH_INFO_FLAGS = BIT(6),
  281. };
  282. /**
  283. * struct mpath_info - mesh path information
  284. *
  285. * Mesh path information filled by driver for get_mpath() and dump_mpath().
  286. *
  287. * @filled: bitfield of flags from &enum mpath_info_flags
  288. * @frame_qlen: number of queued frames for this destination
  289. * @dsn: destination sequence number
  290. * @metric: metric (cost) of this mesh path
  291. * @exptime: expiration time for the mesh path from now, in msecs
  292. * @flags: mesh path flags
  293. * @discovery_timeout: total mesh path discovery timeout, in msecs
  294. * @discovery_retries: mesh path discovery retries
  295. */
  296. struct mpath_info {
  297. u32 filled;
  298. u32 frame_qlen;
  299. u32 dsn;
  300. u32 metric;
  301. u32 exptime;
  302. u32 discovery_timeout;
  303. u8 discovery_retries;
  304. u8 flags;
  305. };
  306. /**
  307. * struct bss_parameters - BSS parameters
  308. *
  309. * Used to change BSS parameters (mainly for AP mode).
  310. *
  311. * @use_cts_prot: Whether to use CTS protection
  312. * (0 = no, 1 = yes, -1 = do not change)
  313. * @use_short_preamble: Whether the use of short preambles is allowed
  314. * (0 = no, 1 = yes, -1 = do not change)
  315. * @use_short_slot_time: Whether the use of short slot time is allowed
  316. * (0 = no, 1 = yes, -1 = do not change)
  317. * @basic_rates: basic rates in IEEE 802.11 format
  318. * (or NULL for no change)
  319. * @basic_rates_len: number of basic rates
  320. */
  321. struct bss_parameters {
  322. int use_cts_prot;
  323. int use_short_preamble;
  324. int use_short_slot_time;
  325. u8 *basic_rates;
  326. u8 basic_rates_len;
  327. };
  328. /**
  329. * enum reg_set_by - Indicates who is trying to set the regulatory domain
  330. * @REGDOM_SET_BY_INIT: regulatory domain was set by initialization. We will be
  331. * using a static world regulatory domain by default.
  332. * @REGDOM_SET_BY_CORE: Core queried CRDA for a dynamic world regulatory domain.
  333. * @REGDOM_SET_BY_USER: User asked the wireless core to set the
  334. * regulatory domain.
  335. * @REGDOM_SET_BY_DRIVER: a wireless drivers has hinted to the wireless core
  336. * it thinks its knows the regulatory domain we should be in.
  337. * @REGDOM_SET_BY_COUNTRY_IE: the wireless core has received an 802.11 country
  338. * information element with regulatory information it thinks we
  339. * should consider.
  340. */
  341. enum reg_set_by {
  342. REGDOM_SET_BY_INIT,
  343. REGDOM_SET_BY_CORE,
  344. REGDOM_SET_BY_USER,
  345. REGDOM_SET_BY_DRIVER,
  346. REGDOM_SET_BY_COUNTRY_IE,
  347. };
  348. /**
  349. * enum environment_cap - Environment parsed from country IE
  350. * @ENVIRON_ANY: indicates country IE applies to both indoor and
  351. * outdoor operation.
  352. * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation
  353. * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation
  354. */
  355. enum environment_cap {
  356. ENVIRON_ANY,
  357. ENVIRON_INDOOR,
  358. ENVIRON_OUTDOOR,
  359. };
  360. /**
  361. * struct regulatory_request - used to keep track of regulatory requests
  362. *
  363. * @wiphy_idx: this is set if this request's initiator is
  364. * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This
  365. * can be used by the wireless core to deal with conflicts
  366. * and potentially inform users of which devices specifically
  367. * cased the conflicts.
  368. * @initiator: indicates who sent this request, could be any of
  369. * of those set in reg_set_by, %REGDOM_SET_BY_*
  370. * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested
  371. * regulatory domain. We have a few special codes:
  372. * 00 - World regulatory domain
  373. * 99 - built by driver but a specific alpha2 cannot be determined
  374. * 98 - result of an intersection between two regulatory domains
  375. * @intersect: indicates whether the wireless core should intersect
  376. * the requested regulatory domain with the presently set regulatory
  377. * domain.
  378. * @country_ie_checksum: checksum of the last processed and accepted
  379. * country IE
  380. * @country_ie_env: lets us know if the AP is telling us we are outdoor,
  381. * indoor, or if it doesn't matter
  382. * @list: used to insert into the reg_requests_list linked list
  383. */
  384. struct regulatory_request {
  385. int wiphy_idx;
  386. enum reg_set_by initiator;
  387. char alpha2[2];
  388. bool intersect;
  389. u32 country_ie_checksum;
  390. enum environment_cap country_ie_env;
  391. struct list_head list;
  392. };
  393. struct ieee80211_freq_range {
  394. u32 start_freq_khz;
  395. u32 end_freq_khz;
  396. u32 max_bandwidth_khz;
  397. };
  398. struct ieee80211_power_rule {
  399. u32 max_antenna_gain;
  400. u32 max_eirp;
  401. };
  402. struct ieee80211_reg_rule {
  403. struct ieee80211_freq_range freq_range;
  404. struct ieee80211_power_rule power_rule;
  405. u32 flags;
  406. };
  407. struct ieee80211_regdomain {
  408. u32 n_reg_rules;
  409. char alpha2[2];
  410. struct ieee80211_reg_rule reg_rules[];
  411. };
  412. #define MHZ_TO_KHZ(freq) ((freq) * 1000)
  413. #define KHZ_TO_MHZ(freq) ((freq) / 1000)
  414. #define DBI_TO_MBI(gain) ((gain) * 100)
  415. #define MBI_TO_DBI(gain) ((gain) / 100)
  416. #define DBM_TO_MBM(gain) ((gain) * 100)
  417. #define MBM_TO_DBM(gain) ((gain) / 100)
  418. #define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \
  419. .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \
  420. .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \
  421. .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \
  422. .power_rule.max_antenna_gain = DBI_TO_MBI(gain), \
  423. .power_rule.max_eirp = DBM_TO_MBM(eirp), \
  424. .flags = reg_flags, \
  425. }
  426. struct mesh_config {
  427. /* Timeouts in ms */
  428. /* Mesh plink management parameters */
  429. u16 dot11MeshRetryTimeout;
  430. u16 dot11MeshConfirmTimeout;
  431. u16 dot11MeshHoldingTimeout;
  432. u16 dot11MeshMaxPeerLinks;
  433. u8 dot11MeshMaxRetries;
  434. u8 dot11MeshTTL;
  435. bool auto_open_plinks;
  436. /* HWMP parameters */
  437. u8 dot11MeshHWMPmaxPREQretries;
  438. u32 path_refresh_time;
  439. u16 min_discovery_timeout;
  440. u32 dot11MeshHWMPactivePathTimeout;
  441. u16 dot11MeshHWMPpreqMinInterval;
  442. u16 dot11MeshHWMPnetDiameterTraversalTime;
  443. };
  444. /**
  445. * struct ieee80211_txq_params - TX queue parameters
  446. * @queue: TX queue identifier (NL80211_TXQ_Q_*)
  447. * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
  448. * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
  449. * 1..32767]
  450. * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
  451. * 1..32767]
  452. * @aifs: Arbitration interframe space [0..255]
  453. */
  454. struct ieee80211_txq_params {
  455. enum nl80211_txq_q queue;
  456. u16 txop;
  457. u16 cwmin;
  458. u16 cwmax;
  459. u8 aifs;
  460. };
  461. /**
  462. * struct mgmt_extra_ie_params - Extra management frame IE parameters
  463. *
  464. * Used to add extra IE(s) into management frames. If the driver cannot add the
  465. * requested data into all management frames of the specified subtype that are
  466. * generated in kernel or firmware/hardware, it must reject the configuration
  467. * call. The IE data buffer is added to the end of the specified management
  468. * frame body after all other IEs. This addition is not applied to frames that
  469. * are injected through a monitor interface.
  470. *
  471. * @subtype: Management frame subtype
  472. * @ies: IE data buffer or %NULL to remove previous data
  473. * @ies_len: Length of @ies in octets
  474. */
  475. struct mgmt_extra_ie_params {
  476. u8 subtype;
  477. u8 *ies;
  478. int ies_len;
  479. };
  480. /* from net/wireless.h */
  481. struct wiphy;
  482. /* from net/ieee80211.h */
  483. struct ieee80211_channel;
  484. /**
  485. * struct cfg80211_ssid - SSID description
  486. * @ssid: the SSID
  487. * @ssid_len: length of the ssid
  488. */
  489. struct cfg80211_ssid {
  490. u8 ssid[IEEE80211_MAX_SSID_LEN];
  491. u8 ssid_len;
  492. };
  493. /**
  494. * struct cfg80211_scan_request - scan request description
  495. *
  496. * @ssids: SSIDs to scan for (active scan only)
  497. * @n_ssids: number of SSIDs
  498. * @channels: channels to scan on.
  499. * @n_channels: number of channels for each band
  500. * @ie: optional information element(s) to add into Probe Request or %NULL
  501. * @ie_len: length of ie in octets
  502. * @wiphy: the wiphy this was for
  503. * @ifidx: the interface index
  504. */
  505. struct cfg80211_scan_request {
  506. struct cfg80211_ssid *ssids;
  507. int n_ssids;
  508. struct ieee80211_channel **channels;
  509. u32 n_channels;
  510. u8 *ie;
  511. size_t ie_len;
  512. /* internal */
  513. struct wiphy *wiphy;
  514. int ifidx;
  515. };
  516. /**
  517. * enum cfg80211_signal_type - signal type
  518. *
  519. * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
  520. * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
  521. * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
  522. */
  523. enum cfg80211_signal_type {
  524. CFG80211_SIGNAL_TYPE_NONE,
  525. CFG80211_SIGNAL_TYPE_MBM,
  526. CFG80211_SIGNAL_TYPE_UNSPEC,
  527. };
  528. /**
  529. * struct cfg80211_bss - BSS description
  530. *
  531. * This structure describes a BSS (which may also be a mesh network)
  532. * for use in scan results and similar.
  533. *
  534. * @bssid: BSSID of the BSS
  535. * @tsf: timestamp of last received update
  536. * @beacon_interval: the beacon interval as from the frame
  537. * @capability: the capability field in host byte order
  538. * @information_elements: the information elements (Note that there
  539. * is no guarantee that these are well-formed!)
  540. * @len_information_elements: total length of the information elements
  541. * @signal: signal strength value (type depends on the wiphy's signal_type)
  542. * @free_priv: function pointer to free private data
  543. * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
  544. */
  545. struct cfg80211_bss {
  546. struct ieee80211_channel *channel;
  547. u8 bssid[ETH_ALEN];
  548. u64 tsf;
  549. u16 beacon_interval;
  550. u16 capability;
  551. u8 *information_elements;
  552. size_t len_information_elements;
  553. s32 signal;
  554. void (*free_priv)(struct cfg80211_bss *bss);
  555. u8 priv[0] __attribute__((__aligned__(sizeof(void *))));
  556. };
  557. /**
  558. * struct cfg80211_ops - backend description for wireless configuration
  559. *
  560. * This struct is registered by fullmac card drivers and/or wireless stacks
  561. * in order to handle configuration requests on their interfaces.
  562. *
  563. * All callbacks except where otherwise noted should return 0
  564. * on success or a negative error code.
  565. *
  566. * All operations are currently invoked under rtnl for consistency with the
  567. * wireless extensions but this is subject to reevaluation as soon as this
  568. * code is used more widely and we have a first user without wext.
  569. *
  570. * @suspend: wiphy device needs to be suspended
  571. * @resume: wiphy device needs to be resumed
  572. *
  573. * @add_virtual_intf: create a new virtual interface with the given name,
  574. * must set the struct wireless_dev's iftype.
  575. *
  576. * @del_virtual_intf: remove the virtual interface determined by ifindex.
  577. *
  578. * @change_virtual_intf: change type/configuration of virtual interface,
  579. * keep the struct wireless_dev's iftype updated.
  580. *
  581. * @add_key: add a key with the given parameters. @mac_addr will be %NULL
  582. * when adding a group key.
  583. *
  584. * @get_key: get information about the key with the given parameters.
  585. * @mac_addr will be %NULL when requesting information for a group
  586. * key. All pointers given to the @callback function need not be valid
  587. * after it returns.
  588. *
  589. * @del_key: remove a key given the @mac_addr (%NULL for a group key)
  590. * and @key_index
  591. *
  592. * @set_default_key: set the default key on an interface
  593. *
  594. * @set_default_mgmt_key: set the default management frame key on an interface
  595. *
  596. * @add_beacon: Add a beacon with given parameters, @head, @interval
  597. * and @dtim_period will be valid, @tail is optional.
  598. * @set_beacon: Change the beacon parameters for an access point mode
  599. * interface. This should reject the call when no beacon has been
  600. * configured.
  601. * @del_beacon: Remove beacon configuration and stop sending the beacon.
  602. *
  603. * @add_station: Add a new station.
  604. *
  605. * @del_station: Remove a station; @mac may be NULL to remove all stations.
  606. *
  607. * @change_station: Modify a given station.
  608. *
  609. * @get_mesh_params: Put the current mesh parameters into *params
  610. *
  611. * @set_mesh_params: Set mesh parameters.
  612. * The mask is a bitfield which tells us which parameters to
  613. * set, and which to leave alone.
  614. *
  615. * @set_mesh_cfg: set mesh parameters (by now, just mesh id)
  616. *
  617. * @change_bss: Modify parameters for a given BSS.
  618. *
  619. * @set_txq_params: Set TX queue parameters
  620. *
  621. * @set_channel: Set channel
  622. *
  623. * @set_mgmt_extra_ie: Set extra IE data for management frames
  624. *
  625. * @scan: Request to do a scan. If returning zero, the scan request is given
  626. * the driver, and will be valid until passed to cfg80211_scan_done().
  627. * For scan results, call cfg80211_inform_bss(); you can call this outside
  628. * the scan/scan_done bracket too.
  629. */
  630. struct cfg80211_ops {
  631. int (*suspend)(struct wiphy *wiphy);
  632. int (*resume)(struct wiphy *wiphy);
  633. int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
  634. enum nl80211_iftype type, u32 *flags,
  635. struct vif_params *params);
  636. int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex);
  637. int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex,
  638. enum nl80211_iftype type, u32 *flags,
  639. struct vif_params *params);
  640. int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
  641. u8 key_index, u8 *mac_addr,
  642. struct key_params *params);
  643. int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
  644. u8 key_index, u8 *mac_addr, void *cookie,
  645. void (*callback)(void *cookie, struct key_params*));
  646. int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
  647. u8 key_index, u8 *mac_addr);
  648. int (*set_default_key)(struct wiphy *wiphy,
  649. struct net_device *netdev,
  650. u8 key_index);
  651. int (*set_default_mgmt_key)(struct wiphy *wiphy,
  652. struct net_device *netdev,
  653. u8 key_index);
  654. int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev,
  655. struct beacon_parameters *info);
  656. int (*set_beacon)(struct wiphy *wiphy, struct net_device *dev,
  657. struct beacon_parameters *info);
  658. int (*del_beacon)(struct wiphy *wiphy, struct net_device *dev);
  659. int (*add_station)(struct wiphy *wiphy, struct net_device *dev,
  660. u8 *mac, struct station_parameters *params);
  661. int (*del_station)(struct wiphy *wiphy, struct net_device *dev,
  662. u8 *mac);
  663. int (*change_station)(struct wiphy *wiphy, struct net_device *dev,
  664. u8 *mac, struct station_parameters *params);
  665. int (*get_station)(struct wiphy *wiphy, struct net_device *dev,
  666. u8 *mac, struct station_info *sinfo);
  667. int (*dump_station)(struct wiphy *wiphy, struct net_device *dev,
  668. int idx, u8 *mac, struct station_info *sinfo);
  669. int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
  670. u8 *dst, u8 *next_hop);
  671. int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
  672. u8 *dst);
  673. int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
  674. u8 *dst, u8 *next_hop);
  675. int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
  676. u8 *dst, u8 *next_hop,
  677. struct mpath_info *pinfo);
  678. int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
  679. int idx, u8 *dst, u8 *next_hop,
  680. struct mpath_info *pinfo);
  681. int (*get_mesh_params)(struct wiphy *wiphy,
  682. struct net_device *dev,
  683. struct mesh_config *conf);
  684. int (*set_mesh_params)(struct wiphy *wiphy,
  685. struct net_device *dev,
  686. const struct mesh_config *nconf, u32 mask);
  687. int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
  688. struct bss_parameters *params);
  689. int (*set_txq_params)(struct wiphy *wiphy,
  690. struct ieee80211_txq_params *params);
  691. int (*set_channel)(struct wiphy *wiphy,
  692. struct ieee80211_channel *chan,
  693. enum nl80211_channel_type channel_type);
  694. int (*set_mgmt_extra_ie)(struct wiphy *wiphy,
  695. struct net_device *dev,
  696. struct mgmt_extra_ie_params *params);
  697. int (*scan)(struct wiphy *wiphy, struct net_device *dev,
  698. struct cfg80211_scan_request *request);
  699. };
  700. /* temporary wext handlers */
  701. int cfg80211_wext_giwname(struct net_device *dev,
  702. struct iw_request_info *info,
  703. char *name, char *extra);
  704. int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
  705. u32 *mode, char *extra);
  706. int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info,
  707. u32 *mode, char *extra);
  708. int cfg80211_wext_siwscan(struct net_device *dev,
  709. struct iw_request_info *info,
  710. union iwreq_data *wrqu, char *extra);
  711. int cfg80211_wext_giwscan(struct net_device *dev,
  712. struct iw_request_info *info,
  713. struct iw_point *data, char *extra);
  714. int cfg80211_wext_giwrange(struct net_device *dev,
  715. struct iw_request_info *info,
  716. struct iw_point *data, char *extra);
  717. /**
  718. * cfg80211_scan_done - notify that scan finished
  719. *
  720. * @request: the corresponding scan request
  721. * @aborted: set to true if the scan was aborted for any reason,
  722. * userspace will be notified of that
  723. */
  724. void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
  725. /**
  726. * cfg80211_inform_bss - inform cfg80211 of a new BSS
  727. *
  728. * @wiphy: the wiphy reporting the BSS
  729. * @bss: the found BSS
  730. * @signal: the signal strength, type depends on the wiphy's signal_type
  731. * @gfp: context flags
  732. *
  733. * This informs cfg80211 that BSS information was found and
  734. * the BSS should be updated/added.
  735. */
  736. struct cfg80211_bss*
  737. cfg80211_inform_bss_frame(struct wiphy *wiphy,
  738. struct ieee80211_channel *channel,
  739. struct ieee80211_mgmt *mgmt, size_t len,
  740. s32 signal, gfp_t gfp);
  741. struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
  742. struct ieee80211_channel *channel,
  743. const u8 *bssid,
  744. const u8 *ssid, size_t ssid_len,
  745. u16 capa_mask, u16 capa_val);
  746. static inline struct cfg80211_bss *
  747. cfg80211_get_ibss(struct wiphy *wiphy,
  748. struct ieee80211_channel *channel,
  749. const u8 *ssid, size_t ssid_len)
  750. {
  751. return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
  752. WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS);
  753. }
  754. struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
  755. struct ieee80211_channel *channel,
  756. const u8 *meshid, size_t meshidlen,
  757. const u8 *meshcfg);
  758. void cfg80211_put_bss(struct cfg80211_bss *bss);
  759. /**
  760. * cfg80211_unlink_bss - unlink BSS from internal data structures
  761. * @wiphy: the wiphy
  762. * @bss: the bss to remove
  763. *
  764. * This function removes the given BSS from the internal data structures
  765. * thereby making it no longer show up in scan results etc. Use this
  766. * function when you detect a BSS is gone. Normally BSSes will also time
  767. * out, so it is not necessary to use this function at all.
  768. */
  769. void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
  770. #endif /* __NET_CFG80211_H */