cfg80211.h 62 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914
  1. #ifndef __NET_CFG80211_H
  2. #define __NET_CFG80211_H
  3. /*
  4. * 802.11 device and configuration interface
  5. *
  6. * Copyright 2006-2009 Johannes Berg <johannes@sipsolutions.net>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <linux/netdevice.h>
  13. #include <linux/debugfs.h>
  14. #include <linux/list.h>
  15. #include <linux/netlink.h>
  16. #include <linux/skbuff.h>
  17. #include <linux/nl80211.h>
  18. #include <linux/if_ether.h>
  19. #include <linux/ieee80211.h>
  20. #include <net/regulatory.h>
  21. /* remove once we remove the wext stuff */
  22. #include <net/iw_handler.h>
  23. #include <linux/wireless.h>
  24. /*
  25. * wireless hardware capability structures
  26. */
  27. /**
  28. * enum ieee80211_band - supported frequency bands
  29. *
  30. * The bands are assigned this way because the supported
  31. * bitrates differ in these bands.
  32. *
  33. * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
  34. * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
  35. */
  36. enum ieee80211_band {
  37. IEEE80211_BAND_2GHZ,
  38. IEEE80211_BAND_5GHZ,
  39. /* keep last */
  40. IEEE80211_NUM_BANDS
  41. };
  42. /**
  43. * enum ieee80211_channel_flags - channel flags
  44. *
  45. * Channel flags set by the regulatory control code.
  46. *
  47. * @IEEE80211_CHAN_DISABLED: This channel is disabled.
  48. * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted
  49. * on this channel.
  50. * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel.
  51. * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
  52. * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
  53. * is not permitted.
  54. * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
  55. * is not permitted.
  56. */
  57. enum ieee80211_channel_flags {
  58. IEEE80211_CHAN_DISABLED = 1<<0,
  59. IEEE80211_CHAN_PASSIVE_SCAN = 1<<1,
  60. IEEE80211_CHAN_NO_IBSS = 1<<2,
  61. IEEE80211_CHAN_RADAR = 1<<3,
  62. IEEE80211_CHAN_NO_HT40PLUS = 1<<4,
  63. IEEE80211_CHAN_NO_HT40MINUS = 1<<5,
  64. };
  65. #define IEEE80211_CHAN_NO_HT40 \
  66. (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
  67. /**
  68. * struct ieee80211_channel - channel definition
  69. *
  70. * This structure describes a single channel for use
  71. * with cfg80211.
  72. *
  73. * @center_freq: center frequency in MHz
  74. * @max_bandwidth: maximum allowed bandwidth for this channel, in MHz
  75. * @hw_value: hardware-specific value for the channel
  76. * @flags: channel flags from &enum ieee80211_channel_flags.
  77. * @orig_flags: channel flags at registration time, used by regulatory
  78. * code to support devices with additional restrictions
  79. * @band: band this channel belongs to.
  80. * @max_antenna_gain: maximum antenna gain in dBi
  81. * @max_power: maximum transmission power (in dBm)
  82. * @beacon_found: helper to regulatory code to indicate when a beacon
  83. * has been found on this channel. Use regulatory_hint_found_beacon()
  84. * to enable this, this is is useful only on 5 GHz band.
  85. * @orig_mag: internal use
  86. * @orig_mpwr: internal use
  87. */
  88. struct ieee80211_channel {
  89. enum ieee80211_band band;
  90. u16 center_freq;
  91. u8 max_bandwidth;
  92. u16 hw_value;
  93. u32 flags;
  94. int max_antenna_gain;
  95. int max_power;
  96. bool beacon_found;
  97. u32 orig_flags;
  98. int orig_mag, orig_mpwr;
  99. };
  100. /**
  101. * enum ieee80211_rate_flags - rate flags
  102. *
  103. * Hardware/specification flags for rates. These are structured
  104. * in a way that allows using the same bitrate structure for
  105. * different bands/PHY modes.
  106. *
  107. * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
  108. * preamble on this bitrate; only relevant in 2.4GHz band and
  109. * with CCK rates.
  110. * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
  111. * when used with 802.11a (on the 5 GHz band); filled by the
  112. * core code when registering the wiphy.
  113. * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
  114. * when used with 802.11b (on the 2.4 GHz band); filled by the
  115. * core code when registering the wiphy.
  116. * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
  117. * when used with 802.11g (on the 2.4 GHz band); filled by the
  118. * core code when registering the wiphy.
  119. * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
  120. */
  121. enum ieee80211_rate_flags {
  122. IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
  123. IEEE80211_RATE_MANDATORY_A = 1<<1,
  124. IEEE80211_RATE_MANDATORY_B = 1<<2,
  125. IEEE80211_RATE_MANDATORY_G = 1<<3,
  126. IEEE80211_RATE_ERP_G = 1<<4,
  127. };
  128. /**
  129. * struct ieee80211_rate - bitrate definition
  130. *
  131. * This structure describes a bitrate that an 802.11 PHY can
  132. * operate with. The two values @hw_value and @hw_value_short
  133. * are only for driver use when pointers to this structure are
  134. * passed around.
  135. *
  136. * @flags: rate-specific flags
  137. * @bitrate: bitrate in units of 100 Kbps
  138. * @hw_value: driver/hardware value for this rate
  139. * @hw_value_short: driver/hardware value for this rate when
  140. * short preamble is used
  141. */
  142. struct ieee80211_rate {
  143. u32 flags;
  144. u16 bitrate;
  145. u16 hw_value, hw_value_short;
  146. };
  147. /**
  148. * struct ieee80211_sta_ht_cap - STA's HT capabilities
  149. *
  150. * This structure describes most essential parameters needed
  151. * to describe 802.11n HT capabilities for an STA.
  152. *
  153. * @ht_supported: is HT supported by the STA
  154. * @cap: HT capabilities map as described in 802.11n spec
  155. * @ampdu_factor: Maximum A-MPDU length factor
  156. * @ampdu_density: Minimum A-MPDU spacing
  157. * @mcs: Supported MCS rates
  158. */
  159. struct ieee80211_sta_ht_cap {
  160. u16 cap; /* use IEEE80211_HT_CAP_ */
  161. bool ht_supported;
  162. u8 ampdu_factor;
  163. u8 ampdu_density;
  164. struct ieee80211_mcs_info mcs;
  165. };
  166. /**
  167. * struct ieee80211_supported_band - frequency band definition
  168. *
  169. * This structure describes a frequency band a wiphy
  170. * is able to operate in.
  171. *
  172. * @channels: Array of channels the hardware can operate in
  173. * in this band.
  174. * @band: the band this structure represents
  175. * @n_channels: Number of channels in @channels
  176. * @bitrates: Array of bitrates the hardware can operate with
  177. * in this band. Must be sorted to give a valid "supported
  178. * rates" IE, i.e. CCK rates first, then OFDM.
  179. * @n_bitrates: Number of bitrates in @bitrates
  180. */
  181. struct ieee80211_supported_band {
  182. struct ieee80211_channel *channels;
  183. struct ieee80211_rate *bitrates;
  184. enum ieee80211_band band;
  185. int n_channels;
  186. int n_bitrates;
  187. struct ieee80211_sta_ht_cap ht_cap;
  188. };
  189. /*
  190. * Wireless hardware/device configuration structures and methods
  191. */
  192. /**
  193. * struct vif_params - describes virtual interface parameters
  194. * @mesh_id: mesh ID to use
  195. * @mesh_id_len: length of the mesh ID
  196. */
  197. struct vif_params {
  198. u8 *mesh_id;
  199. int mesh_id_len;
  200. };
  201. /**
  202. * struct key_params - key information
  203. *
  204. * Information about a key
  205. *
  206. * @key: key material
  207. * @key_len: length of key material
  208. * @cipher: cipher suite selector
  209. * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
  210. * with the get_key() callback, must be in little endian,
  211. * length given by @seq_len.
  212. */
  213. struct key_params {
  214. u8 *key;
  215. u8 *seq;
  216. int key_len;
  217. int seq_len;
  218. u32 cipher;
  219. };
  220. /**
  221. * struct beacon_parameters - beacon parameters
  222. *
  223. * Used to configure the beacon for an interface.
  224. *
  225. * @head: head portion of beacon (before TIM IE)
  226. * or %NULL if not changed
  227. * @tail: tail portion of beacon (after TIM IE)
  228. * or %NULL if not changed
  229. * @interval: beacon interval or zero if not changed
  230. * @dtim_period: DTIM period or zero if not changed
  231. * @head_len: length of @head
  232. * @tail_len: length of @tail
  233. */
  234. struct beacon_parameters {
  235. u8 *head, *tail;
  236. int interval, dtim_period;
  237. int head_len, tail_len;
  238. };
  239. /**
  240. * enum plink_action - actions to perform in mesh peers
  241. *
  242. * @PLINK_ACTION_INVALID: action 0 is reserved
  243. * @PLINK_ACTION_OPEN: start mesh peer link establishment
  244. * @PLINK_ACTION_BLOCL: block traffic from this mesh peer
  245. */
  246. enum plink_actions {
  247. PLINK_ACTION_INVALID,
  248. PLINK_ACTION_OPEN,
  249. PLINK_ACTION_BLOCK,
  250. };
  251. /**
  252. * struct station_parameters - station parameters
  253. *
  254. * Used to change and create a new station.
  255. *
  256. * @vlan: vlan interface station should belong to
  257. * @supported_rates: supported rates in IEEE 802.11 format
  258. * (or NULL for no change)
  259. * @supported_rates_len: number of supported rates
  260. * @sta_flags_mask: station flags that changed
  261. * (bitmask of BIT(NL80211_STA_FLAG_...))
  262. * @sta_flags_set: station flags values
  263. * (bitmask of BIT(NL80211_STA_FLAG_...))
  264. * @listen_interval: listen interval or -1 for no change
  265. * @aid: AID or zero for no change
  266. */
  267. struct station_parameters {
  268. u8 *supported_rates;
  269. struct net_device *vlan;
  270. u32 sta_flags_mask, sta_flags_set;
  271. int listen_interval;
  272. u16 aid;
  273. u8 supported_rates_len;
  274. u8 plink_action;
  275. struct ieee80211_ht_cap *ht_capa;
  276. };
  277. /**
  278. * enum station_info_flags - station information flags
  279. *
  280. * Used by the driver to indicate which info in &struct station_info
  281. * it has filled in during get_station() or dump_station().
  282. *
  283. * @STATION_INFO_INACTIVE_TIME: @inactive_time filled
  284. * @STATION_INFO_RX_BYTES: @rx_bytes filled
  285. * @STATION_INFO_TX_BYTES: @tx_bytes filled
  286. * @STATION_INFO_LLID: @llid filled
  287. * @STATION_INFO_PLID: @plid filled
  288. * @STATION_INFO_PLINK_STATE: @plink_state filled
  289. * @STATION_INFO_SIGNAL: @signal filled
  290. * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled
  291. * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs)
  292. * @STATION_INFO_RX_PACKETS: @rx_packets filled
  293. * @STATION_INFO_TX_PACKETS: @tx_packets filled
  294. */
  295. enum station_info_flags {
  296. STATION_INFO_INACTIVE_TIME = 1<<0,
  297. STATION_INFO_RX_BYTES = 1<<1,
  298. STATION_INFO_TX_BYTES = 1<<2,
  299. STATION_INFO_LLID = 1<<3,
  300. STATION_INFO_PLID = 1<<4,
  301. STATION_INFO_PLINK_STATE = 1<<5,
  302. STATION_INFO_SIGNAL = 1<<6,
  303. STATION_INFO_TX_BITRATE = 1<<7,
  304. STATION_INFO_RX_PACKETS = 1<<8,
  305. STATION_INFO_TX_PACKETS = 1<<9,
  306. };
  307. /**
  308. * enum station_info_rate_flags - bitrate info flags
  309. *
  310. * Used by the driver to indicate the specific rate transmission
  311. * type for 802.11n transmissions.
  312. *
  313. * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled
  314. * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission
  315. * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
  316. */
  317. enum rate_info_flags {
  318. RATE_INFO_FLAGS_MCS = 1<<0,
  319. RATE_INFO_FLAGS_40_MHZ_WIDTH = 1<<1,
  320. RATE_INFO_FLAGS_SHORT_GI = 1<<2,
  321. };
  322. /**
  323. * struct rate_info - bitrate information
  324. *
  325. * Information about a receiving or transmitting bitrate
  326. *
  327. * @flags: bitflag of flags from &enum rate_info_flags
  328. * @mcs: mcs index if struct describes a 802.11n bitrate
  329. * @legacy: bitrate in 100kbit/s for 802.11abg
  330. */
  331. struct rate_info {
  332. u8 flags;
  333. u8 mcs;
  334. u16 legacy;
  335. };
  336. /**
  337. * struct station_info - station information
  338. *
  339. * Station information filled by driver for get_station() and dump_station.
  340. *
  341. * @filled: bitflag of flags from &enum station_info_flags
  342. * @inactive_time: time since last station activity (tx/rx) in milliseconds
  343. * @rx_bytes: bytes received from this station
  344. * @tx_bytes: bytes transmitted to this station
  345. * @llid: mesh local link id
  346. * @plid: mesh peer link id
  347. * @plink_state: mesh peer link state
  348. * @signal: signal strength of last received packet in dBm
  349. * @txrate: current unicast bitrate to this station
  350. * @rx_packets: packets received from this station
  351. * @tx_packets: packets transmitted to this station
  352. */
  353. struct station_info {
  354. u32 filled;
  355. u32 inactive_time;
  356. u32 rx_bytes;
  357. u32 tx_bytes;
  358. u16 llid;
  359. u16 plid;
  360. u8 plink_state;
  361. s8 signal;
  362. struct rate_info txrate;
  363. u32 rx_packets;
  364. u32 tx_packets;
  365. };
  366. /**
  367. * enum monitor_flags - monitor flags
  368. *
  369. * Monitor interface configuration flags. Note that these must be the bits
  370. * according to the nl80211 flags.
  371. *
  372. * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
  373. * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
  374. * @MONITOR_FLAG_CONTROL: pass control frames
  375. * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
  376. * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
  377. */
  378. enum monitor_flags {
  379. MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL,
  380. MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL,
  381. MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL,
  382. MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS,
  383. MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
  384. };
  385. /**
  386. * enum mpath_info_flags - mesh path information flags
  387. *
  388. * Used by the driver to indicate which info in &struct mpath_info it has filled
  389. * in during get_station() or dump_station().
  390. *
  391. * MPATH_INFO_FRAME_QLEN: @frame_qlen filled
  392. * MPATH_INFO_DSN: @dsn filled
  393. * MPATH_INFO_METRIC: @metric filled
  394. * MPATH_INFO_EXPTIME: @exptime filled
  395. * MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
  396. * MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
  397. * MPATH_INFO_FLAGS: @flags filled
  398. */
  399. enum mpath_info_flags {
  400. MPATH_INFO_FRAME_QLEN = BIT(0),
  401. MPATH_INFO_DSN = BIT(1),
  402. MPATH_INFO_METRIC = BIT(2),
  403. MPATH_INFO_EXPTIME = BIT(3),
  404. MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4),
  405. MPATH_INFO_DISCOVERY_RETRIES = BIT(5),
  406. MPATH_INFO_FLAGS = BIT(6),
  407. };
  408. /**
  409. * struct mpath_info - mesh path information
  410. *
  411. * Mesh path information filled by driver for get_mpath() and dump_mpath().
  412. *
  413. * @filled: bitfield of flags from &enum mpath_info_flags
  414. * @frame_qlen: number of queued frames for this destination
  415. * @dsn: destination sequence number
  416. * @metric: metric (cost) of this mesh path
  417. * @exptime: expiration time for the mesh path from now, in msecs
  418. * @flags: mesh path flags
  419. * @discovery_timeout: total mesh path discovery timeout, in msecs
  420. * @discovery_retries: mesh path discovery retries
  421. */
  422. struct mpath_info {
  423. u32 filled;
  424. u32 frame_qlen;
  425. u32 dsn;
  426. u32 metric;
  427. u32 exptime;
  428. u32 discovery_timeout;
  429. u8 discovery_retries;
  430. u8 flags;
  431. };
  432. /**
  433. * struct bss_parameters - BSS parameters
  434. *
  435. * Used to change BSS parameters (mainly for AP mode).
  436. *
  437. * @use_cts_prot: Whether to use CTS protection
  438. * (0 = no, 1 = yes, -1 = do not change)
  439. * @use_short_preamble: Whether the use of short preambles is allowed
  440. * (0 = no, 1 = yes, -1 = do not change)
  441. * @use_short_slot_time: Whether the use of short slot time is allowed
  442. * (0 = no, 1 = yes, -1 = do not change)
  443. * @basic_rates: basic rates in IEEE 802.11 format
  444. * (or NULL for no change)
  445. * @basic_rates_len: number of basic rates
  446. */
  447. struct bss_parameters {
  448. int use_cts_prot;
  449. int use_short_preamble;
  450. int use_short_slot_time;
  451. u8 *basic_rates;
  452. u8 basic_rates_len;
  453. };
  454. struct mesh_config {
  455. /* Timeouts in ms */
  456. /* Mesh plink management parameters */
  457. u16 dot11MeshRetryTimeout;
  458. u16 dot11MeshConfirmTimeout;
  459. u16 dot11MeshHoldingTimeout;
  460. u16 dot11MeshMaxPeerLinks;
  461. u8 dot11MeshMaxRetries;
  462. u8 dot11MeshTTL;
  463. bool auto_open_plinks;
  464. /* HWMP parameters */
  465. u8 dot11MeshHWMPmaxPREQretries;
  466. u32 path_refresh_time;
  467. u16 min_discovery_timeout;
  468. u32 dot11MeshHWMPactivePathTimeout;
  469. u16 dot11MeshHWMPpreqMinInterval;
  470. u16 dot11MeshHWMPnetDiameterTraversalTime;
  471. };
  472. /**
  473. * struct ieee80211_txq_params - TX queue parameters
  474. * @queue: TX queue identifier (NL80211_TXQ_Q_*)
  475. * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
  476. * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
  477. * 1..32767]
  478. * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
  479. * 1..32767]
  480. * @aifs: Arbitration interframe space [0..255]
  481. */
  482. struct ieee80211_txq_params {
  483. enum nl80211_txq_q queue;
  484. u16 txop;
  485. u16 cwmin;
  486. u16 cwmax;
  487. u8 aifs;
  488. };
  489. /* from net/wireless.h */
  490. struct wiphy;
  491. /* from net/ieee80211.h */
  492. struct ieee80211_channel;
  493. /**
  494. * struct cfg80211_ssid - SSID description
  495. * @ssid: the SSID
  496. * @ssid_len: length of the ssid
  497. */
  498. struct cfg80211_ssid {
  499. u8 ssid[IEEE80211_MAX_SSID_LEN];
  500. u8 ssid_len;
  501. };
  502. /**
  503. * struct cfg80211_scan_request - scan request description
  504. *
  505. * @ssids: SSIDs to scan for (active scan only)
  506. * @n_ssids: number of SSIDs
  507. * @channels: channels to scan on.
  508. * @n_channels: number of channels for each band
  509. * @ie: optional information element(s) to add into Probe Request or %NULL
  510. * @ie_len: length of ie in octets
  511. * @wiphy: the wiphy this was for
  512. * @ifidx: the interface index
  513. */
  514. struct cfg80211_scan_request {
  515. struct cfg80211_ssid *ssids;
  516. int n_ssids;
  517. struct ieee80211_channel **channels;
  518. u32 n_channels;
  519. const u8 *ie;
  520. size_t ie_len;
  521. /* internal */
  522. struct wiphy *wiphy;
  523. int ifidx;
  524. };
  525. /**
  526. * enum cfg80211_signal_type - signal type
  527. *
  528. * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
  529. * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
  530. * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
  531. */
  532. enum cfg80211_signal_type {
  533. CFG80211_SIGNAL_TYPE_NONE,
  534. CFG80211_SIGNAL_TYPE_MBM,
  535. CFG80211_SIGNAL_TYPE_UNSPEC,
  536. };
  537. /**
  538. * struct cfg80211_bss - BSS description
  539. *
  540. * This structure describes a BSS (which may also be a mesh network)
  541. * for use in scan results and similar.
  542. *
  543. * @bssid: BSSID of the BSS
  544. * @tsf: timestamp of last received update
  545. * @beacon_interval: the beacon interval as from the frame
  546. * @capability: the capability field in host byte order
  547. * @information_elements: the information elements (Note that there
  548. * is no guarantee that these are well-formed!)
  549. * @len_information_elements: total length of the information elements
  550. * @signal: signal strength value (type depends on the wiphy's signal_type)
  551. * @hold: BSS should not expire
  552. * @free_priv: function pointer to free private data
  553. * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
  554. */
  555. struct cfg80211_bss {
  556. struct ieee80211_channel *channel;
  557. u8 bssid[ETH_ALEN];
  558. u64 tsf;
  559. u16 beacon_interval;
  560. u16 capability;
  561. u8 *information_elements;
  562. size_t len_information_elements;
  563. s32 signal;
  564. void (*free_priv)(struct cfg80211_bss *bss);
  565. u8 priv[0] __attribute__((__aligned__(sizeof(void *))));
  566. };
  567. /**
  568. * struct cfg80211_crypto_settings - Crypto settings
  569. * @wpa_versions: indicates which, if any, WPA versions are enabled
  570. * (from enum nl80211_wpa_versions)
  571. * @cipher_group: group key cipher suite (or 0 if unset)
  572. * @n_ciphers_pairwise: number of AP supported unicast ciphers
  573. * @ciphers_pairwise: unicast key cipher suites
  574. * @n_akm_suites: number of AKM suites
  575. * @akm_suites: AKM suites
  576. * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
  577. * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
  578. * required to assume that the port is unauthorized until authorized by
  579. * user space. Otherwise, port is marked authorized by default.
  580. */
  581. struct cfg80211_crypto_settings {
  582. u32 wpa_versions;
  583. u32 cipher_group;
  584. int n_ciphers_pairwise;
  585. u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
  586. int n_akm_suites;
  587. u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
  588. bool control_port;
  589. };
  590. /**
  591. * struct cfg80211_auth_request - Authentication request data
  592. *
  593. * This structure provides information needed to complete IEEE 802.11
  594. * authentication.
  595. * NOTE: This structure will likely change when more code from mac80211 is
  596. * moved into cfg80211 so that non-mac80211 drivers can benefit from it, too.
  597. * Before using this in a driver that does not use mac80211, it would be better
  598. * to check the status of that work and better yet, volunteer to work on it.
  599. *
  600. * @chan: The channel to use or %NULL if not specified (auto-select based on
  601. * scan results)
  602. * @peer_addr: The address of the peer STA (AP BSSID in infrastructure case);
  603. * this field is required to be present; if the driver wants to help with
  604. * BSS selection, it should use (yet to be added) MLME event to allow user
  605. * space SME to be notified of roaming candidate, so that the SME can then
  606. * use the authentication request with the recommended BSSID and whatever
  607. * other data may be needed for authentication/association
  608. * @ssid: SSID or %NULL if not yet available
  609. * @ssid_len: Length of ssid in octets
  610. * @auth_type: Authentication type (algorithm)
  611. * @ie: Extra IEs to add to Authentication frame or %NULL
  612. * @ie_len: Length of ie buffer in octets
  613. */
  614. struct cfg80211_auth_request {
  615. struct ieee80211_channel *chan;
  616. u8 *peer_addr;
  617. const u8 *ssid;
  618. size_t ssid_len;
  619. enum nl80211_auth_type auth_type;
  620. const u8 *ie;
  621. size_t ie_len;
  622. };
  623. /**
  624. * struct cfg80211_assoc_request - (Re)Association request data
  625. *
  626. * This structure provides information needed to complete IEEE 802.11
  627. * (re)association.
  628. * NOTE: This structure will likely change when more code from mac80211 is
  629. * moved into cfg80211 so that non-mac80211 drivers can benefit from it, too.
  630. * Before using this in a driver that does not use mac80211, it would be better
  631. * to check the status of that work and better yet, volunteer to work on it.
  632. *
  633. * @chan: The channel to use or %NULL if not specified (auto-select based on
  634. * scan results)
  635. * @peer_addr: The address of the peer STA (AP BSSID); this field is required
  636. * to be present and the STA must be in State 2 (authenticated) with the
  637. * peer STA
  638. * @ssid: SSID
  639. * @ssid_len: Length of ssid in octets
  640. * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
  641. * @ie_len: Length of ie buffer in octets
  642. * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
  643. * @crypto: crypto settings
  644. */
  645. struct cfg80211_assoc_request {
  646. struct ieee80211_channel *chan;
  647. u8 *peer_addr;
  648. const u8 *ssid;
  649. size_t ssid_len;
  650. const u8 *ie;
  651. size_t ie_len;
  652. bool use_mfp;
  653. struct cfg80211_crypto_settings crypto;
  654. };
  655. /**
  656. * struct cfg80211_deauth_request - Deauthentication request data
  657. *
  658. * This structure provides information needed to complete IEEE 802.11
  659. * deauthentication.
  660. *
  661. * @peer_addr: The address of the peer STA (AP BSSID); this field is required
  662. * to be present and the STA must be authenticated with the peer STA
  663. * @ie: Extra IEs to add to Deauthentication frame or %NULL
  664. * @ie_len: Length of ie buffer in octets
  665. */
  666. struct cfg80211_deauth_request {
  667. u8 *peer_addr;
  668. u16 reason_code;
  669. const u8 *ie;
  670. size_t ie_len;
  671. };
  672. /**
  673. * struct cfg80211_disassoc_request - Disassociation request data
  674. *
  675. * This structure provides information needed to complete IEEE 802.11
  676. * disassocation.
  677. *
  678. * @peer_addr: The address of the peer STA (AP BSSID); this field is required
  679. * to be present and the STA must be associated with the peer STA
  680. * @ie: Extra IEs to add to Disassociation frame or %NULL
  681. * @ie_len: Length of ie buffer in octets
  682. */
  683. struct cfg80211_disassoc_request {
  684. u8 *peer_addr;
  685. u16 reason_code;
  686. const u8 *ie;
  687. size_t ie_len;
  688. };
  689. /**
  690. * struct cfg80211_ibss_params - IBSS parameters
  691. *
  692. * This structure defines the IBSS parameters for the join_ibss()
  693. * method.
  694. *
  695. * @ssid: The SSID, will always be non-null.
  696. * @ssid_len: The length of the SSID, will always be non-zero.
  697. * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
  698. * search for IBSSs with a different BSSID.
  699. * @channel: The channel to use if no IBSS can be found to join.
  700. * @channel_fixed: The channel should be fixed -- do not search for
  701. * IBSSs to join on other channels.
  702. * @ie: information element(s) to include in the beacon
  703. * @ie_len: length of that
  704. * @beacon_interval: beacon interval to use
  705. */
  706. struct cfg80211_ibss_params {
  707. u8 *ssid;
  708. u8 *bssid;
  709. struct ieee80211_channel *channel;
  710. u8 *ie;
  711. u8 ssid_len, ie_len;
  712. u16 beacon_interval;
  713. bool channel_fixed;
  714. };
  715. /**
  716. * struct cfg80211_connect_params - Connection parameters
  717. *
  718. * This structure provides information needed to complete IEEE 802.11
  719. * authentication and association.
  720. *
  721. * @channel: The channel to use or %NULL if not specified (auto-select based
  722. * on scan results)
  723. * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
  724. * results)
  725. * @ssid: SSID
  726. * @ssid_len: Length of ssid in octets
  727. * @auth_type: Authentication type (algorithm)
  728. * @assoc_ie: IEs for association request
  729. * @assoc_ie_len: Length of assoc_ie in octets
  730. * @privacy: indicates whether privacy-enabled APs should be used
  731. * @crypto: crypto settings
  732. */
  733. struct cfg80211_connect_params {
  734. struct ieee80211_channel *channel;
  735. u8 *bssid;
  736. u8 *ssid;
  737. size_t ssid_len;
  738. enum nl80211_auth_type auth_type;
  739. u8 *ie;
  740. size_t ie_len;
  741. bool privacy;
  742. struct cfg80211_crypto_settings crypto;
  743. };
  744. /**
  745. * enum wiphy_params_flags - set_wiphy_params bitfield values
  746. * WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
  747. * WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
  748. * WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
  749. * WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
  750. */
  751. enum wiphy_params_flags {
  752. WIPHY_PARAM_RETRY_SHORT = 1 << 0,
  753. WIPHY_PARAM_RETRY_LONG = 1 << 1,
  754. WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2,
  755. WIPHY_PARAM_RTS_THRESHOLD = 1 << 3,
  756. };
  757. /**
  758. * enum tx_power_setting - TX power adjustment
  759. *
  760. * @TX_POWER_AUTOMATIC: the dbm parameter is ignored
  761. * @TX_POWER_LIMITED: limit TX power by the dbm parameter
  762. * @TX_POWER_FIXED: fix TX power to the dbm parameter
  763. */
  764. enum tx_power_setting {
  765. TX_POWER_AUTOMATIC,
  766. TX_POWER_LIMITED,
  767. TX_POWER_FIXED,
  768. };
  769. /**
  770. * struct cfg80211_ops - backend description for wireless configuration
  771. *
  772. * This struct is registered by fullmac card drivers and/or wireless stacks
  773. * in order to handle configuration requests on their interfaces.
  774. *
  775. * All callbacks except where otherwise noted should return 0
  776. * on success or a negative error code.
  777. *
  778. * All operations are currently invoked under rtnl for consistency with the
  779. * wireless extensions but this is subject to reevaluation as soon as this
  780. * code is used more widely and we have a first user without wext.
  781. *
  782. * @suspend: wiphy device needs to be suspended
  783. * @resume: wiphy device needs to be resumed
  784. *
  785. * @add_virtual_intf: create a new virtual interface with the given name,
  786. * must set the struct wireless_dev's iftype.
  787. *
  788. * @del_virtual_intf: remove the virtual interface determined by ifindex.
  789. *
  790. * @change_virtual_intf: change type/configuration of virtual interface,
  791. * keep the struct wireless_dev's iftype updated.
  792. *
  793. * @add_key: add a key with the given parameters. @mac_addr will be %NULL
  794. * when adding a group key.
  795. *
  796. * @get_key: get information about the key with the given parameters.
  797. * @mac_addr will be %NULL when requesting information for a group
  798. * key. All pointers given to the @callback function need not be valid
  799. * after it returns. This function should return an error if it is
  800. * not possible to retrieve the key, -ENOENT if it doesn't exist.
  801. *
  802. * @del_key: remove a key given the @mac_addr (%NULL for a group key)
  803. * and @key_index, return -ENOENT if the key doesn't exist.
  804. *
  805. * @set_default_key: set the default key on an interface
  806. *
  807. * @set_default_mgmt_key: set the default management frame key on an interface
  808. *
  809. * @add_beacon: Add a beacon with given parameters, @head, @interval
  810. * and @dtim_period will be valid, @tail is optional.
  811. * @set_beacon: Change the beacon parameters for an access point mode
  812. * interface. This should reject the call when no beacon has been
  813. * configured.
  814. * @del_beacon: Remove beacon configuration and stop sending the beacon.
  815. *
  816. * @add_station: Add a new station.
  817. *
  818. * @del_station: Remove a station; @mac may be NULL to remove all stations.
  819. *
  820. * @change_station: Modify a given station.
  821. *
  822. * @get_mesh_params: Put the current mesh parameters into *params
  823. *
  824. * @set_mesh_params: Set mesh parameters.
  825. * The mask is a bitfield which tells us which parameters to
  826. * set, and which to leave alone.
  827. *
  828. * @set_mesh_cfg: set mesh parameters (by now, just mesh id)
  829. *
  830. * @change_bss: Modify parameters for a given BSS.
  831. *
  832. * @set_txq_params: Set TX queue parameters
  833. *
  834. * @set_channel: Set channel
  835. *
  836. * @scan: Request to do a scan. If returning zero, the scan request is given
  837. * the driver, and will be valid until passed to cfg80211_scan_done().
  838. * For scan results, call cfg80211_inform_bss(); you can call this outside
  839. * the scan/scan_done bracket too.
  840. *
  841. * @auth: Request to authenticate with the specified peer
  842. * @assoc: Request to (re)associate with the specified peer
  843. * @deauth: Request to deauthenticate from the specified peer
  844. * @disassoc: Request to disassociate from the specified peer
  845. *
  846. * @connect: Connect to the ESS with the specified parameters. When connected,
  847. * call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS.
  848. * If the connection fails for some reason, call cfg80211_connect_result()
  849. * with the status from the AP.
  850. * @disconnect: Disconnect from the BSS/ESS.
  851. *
  852. * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
  853. * cfg80211_ibss_joined(), also call that function when changing BSSID due
  854. * to a merge.
  855. * @leave_ibss: Leave the IBSS.
  856. *
  857. * @set_wiphy_params: Notify that wiphy parameters have changed;
  858. * @changed bitfield (see &enum wiphy_params_flags) describes which values
  859. * have changed. The actual parameter values are available in
  860. * struct wiphy. If returning an error, no value should be changed.
  861. *
  862. * @set_tx_power: set the transmit power according to the parameters
  863. * @get_tx_power: store the current TX power into the dbm variable;
  864. * return 0 if successful
  865. *
  866. * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
  867. * functions to adjust rfkill hw state
  868. *
  869. * @testmode_cmd: run a test mode command
  870. */
  871. struct cfg80211_ops {
  872. int (*suspend)(struct wiphy *wiphy);
  873. int (*resume)(struct wiphy *wiphy);
  874. int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
  875. enum nl80211_iftype type, u32 *flags,
  876. struct vif_params *params);
  877. int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex);
  878. int (*change_virtual_intf)(struct wiphy *wiphy,
  879. struct net_device *dev,
  880. enum nl80211_iftype type, u32 *flags,
  881. struct vif_params *params);
  882. int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
  883. u8 key_index, const u8 *mac_addr,
  884. struct key_params *params);
  885. int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
  886. u8 key_index, const u8 *mac_addr, void *cookie,
  887. void (*callback)(void *cookie, struct key_params*));
  888. int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
  889. u8 key_index, const u8 *mac_addr);
  890. int (*set_default_key)(struct wiphy *wiphy,
  891. struct net_device *netdev,
  892. u8 key_index);
  893. int (*set_default_mgmt_key)(struct wiphy *wiphy,
  894. struct net_device *netdev,
  895. u8 key_index);
  896. int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev,
  897. struct beacon_parameters *info);
  898. int (*set_beacon)(struct wiphy *wiphy, struct net_device *dev,
  899. struct beacon_parameters *info);
  900. int (*del_beacon)(struct wiphy *wiphy, struct net_device *dev);
  901. int (*add_station)(struct wiphy *wiphy, struct net_device *dev,
  902. u8 *mac, struct station_parameters *params);
  903. int (*del_station)(struct wiphy *wiphy, struct net_device *dev,
  904. u8 *mac);
  905. int (*change_station)(struct wiphy *wiphy, struct net_device *dev,
  906. u8 *mac, struct station_parameters *params);
  907. int (*get_station)(struct wiphy *wiphy, struct net_device *dev,
  908. u8 *mac, struct station_info *sinfo);
  909. int (*dump_station)(struct wiphy *wiphy, struct net_device *dev,
  910. int idx, u8 *mac, struct station_info *sinfo);
  911. int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
  912. u8 *dst, u8 *next_hop);
  913. int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
  914. u8 *dst);
  915. int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
  916. u8 *dst, u8 *next_hop);
  917. int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
  918. u8 *dst, u8 *next_hop,
  919. struct mpath_info *pinfo);
  920. int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
  921. int idx, u8 *dst, u8 *next_hop,
  922. struct mpath_info *pinfo);
  923. int (*get_mesh_params)(struct wiphy *wiphy,
  924. struct net_device *dev,
  925. struct mesh_config *conf);
  926. int (*set_mesh_params)(struct wiphy *wiphy,
  927. struct net_device *dev,
  928. const struct mesh_config *nconf, u32 mask);
  929. int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
  930. struct bss_parameters *params);
  931. int (*set_txq_params)(struct wiphy *wiphy,
  932. struct ieee80211_txq_params *params);
  933. int (*set_channel)(struct wiphy *wiphy,
  934. struct ieee80211_channel *chan,
  935. enum nl80211_channel_type channel_type);
  936. int (*scan)(struct wiphy *wiphy, struct net_device *dev,
  937. struct cfg80211_scan_request *request);
  938. int (*auth)(struct wiphy *wiphy, struct net_device *dev,
  939. struct cfg80211_auth_request *req);
  940. int (*assoc)(struct wiphy *wiphy, struct net_device *dev,
  941. struct cfg80211_assoc_request *req);
  942. int (*deauth)(struct wiphy *wiphy, struct net_device *dev,
  943. struct cfg80211_deauth_request *req);
  944. int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
  945. struct cfg80211_disassoc_request *req);
  946. int (*connect)(struct wiphy *wiphy, struct net_device *dev,
  947. struct cfg80211_connect_params *sme);
  948. int (*disconnect)(struct wiphy *wiphy, struct net_device *dev,
  949. u16 reason_code);
  950. int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
  951. struct cfg80211_ibss_params *params);
  952. int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
  953. int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
  954. int (*set_tx_power)(struct wiphy *wiphy,
  955. enum tx_power_setting type, int dbm);
  956. int (*get_tx_power)(struct wiphy *wiphy, int *dbm);
  957. void (*rfkill_poll)(struct wiphy *wiphy);
  958. #ifdef CONFIG_NL80211_TESTMODE
  959. int (*testmode_cmd)(struct wiphy *wiphy, void *data, int len);
  960. #endif
  961. };
  962. /*
  963. * wireless hardware and networking interfaces structures
  964. * and registration/helper functions
  965. */
  966. /**
  967. * struct wiphy - wireless hardware description
  968. * @idx: the wiphy index assigned to this item
  969. * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
  970. * @custom_regulatory: tells us the driver for this device
  971. * has its own custom regulatory domain and cannot identify the
  972. * ISO / IEC 3166 alpha2 it belongs to. When this is enabled
  973. * we will disregard the first regulatory hint (when the
  974. * initiator is %REGDOM_SET_BY_CORE).
  975. * @strict_regulatory: tells us the driver for this device will ignore
  976. * regulatory domain settings until it gets its own regulatory domain
  977. * via its regulatory_hint(). After its gets its own regulatory domain
  978. * it will only allow further regulatory domain settings to further
  979. * enhance compliance. For example if channel 13 and 14 are disabled
  980. * by this regulatory domain no user regulatory domain can enable these
  981. * channels at a later time. This can be used for devices which do not
  982. * have calibration information gauranteed for frequencies or settings
  983. * outside of its regulatory domain.
  984. * @reg_notifier: the driver's regulatory notification callback
  985. * @regd: the driver's regulatory domain, if one was requested via
  986. * the regulatory_hint() API. This can be used by the driver
  987. * on the reg_notifier() if it chooses to ignore future
  988. * regulatory domain changes caused by other drivers.
  989. * @signal_type: signal type reported in &struct cfg80211_bss.
  990. * @cipher_suites: supported cipher suites
  991. * @n_cipher_suites: number of supported cipher suites
  992. * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
  993. * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
  994. * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
  995. * -1 = fragmentation disabled, only odd values >= 256 used
  996. * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
  997. */
  998. struct wiphy {
  999. /* assign these fields before you register the wiphy */
  1000. /* permanent MAC address */
  1001. u8 perm_addr[ETH_ALEN];
  1002. /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
  1003. u16 interface_modes;
  1004. bool custom_regulatory;
  1005. bool strict_regulatory;
  1006. enum cfg80211_signal_type signal_type;
  1007. int bss_priv_size;
  1008. u8 max_scan_ssids;
  1009. u16 max_scan_ie_len;
  1010. int n_cipher_suites;
  1011. const u32 *cipher_suites;
  1012. u8 retry_short;
  1013. u8 retry_long;
  1014. u32 frag_threshold;
  1015. u32 rts_threshold;
  1016. /* If multiple wiphys are registered and you're handed e.g.
  1017. * a regular netdev with assigned ieee80211_ptr, you won't
  1018. * know whether it points to a wiphy your driver has registered
  1019. * or not. Assign this to something global to your driver to
  1020. * help determine whether you own this wiphy or not. */
  1021. const void *privid;
  1022. struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
  1023. /* Lets us get back the wiphy on the callback */
  1024. int (*reg_notifier)(struct wiphy *wiphy,
  1025. struct regulatory_request *request);
  1026. /* fields below are read-only, assigned by cfg80211 */
  1027. const struct ieee80211_regdomain *regd;
  1028. /* the item in /sys/class/ieee80211/ points to this,
  1029. * you need use set_wiphy_dev() (see below) */
  1030. struct device dev;
  1031. /* dir in debugfs: ieee80211/<wiphyname> */
  1032. struct dentry *debugfsdir;
  1033. char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
  1034. };
  1035. /**
  1036. * wiphy_priv - return priv from wiphy
  1037. *
  1038. * @wiphy: the wiphy whose priv pointer to return
  1039. */
  1040. static inline void *wiphy_priv(struct wiphy *wiphy)
  1041. {
  1042. BUG_ON(!wiphy);
  1043. return &wiphy->priv;
  1044. }
  1045. /**
  1046. * priv_to_wiphy - return the wiphy containing the priv
  1047. *
  1048. * @priv: a pointer previously returned by wiphy_priv
  1049. */
  1050. static inline struct wiphy *priv_to_wiphy(void *priv)
  1051. {
  1052. BUG_ON(!priv);
  1053. return container_of(priv, struct wiphy, priv);
  1054. }
  1055. /**
  1056. * set_wiphy_dev - set device pointer for wiphy
  1057. *
  1058. * @wiphy: The wiphy whose device to bind
  1059. * @dev: The device to parent it to
  1060. */
  1061. static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
  1062. {
  1063. wiphy->dev.parent = dev;
  1064. }
  1065. /**
  1066. * wiphy_dev - get wiphy dev pointer
  1067. *
  1068. * @wiphy: The wiphy whose device struct to look up
  1069. */
  1070. static inline struct device *wiphy_dev(struct wiphy *wiphy)
  1071. {
  1072. return wiphy->dev.parent;
  1073. }
  1074. /**
  1075. * wiphy_name - get wiphy name
  1076. *
  1077. * @wiphy: The wiphy whose name to return
  1078. */
  1079. static inline const char *wiphy_name(struct wiphy *wiphy)
  1080. {
  1081. return dev_name(&wiphy->dev);
  1082. }
  1083. /**
  1084. * wiphy_new - create a new wiphy for use with cfg80211
  1085. *
  1086. * @ops: The configuration operations for this device
  1087. * @sizeof_priv: The size of the private area to allocate
  1088. *
  1089. * Create a new wiphy and associate the given operations with it.
  1090. * @sizeof_priv bytes are allocated for private use.
  1091. *
  1092. * The returned pointer must be assigned to each netdev's
  1093. * ieee80211_ptr for proper operation.
  1094. */
  1095. struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv);
  1096. /**
  1097. * wiphy_register - register a wiphy with cfg80211
  1098. *
  1099. * @wiphy: The wiphy to register.
  1100. *
  1101. * Returns a non-negative wiphy index or a negative error code.
  1102. */
  1103. extern int wiphy_register(struct wiphy *wiphy);
  1104. /**
  1105. * wiphy_unregister - deregister a wiphy from cfg80211
  1106. *
  1107. * @wiphy: The wiphy to unregister.
  1108. *
  1109. * After this call, no more requests can be made with this priv
  1110. * pointer, but the call may sleep to wait for an outstanding
  1111. * request that is being handled.
  1112. */
  1113. extern void wiphy_unregister(struct wiphy *wiphy);
  1114. /**
  1115. * wiphy_free - free wiphy
  1116. *
  1117. * @wiphy: The wiphy to free
  1118. */
  1119. extern void wiphy_free(struct wiphy *wiphy);
  1120. /**
  1121. * struct wireless_dev - wireless per-netdev state
  1122. *
  1123. * This structure must be allocated by the driver/stack
  1124. * that uses the ieee80211_ptr field in struct net_device
  1125. * (this is intentional so it can be allocated along with
  1126. * the netdev.)
  1127. *
  1128. * @wiphy: pointer to hardware description
  1129. * @iftype: interface type
  1130. * @list: (private) Used to collect the interfaces
  1131. * @netdev: (private) Used to reference back to the netdev
  1132. * @current_bss: (private) Used by the internal configuration code
  1133. * @bssid: (private) Used by the internal configuration code
  1134. * @ssid: (private) Used by the internal configuration code
  1135. * @ssid_len: (private) Used by the internal configuration code
  1136. * @wext: (private) Used by the internal wireless extensions compat code
  1137. * @wext_bssid: (private) Used by the internal wireless extensions compat code
  1138. */
  1139. struct wireless_dev {
  1140. struct wiphy *wiphy;
  1141. enum nl80211_iftype iftype;
  1142. /* private to the generic wireless code */
  1143. struct list_head list;
  1144. struct net_device *netdev;
  1145. /* currently used for IBSS and SME - might be rearranged later */
  1146. struct cfg80211_bss *current_bss;
  1147. u8 ssid[IEEE80211_MAX_SSID_LEN];
  1148. u8 ssid_len;
  1149. enum {
  1150. CFG80211_SME_IDLE,
  1151. CFG80211_SME_CONNECTING, /* ->connect called */
  1152. CFG80211_SME_CONNECTED,
  1153. } sme_state;
  1154. #ifdef CONFIG_WIRELESS_EXT
  1155. /* wext data */
  1156. struct {
  1157. struct cfg80211_ibss_params ibss;
  1158. u8 bssid[ETH_ALEN];
  1159. s8 default_key, default_mgmt_key;
  1160. } wext;
  1161. #endif
  1162. };
  1163. /**
  1164. * wdev_priv - return wiphy priv from wireless_dev
  1165. *
  1166. * @wdev: The wireless device whose wiphy's priv pointer to return
  1167. */
  1168. static inline void *wdev_priv(struct wireless_dev *wdev)
  1169. {
  1170. BUG_ON(!wdev);
  1171. return wiphy_priv(wdev->wiphy);
  1172. }
  1173. /*
  1174. * Utility functions
  1175. */
  1176. /**
  1177. * ieee80211_channel_to_frequency - convert channel number to frequency
  1178. */
  1179. extern int ieee80211_channel_to_frequency(int chan);
  1180. /**
  1181. * ieee80211_frequency_to_channel - convert frequency to channel number
  1182. */
  1183. extern int ieee80211_frequency_to_channel(int freq);
  1184. /*
  1185. * Name indirection necessary because the ieee80211 code also has
  1186. * a function named "ieee80211_get_channel", so if you include
  1187. * cfg80211's header file you get cfg80211's version, if you try
  1188. * to include both header files you'll (rightfully!) get a symbol
  1189. * clash.
  1190. */
  1191. extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
  1192. int freq);
  1193. /**
  1194. * ieee80211_get_channel - get channel struct from wiphy for specified frequency
  1195. */
  1196. static inline struct ieee80211_channel *
  1197. ieee80211_get_channel(struct wiphy *wiphy, int freq)
  1198. {
  1199. return __ieee80211_get_channel(wiphy, freq);
  1200. }
  1201. /**
  1202. * ieee80211_get_response_rate - get basic rate for a given rate
  1203. *
  1204. * @sband: the band to look for rates in
  1205. * @basic_rates: bitmap of basic rates
  1206. * @bitrate: the bitrate for which to find the basic rate
  1207. *
  1208. * This function returns the basic rate corresponding to a given
  1209. * bitrate, that is the next lower bitrate contained in the basic
  1210. * rate map, which is, for this function, given as a bitmap of
  1211. * indices of rates in the band's bitrate table.
  1212. */
  1213. struct ieee80211_rate *
  1214. ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
  1215. u32 basic_rates, int bitrate);
  1216. /*
  1217. * Radiotap parsing functions -- for controlled injection support
  1218. *
  1219. * Implemented in net/wireless/radiotap.c
  1220. * Documentation in Documentation/networking/radiotap-headers.txt
  1221. */
  1222. /**
  1223. * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
  1224. * @rtheader: pointer to the radiotap header we are walking through
  1225. * @max_length: length of radiotap header in cpu byte ordering
  1226. * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg
  1227. * @this_arg: pointer to current radiotap arg
  1228. * @arg_index: internal next argument index
  1229. * @arg: internal next argument pointer
  1230. * @next_bitmap: internal pointer to next present u32
  1231. * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
  1232. */
  1233. struct ieee80211_radiotap_iterator {
  1234. struct ieee80211_radiotap_header *rtheader;
  1235. int max_length;
  1236. int this_arg_index;
  1237. u8 *this_arg;
  1238. int arg_index;
  1239. u8 *arg;
  1240. __le32 *next_bitmap;
  1241. u32 bitmap_shifter;
  1242. };
  1243. extern int ieee80211_radiotap_iterator_init(
  1244. struct ieee80211_radiotap_iterator *iterator,
  1245. struct ieee80211_radiotap_header *radiotap_header,
  1246. int max_length);
  1247. extern int ieee80211_radiotap_iterator_next(
  1248. struct ieee80211_radiotap_iterator *iterator);
  1249. extern const unsigned char rfc1042_header[6];
  1250. extern const unsigned char bridge_tunnel_header[6];
  1251. /**
  1252. * ieee80211_get_hdrlen_from_skb - get header length from data
  1253. *
  1254. * Given an skb with a raw 802.11 header at the data pointer this function
  1255. * returns the 802.11 header length in bytes (not including encryption
  1256. * headers). If the data in the sk_buff is too short to contain a valid 802.11
  1257. * header the function returns 0.
  1258. *
  1259. * @skb: the frame
  1260. */
  1261. unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
  1262. /**
  1263. * ieee80211_hdrlen - get header length in bytes from frame control
  1264. * @fc: frame control field in little-endian format
  1265. */
  1266. unsigned int ieee80211_hdrlen(__le16 fc);
  1267. /**
  1268. * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
  1269. * @skb: the 802.11 data frame
  1270. * @addr: the device MAC address
  1271. * @iftype: the virtual interface type
  1272. */
  1273. int ieee80211_data_to_8023(struct sk_buff *skb, u8 *addr,
  1274. enum nl80211_iftype iftype);
  1275. /**
  1276. * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11
  1277. * @skb: the 802.3 frame
  1278. * @addr: the device MAC address
  1279. * @iftype: the virtual interface type
  1280. * @bssid: the network bssid (used only for iftype STATION and ADHOC)
  1281. * @qos: build 802.11 QoS data frame
  1282. */
  1283. int ieee80211_data_from_8023(struct sk_buff *skb, u8 *addr,
  1284. enum nl80211_iftype iftype, u8 *bssid, bool qos);
  1285. /**
  1286. * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
  1287. * @skb: the data frame
  1288. */
  1289. unsigned int cfg80211_classify8021d(struct sk_buff *skb);
  1290. /*
  1291. * Regulatory helper functions for wiphys
  1292. */
  1293. /**
  1294. * regulatory_hint - driver hint to the wireless core a regulatory domain
  1295. * @wiphy: the wireless device giving the hint (used only for reporting
  1296. * conflicts)
  1297. * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
  1298. * should be in. If @rd is set this should be NULL. Note that if you
  1299. * set this to NULL you should still set rd->alpha2 to some accepted
  1300. * alpha2.
  1301. *
  1302. * Wireless drivers can use this function to hint to the wireless core
  1303. * what it believes should be the current regulatory domain by
  1304. * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
  1305. * domain should be in or by providing a completely build regulatory domain.
  1306. * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
  1307. * for a regulatory domain structure for the respective country.
  1308. *
  1309. * The wiphy must have been registered to cfg80211 prior to this call.
  1310. * For cfg80211 drivers this means you must first use wiphy_register(),
  1311. * for mac80211 drivers you must first use ieee80211_register_hw().
  1312. *
  1313. * Drivers should check the return value, its possible you can get
  1314. * an -ENOMEM.
  1315. */
  1316. extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
  1317. /**
  1318. * regulatory_hint_11d - hints a country IE as a regulatory domain
  1319. * @wiphy: the wireless device giving the hint (used only for reporting
  1320. * conflicts)
  1321. * @country_ie: pointer to the country IE
  1322. * @country_ie_len: length of the country IE
  1323. *
  1324. * We will intersect the rd with the what CRDA tells us should apply
  1325. * for the alpha2 this country IE belongs to, this prevents APs from
  1326. * sending us incorrect or outdated information against a country.
  1327. */
  1328. extern void regulatory_hint_11d(struct wiphy *wiphy,
  1329. u8 *country_ie,
  1330. u8 country_ie_len);
  1331. /**
  1332. * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
  1333. * @wiphy: the wireless device we want to process the regulatory domain on
  1334. * @regd: the custom regulatory domain to use for this wiphy
  1335. *
  1336. * Drivers can sometimes have custom regulatory domains which do not apply
  1337. * to a specific country. Drivers can use this to apply such custom regulatory
  1338. * domains. This routine must be called prior to wiphy registration. The
  1339. * custom regulatory domain will be trusted completely and as such previous
  1340. * default channel settings will be disregarded. If no rule is found for a
  1341. * channel on the regulatory domain the channel will be disabled.
  1342. */
  1343. extern void wiphy_apply_custom_regulatory(
  1344. struct wiphy *wiphy,
  1345. const struct ieee80211_regdomain *regd);
  1346. /**
  1347. * freq_reg_info - get regulatory information for the given frequency
  1348. * @wiphy: the wiphy for which we want to process this rule for
  1349. * @center_freq: Frequency in KHz for which we want regulatory information for
  1350. * @desired_bw_khz: the desired max bandwidth you want to use per
  1351. * channel. Note that this is still 20 MHz if you want to use HT40
  1352. * as HT40 makes use of two channels for its 40 MHz width bandwidth.
  1353. * If set to 0 we'll assume you want the standard 20 MHz.
  1354. * @reg_rule: the regulatory rule which we have for this frequency
  1355. *
  1356. * Use this function to get the regulatory rule for a specific frequency on
  1357. * a given wireless device. If the device has a specific regulatory domain
  1358. * it wants to follow we respect that unless a country IE has been received
  1359. * and processed already.
  1360. *
  1361. * Returns 0 if it was able to find a valid regulatory rule which does
  1362. * apply to the given center_freq otherwise it returns non-zero. It will
  1363. * also return -ERANGE if we determine the given center_freq does not even have
  1364. * a regulatory rule for a frequency range in the center_freq's band. See
  1365. * freq_in_rule_band() for our current definition of a band -- this is purely
  1366. * subjective and right now its 802.11 specific.
  1367. */
  1368. extern int freq_reg_info(struct wiphy *wiphy,
  1369. u32 center_freq,
  1370. u32 desired_bw_khz,
  1371. const struct ieee80211_reg_rule **reg_rule);
  1372. /*
  1373. * Temporary wext handlers & helper functions
  1374. *
  1375. * In the future cfg80211 will simply assign the entire wext handler
  1376. * structure to netdevs it manages, but we're not there yet.
  1377. */
  1378. int cfg80211_wext_giwname(struct net_device *dev,
  1379. struct iw_request_info *info,
  1380. char *name, char *extra);
  1381. int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
  1382. u32 *mode, char *extra);
  1383. int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info,
  1384. u32 *mode, char *extra);
  1385. int cfg80211_wext_siwscan(struct net_device *dev,
  1386. struct iw_request_info *info,
  1387. union iwreq_data *wrqu, char *extra);
  1388. int cfg80211_wext_giwscan(struct net_device *dev,
  1389. struct iw_request_info *info,
  1390. struct iw_point *data, char *extra);
  1391. int cfg80211_wext_siwmlme(struct net_device *dev,
  1392. struct iw_request_info *info,
  1393. struct iw_point *data, char *extra);
  1394. int cfg80211_wext_giwrange(struct net_device *dev,
  1395. struct iw_request_info *info,
  1396. struct iw_point *data, char *extra);
  1397. int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
  1398. struct iw_request_info *info,
  1399. struct iw_freq *freq, char *extra);
  1400. int cfg80211_ibss_wext_giwfreq(struct net_device *dev,
  1401. struct iw_request_info *info,
  1402. struct iw_freq *freq, char *extra);
  1403. int cfg80211_ibss_wext_siwessid(struct net_device *dev,
  1404. struct iw_request_info *info,
  1405. struct iw_point *data, char *ssid);
  1406. int cfg80211_ibss_wext_giwessid(struct net_device *dev,
  1407. struct iw_request_info *info,
  1408. struct iw_point *data, char *ssid);
  1409. int cfg80211_ibss_wext_siwap(struct net_device *dev,
  1410. struct iw_request_info *info,
  1411. struct sockaddr *ap_addr, char *extra);
  1412. int cfg80211_ibss_wext_giwap(struct net_device *dev,
  1413. struct iw_request_info *info,
  1414. struct sockaddr *ap_addr, char *extra);
  1415. struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy,
  1416. struct iw_freq *freq);
  1417. int cfg80211_wext_siwrts(struct net_device *dev,
  1418. struct iw_request_info *info,
  1419. struct iw_param *rts, char *extra);
  1420. int cfg80211_wext_giwrts(struct net_device *dev,
  1421. struct iw_request_info *info,
  1422. struct iw_param *rts, char *extra);
  1423. int cfg80211_wext_siwfrag(struct net_device *dev,
  1424. struct iw_request_info *info,
  1425. struct iw_param *frag, char *extra);
  1426. int cfg80211_wext_giwfrag(struct net_device *dev,
  1427. struct iw_request_info *info,
  1428. struct iw_param *frag, char *extra);
  1429. int cfg80211_wext_siwretry(struct net_device *dev,
  1430. struct iw_request_info *info,
  1431. struct iw_param *retry, char *extra);
  1432. int cfg80211_wext_giwretry(struct net_device *dev,
  1433. struct iw_request_info *info,
  1434. struct iw_param *retry, char *extra);
  1435. int cfg80211_wext_siwencodeext(struct net_device *dev,
  1436. struct iw_request_info *info,
  1437. struct iw_point *erq, char *extra);
  1438. int cfg80211_wext_siwencode(struct net_device *dev,
  1439. struct iw_request_info *info,
  1440. struct iw_point *erq, char *keybuf);
  1441. int cfg80211_wext_giwencode(struct net_device *dev,
  1442. struct iw_request_info *info,
  1443. struct iw_point *erq, char *keybuf);
  1444. int cfg80211_wext_siwtxpower(struct net_device *dev,
  1445. struct iw_request_info *info,
  1446. union iwreq_data *data, char *keybuf);
  1447. int cfg80211_wext_giwtxpower(struct net_device *dev,
  1448. struct iw_request_info *info,
  1449. union iwreq_data *data, char *keybuf);
  1450. /*
  1451. * callbacks for asynchronous cfg80211 methods, notification
  1452. * functions and BSS handling helpers
  1453. */
  1454. /**
  1455. * cfg80211_scan_done - notify that scan finished
  1456. *
  1457. * @request: the corresponding scan request
  1458. * @aborted: set to true if the scan was aborted for any reason,
  1459. * userspace will be notified of that
  1460. */
  1461. void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
  1462. /**
  1463. * cfg80211_inform_bss - inform cfg80211 of a new BSS
  1464. *
  1465. * @wiphy: the wiphy reporting the BSS
  1466. * @bss: the found BSS
  1467. * @signal: the signal strength, type depends on the wiphy's signal_type
  1468. * @gfp: context flags
  1469. *
  1470. * This informs cfg80211 that BSS information was found and
  1471. * the BSS should be updated/added.
  1472. */
  1473. struct cfg80211_bss*
  1474. cfg80211_inform_bss_frame(struct wiphy *wiphy,
  1475. struct ieee80211_channel *channel,
  1476. struct ieee80211_mgmt *mgmt, size_t len,
  1477. s32 signal, gfp_t gfp);
  1478. struct cfg80211_bss*
  1479. cfg80211_inform_bss(struct wiphy *wiphy,
  1480. struct ieee80211_channel *channel,
  1481. const u8 *bssid,
  1482. u64 timestamp, u16 capability, u16 beacon_interval,
  1483. const u8 *ie, size_t ielen,
  1484. s32 signal, gfp_t gfp);
  1485. struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
  1486. struct ieee80211_channel *channel,
  1487. const u8 *bssid,
  1488. const u8 *ssid, size_t ssid_len,
  1489. u16 capa_mask, u16 capa_val);
  1490. static inline struct cfg80211_bss *
  1491. cfg80211_get_ibss(struct wiphy *wiphy,
  1492. struct ieee80211_channel *channel,
  1493. const u8 *ssid, size_t ssid_len)
  1494. {
  1495. return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
  1496. WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS);
  1497. }
  1498. struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
  1499. struct ieee80211_channel *channel,
  1500. const u8 *meshid, size_t meshidlen,
  1501. const u8 *meshcfg);
  1502. void cfg80211_put_bss(struct cfg80211_bss *bss);
  1503. /**
  1504. * cfg80211_unlink_bss - unlink BSS from internal data structures
  1505. * @wiphy: the wiphy
  1506. * @bss: the bss to remove
  1507. *
  1508. * This function removes the given BSS from the internal data structures
  1509. * thereby making it no longer show up in scan results etc. Use this
  1510. * function when you detect a BSS is gone. Normally BSSes will also time
  1511. * out, so it is not necessary to use this function at all.
  1512. */
  1513. void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
  1514. /**
  1515. * cfg80211_send_rx_auth - notification of processed authentication
  1516. * @dev: network device
  1517. * @buf: authentication frame (header + body)
  1518. * @len: length of the frame data
  1519. * @gfp: allocation flags
  1520. *
  1521. * This function is called whenever an authentication has been processed in
  1522. * station mode. The driver is required to call either this function or
  1523. * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth()
  1524. * call.
  1525. */
  1526. void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len, gfp_t gfp);
  1527. /**
  1528. * cfg80211_send_auth_timeout - notification of timed out authentication
  1529. * @dev: network device
  1530. * @addr: The MAC address of the device with which the authentication timed out
  1531. * @gfp: allocation flags
  1532. */
  1533. void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr, gfp_t gfp);
  1534. /**
  1535. * cfg80211_send_rx_assoc - notification of processed association
  1536. * @dev: network device
  1537. * @buf: (re)association response frame (header + body)
  1538. * @len: length of the frame data
  1539. * @gfp: allocation flags
  1540. *
  1541. * This function is called whenever a (re)association response has been
  1542. * processed in station mode. The driver is required to call either this
  1543. * function or cfg80211_send_assoc_timeout() to indicate the result of
  1544. * cfg80211_ops::assoc() call.
  1545. */
  1546. void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len, gfp_t gfp);
  1547. /**
  1548. * cfg80211_send_assoc_timeout - notification of timed out association
  1549. * @dev: network device
  1550. * @addr: The MAC address of the device with which the association timed out
  1551. * @gfp: allocation flags
  1552. */
  1553. void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr, gfp_t gfp);
  1554. /**
  1555. * cfg80211_send_deauth - notification of processed deauthentication
  1556. * @dev: network device
  1557. * @buf: deauthentication frame (header + body)
  1558. * @len: length of the frame data
  1559. * @gfp: allocation flags
  1560. *
  1561. * This function is called whenever deauthentication has been processed in
  1562. * station mode. This includes both received deauthentication frames and
  1563. * locally generated ones.
  1564. */
  1565. void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len, gfp_t gfp);
  1566. /**
  1567. * cfg80211_send_disassoc - notification of processed disassociation
  1568. * @dev: network device
  1569. * @buf: disassociation response frame (header + body)
  1570. * @len: length of the frame data
  1571. * @gfp: allocation flags
  1572. *
  1573. * This function is called whenever disassociation has been processed in
  1574. * station mode. This includes both received disassociation frames and locally
  1575. * generated ones.
  1576. */
  1577. void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len, gfp_t gfp);
  1578. /**
  1579. * cfg80211_hold_bss - exclude bss from expiration
  1580. * @bss: bss which should not expire
  1581. *
  1582. * In a case when the BSS is not updated but it shouldn't expire this
  1583. * function can be used to mark the BSS to be excluded from expiration.
  1584. */
  1585. void cfg80211_hold_bss(struct cfg80211_bss *bss);
  1586. /**
  1587. * cfg80211_unhold_bss - remove expiration exception from the BSS
  1588. * @bss: bss which can expire again
  1589. *
  1590. * This function marks the BSS to be expirable again.
  1591. */
  1592. void cfg80211_unhold_bss(struct cfg80211_bss *bss);
  1593. /**
  1594. * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
  1595. * @dev: network device
  1596. * @addr: The source MAC address of the frame
  1597. * @key_type: The key type that the received frame used
  1598. * @key_id: Key identifier (0..3)
  1599. * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
  1600. * @gfp: allocation flags
  1601. *
  1602. * This function is called whenever the local MAC detects a MIC failure in a
  1603. * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
  1604. * primitive.
  1605. */
  1606. void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
  1607. enum nl80211_key_type key_type, int key_id,
  1608. const u8 *tsc, gfp_t gfp);
  1609. /**
  1610. * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
  1611. *
  1612. * @dev: network device
  1613. * @bssid: the BSSID of the IBSS joined
  1614. * @gfp: allocation flags
  1615. *
  1616. * This function notifies cfg80211 that the device joined an IBSS or
  1617. * switched to a different BSSID. Before this function can be called,
  1618. * either a beacon has to have been received from the IBSS, or one of
  1619. * the cfg80211_inform_bss{,_frame} functions must have been called
  1620. * with the locally generated beacon -- this guarantees that there is
  1621. * always a scan result for this IBSS. cfg80211 will handle the rest.
  1622. */
  1623. void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp);
  1624. /**
  1625. * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
  1626. * @wiphy: the wiphy
  1627. * @blocked: block status
  1628. */
  1629. void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
  1630. /**
  1631. * wiphy_rfkill_start_polling - start polling rfkill
  1632. * @wiphy: the wiphy
  1633. */
  1634. void wiphy_rfkill_start_polling(struct wiphy *wiphy);
  1635. /**
  1636. * wiphy_rfkill_stop_polling - stop polling rfkill
  1637. * @wiphy: the wiphy
  1638. */
  1639. void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
  1640. #ifdef CONFIG_NL80211_TESTMODE
  1641. /**
  1642. * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
  1643. * @wiphy: the wiphy
  1644. * @approxlen: an upper bound of the length of the data that will
  1645. * be put into the skb
  1646. *
  1647. * This function allocates and pre-fills an skb for a reply to
  1648. * the testmode command. Since it is intended for a reply, calling
  1649. * it outside of the @testmode_cmd operation is invalid.
  1650. *
  1651. * The returned skb (or %NULL if any errors happen) is pre-filled
  1652. * with the wiphy index and set up in a way that any data that is
  1653. * put into the skb (with skb_put(), nla_put() or similar) will end
  1654. * up being within the %NL80211_ATTR_TESTDATA attribute, so all that
  1655. * needs to be done with the skb is adding data for the corresponding
  1656. * userspace tool which can then read that data out of the testdata
  1657. * attribute. You must not modify the skb in any other way.
  1658. *
  1659. * When done, call cfg80211_testmode_reply() with the skb and return
  1660. * its error code as the result of the @testmode_cmd operation.
  1661. */
  1662. struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy,
  1663. int approxlen);
  1664. /**
  1665. * cfg80211_testmode_reply - send the reply skb
  1666. * @skb: The skb, must have been allocated with
  1667. * cfg80211_testmode_alloc_reply_skb()
  1668. *
  1669. * Returns an error code or 0 on success, since calling this
  1670. * function will usually be the last thing before returning
  1671. * from the @testmode_cmd you should return the error code.
  1672. * Note that this function consumes the skb regardless of the
  1673. * return value.
  1674. */
  1675. int cfg80211_testmode_reply(struct sk_buff *skb);
  1676. /**
  1677. * cfg80211_testmode_alloc_event_skb - allocate testmode event
  1678. * @wiphy: the wiphy
  1679. * @approxlen: an upper bound of the length of the data that will
  1680. * be put into the skb
  1681. * @gfp: allocation flags
  1682. *
  1683. * This function allocates and pre-fills an skb for an event on the
  1684. * testmode multicast group.
  1685. *
  1686. * The returned skb (or %NULL if any errors happen) is set up in the
  1687. * same way as with cfg80211_testmode_alloc_reply_skb() but prepared
  1688. * for an event. As there, you should simply add data to it that will
  1689. * then end up in the %NL80211_ATTR_TESTDATA attribute. Again, you must
  1690. * not modify the skb in any other way.
  1691. *
  1692. * When done filling the skb, call cfg80211_testmode_event() with the
  1693. * skb to send the event.
  1694. */
  1695. struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy,
  1696. int approxlen, gfp_t gfp);
  1697. /**
  1698. * cfg80211_testmode_event - send the event
  1699. * @skb: The skb, must have been allocated with
  1700. * cfg80211_testmode_alloc_event_skb()
  1701. * @gfp: allocation flags
  1702. *
  1703. * This function sends the given @skb, which must have been allocated
  1704. * by cfg80211_testmode_alloc_event_skb(), as an event. It always
  1705. * consumes it.
  1706. */
  1707. void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp);
  1708. #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd),
  1709. #else
  1710. #define CFG80211_TESTMODE_CMD(cmd)
  1711. #endif
  1712. /**
  1713. * cfg80211_connect_result - notify cfg80211 of connection result
  1714. *
  1715. * @dev: network device
  1716. * @bssid: the BSSID of the AP
  1717. * @req_ie: association request IEs (maybe be %NULL)
  1718. * @req_ie_len: association request IEs length
  1719. * @resp_ie: association response IEs (may be %NULL)
  1720. * @resp_ie_len: assoc response IEs length
  1721. * @status: status code, 0 for successful connection, use
  1722. * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
  1723. * the real status code for failures.
  1724. * @gfp: allocation flags
  1725. *
  1726. * It should be called by the underlying driver whenever connect() has
  1727. * succeeded.
  1728. */
  1729. void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
  1730. const u8 *req_ie, size_t req_ie_len,
  1731. const u8 *resp_ie, size_t resp_ie_len,
  1732. u16 status, gfp_t gfp);
  1733. /**
  1734. * cfg80211_roamed - notify cfg80211 of roaming
  1735. *
  1736. * @dev: network device
  1737. * @bssid: the BSSID of the new AP
  1738. * @req_ie: association request IEs (maybe be %NULL)
  1739. * @req_ie_len: association request IEs length
  1740. * @resp_ie: association response IEs (may be %NULL)
  1741. * @resp_ie_len: assoc response IEs length
  1742. * @gfp: allocation flags
  1743. *
  1744. * It should be called by the underlying driver whenever it roamed
  1745. * from one AP to another while connected.
  1746. */
  1747. void cfg80211_roamed(struct net_device *dev, const u8 *bssid,
  1748. const u8 *req_ie, size_t req_ie_len,
  1749. const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
  1750. /**
  1751. * cfg80211_disconnected - notify cfg80211 that connection was dropped
  1752. *
  1753. * @dev: network device
  1754. * @ie: information elements of the deauth/disassoc frame (may be %NULL)
  1755. * @ie_len: length of IEs
  1756. * @reason: reason code for the disconnection, set it to 0 if unknown
  1757. * @gfp: allocation flags
  1758. *
  1759. * After it calls this function, the driver should enter an idle state
  1760. * and not try to connect to any AP any more.
  1761. */
  1762. void cfg80211_disconnected(struct net_device *dev, u16 reason,
  1763. u8 *ie, size_t ie_len, gfp_t gfp);
  1764. #endif /* __NET_CFG80211_H */