mac80211.h 61 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666
  1. /*
  2. * mac80211 <-> driver interface
  3. *
  4. * Copyright 2002-2005, Devicescape Software, Inc.
  5. * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
  6. * Copyright 2007 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. #ifndef MAC80211_H
  13. #define MAC80211_H
  14. #include <linux/kernel.h>
  15. #include <linux/if_ether.h>
  16. #include <linux/skbuff.h>
  17. #include <linux/wireless.h>
  18. #include <linux/device.h>
  19. #include <linux/ieee80211.h>
  20. #include <net/wireless.h>
  21. #include <net/cfg80211.h>
  22. /**
  23. * DOC: Introduction
  24. *
  25. * mac80211 is the Linux stack for 802.11 hardware that implements
  26. * only partial functionality in hard- or firmware. This document
  27. * defines the interface between mac80211 and low-level hardware
  28. * drivers.
  29. */
  30. /**
  31. * DOC: Calling mac80211 from interrupts
  32. *
  33. * Only ieee80211_tx_status_irqsafe() and ieee80211_rx_irqsafe() can be
  34. * called in hardware interrupt context. The low-level driver must not call any
  35. * other functions in hardware interrupt context. If there is a need for such
  36. * call, the low-level driver should first ACK the interrupt and perform the
  37. * IEEE 802.11 code call after this, e.g. from a scheduled workqueue or even
  38. * tasklet function.
  39. *
  40. * NOTE: If the driver opts to use the _irqsafe() functions, it may not also
  41. * use the non-irqsafe functions!
  42. */
  43. /**
  44. * DOC: Warning
  45. *
  46. * If you're reading this document and not the header file itself, it will
  47. * be incomplete because not all documentation has been converted yet.
  48. */
  49. /**
  50. * DOC: Frame format
  51. *
  52. * As a general rule, when frames are passed between mac80211 and the driver,
  53. * they start with the IEEE 802.11 header and include the same octets that are
  54. * sent over the air except for the FCS which should be calculated by the
  55. * hardware.
  56. *
  57. * There are, however, various exceptions to this rule for advanced features:
  58. *
  59. * The first exception is for hardware encryption and decryption offload
  60. * where the IV/ICV may or may not be generated in hardware.
  61. *
  62. * Secondly, when the hardware handles fragmentation, the frame handed to
  63. * the driver from mac80211 is the MSDU, not the MPDU.
  64. *
  65. * Finally, for received frames, the driver is able to indicate that it has
  66. * filled a radiotap header and put that in front of the frame; if it does
  67. * not do so then mac80211 may add this under certain circumstances.
  68. */
  69. /**
  70. * struct ieee80211_ht_bss_info - describing BSS's HT characteristics
  71. *
  72. * This structure describes most essential parameters needed
  73. * to describe 802.11n HT characteristics in a BSS
  74. *
  75. * @primary_channel: channel number of primery channel
  76. * @bss_cap: 802.11n's general BSS capabilities (e.g. channel width)
  77. * @bss_op_mode: 802.11n's BSS operation modes (e.g. HT protection)
  78. */
  79. struct ieee80211_ht_bss_info {
  80. u8 primary_channel;
  81. u8 bss_cap; /* use IEEE80211_HT_IE_CHA_ */
  82. u8 bss_op_mode; /* use IEEE80211_HT_IE_ */
  83. };
  84. /**
  85. * struct ieee80211_tx_queue_params - transmit queue configuration
  86. *
  87. * The information provided in this structure is required for QoS
  88. * transmit queue configuration. Cf. IEEE 802.11 7.3.2.29.
  89. *
  90. * @aifs: arbitration interface space [0..255, -1: use default]
  91. * @cw_min: minimum contention window [will be a value of the form
  92. * 2^n-1 in the range 1..1023; 0: use default]
  93. * @cw_max: maximum contention window [like @cw_min]
  94. * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled
  95. */
  96. struct ieee80211_tx_queue_params {
  97. s16 aifs;
  98. u16 cw_min;
  99. u16 cw_max;
  100. u16 txop;
  101. };
  102. /**
  103. * struct ieee80211_tx_queue_stats_data - transmit queue statistics
  104. *
  105. * @len: number of packets in queue
  106. * @limit: queue length limit
  107. * @count: number of frames sent
  108. */
  109. struct ieee80211_tx_queue_stats_data {
  110. unsigned int len;
  111. unsigned int limit;
  112. unsigned int count;
  113. };
  114. /**
  115. * enum ieee80211_tx_queue - transmit queue number
  116. *
  117. * These constants are used with some callbacks that take a
  118. * queue number to set parameters for a queue.
  119. *
  120. * @IEEE80211_TX_QUEUE_DATA0: data queue 0
  121. * @IEEE80211_TX_QUEUE_DATA1: data queue 1
  122. * @IEEE80211_TX_QUEUE_DATA2: data queue 2
  123. * @IEEE80211_TX_QUEUE_DATA3: data queue 3
  124. * @IEEE80211_TX_QUEUE_DATA4: data queue 4
  125. * @IEEE80211_TX_QUEUE_SVP: ??
  126. * @NUM_TX_DATA_QUEUES: number of data queues
  127. * @IEEE80211_TX_QUEUE_AFTER_BEACON: transmit queue for frames to be
  128. * sent after a beacon
  129. * @IEEE80211_TX_QUEUE_BEACON: transmit queue for beacon frames
  130. * @NUM_TX_DATA_QUEUES_AMPDU: adding more queues for A-MPDU
  131. */
  132. enum ieee80211_tx_queue {
  133. IEEE80211_TX_QUEUE_DATA0,
  134. IEEE80211_TX_QUEUE_DATA1,
  135. IEEE80211_TX_QUEUE_DATA2,
  136. IEEE80211_TX_QUEUE_DATA3,
  137. IEEE80211_TX_QUEUE_DATA4,
  138. IEEE80211_TX_QUEUE_SVP,
  139. NUM_TX_DATA_QUEUES,
  140. /* due to stupidity in the sub-ioctl userspace interface, the items in
  141. * this struct need to have fixed values. As soon as it is removed, we can
  142. * fix these entries. */
  143. IEEE80211_TX_QUEUE_AFTER_BEACON = 6,
  144. IEEE80211_TX_QUEUE_BEACON = 7,
  145. NUM_TX_DATA_QUEUES_AMPDU = 16
  146. };
  147. struct ieee80211_tx_queue_stats {
  148. struct ieee80211_tx_queue_stats_data data[NUM_TX_DATA_QUEUES_AMPDU];
  149. };
  150. struct ieee80211_low_level_stats {
  151. unsigned int dot11ACKFailureCount;
  152. unsigned int dot11RTSFailureCount;
  153. unsigned int dot11FCSErrorCount;
  154. unsigned int dot11RTSSuccessCount;
  155. };
  156. /**
  157. * enum ieee80211_bss_change - BSS change notification flags
  158. *
  159. * These flags are used with the bss_info_changed() callback
  160. * to indicate which BSS parameter changed.
  161. *
  162. * @BSS_CHANGED_ASSOC: association status changed (associated/disassociated),
  163. * also implies a change in the AID.
  164. * @BSS_CHANGED_ERP_CTS_PROT: CTS protection changed
  165. * @BSS_CHANGED_ERP_PREAMBLE: preamble changed
  166. */
  167. enum ieee80211_bss_change {
  168. BSS_CHANGED_ASSOC = 1<<0,
  169. BSS_CHANGED_ERP_CTS_PROT = 1<<1,
  170. BSS_CHANGED_ERP_PREAMBLE = 1<<2,
  171. };
  172. /**
  173. * struct ieee80211_bss_conf - holds the BSS's changing parameters
  174. *
  175. * This structure keeps information about a BSS (and an association
  176. * to that BSS) that can change during the lifetime of the BSS.
  177. *
  178. * @assoc: association status
  179. * @aid: association ID number, valid only when @assoc is true
  180. * @use_cts_prot: use CTS protection
  181. * @use_short_preamble: use 802.11b short preamble
  182. */
  183. struct ieee80211_bss_conf {
  184. /* association related data */
  185. bool assoc;
  186. u16 aid;
  187. /* erp related data */
  188. bool use_cts_prot;
  189. bool use_short_preamble;
  190. };
  191. /**
  192. * enum mac80211_tx_control_flags - flags to describe Tx configuration for
  193. * the Tx frame
  194. *
  195. * These flags are used with the @flags member of &ieee80211_tx_control
  196. *
  197. * @IEEE80211_TXCTL_REQ_TX_STATUS: request TX status callback for this frame.
  198. * @IEEE80211_TXCTL_DO_NOT_ENCRYPT: send this frame without encryption;
  199. * e.g., for EAPOL frame
  200. * @IEEE80211_TXCTL_USE_RTS_CTS: use RTS-CTS before sending frame
  201. * @IEEE80211_TXCTL_USE_CTS_PROTECT: use CTS protection for the frame (e.g.,
  202. * for combined 802.11g / 802.11b networks)
  203. * @IEEE80211_TXCTL_NO_ACK: tell the low level not to wait for an ack
  204. * @IEEE80211_TXCTL_RATE_CTRL_PROBE
  205. * @EEE80211_TXCTL_CLEAR_PS_FILT: clear powersave filter
  206. * for destination station
  207. * @IEEE80211_TXCTL_REQUEUE:
  208. * @IEEE80211_TXCTL_FIRST_FRAGMENT: this is a first fragment of the frame
  209. * @IEEE80211_TXCTL_LONG_RETRY_LIMIT: this frame should be send using the
  210. * through set_retry_limit configured long
  211. * retry value
  212. * @IEEE80211_TXCTL_EAPOL_FRAME: internal to mac80211
  213. * @IEEE80211_TXCTL_SEND_AFTER_DTIM: send this frame after DTIM beacon
  214. * @IEEE80211_TXCTL_AMPDU: this frame should be sent as part of an A-MPDU
  215. * @IEEE80211_TXCTL_OFDM_HT: this frame can be sent in HT OFDM rates. number
  216. * of streams when this flag is on can be extracted
  217. * from antenna_sel_tx, so if 1 antenna is marked
  218. * use SISO, 2 antennas marked use MIMO, n antennas
  219. * marked use MIMO_n.
  220. * @IEEE80211_TXCTL_GREEN_FIELD: use green field protection for this frame
  221. * @IEEE80211_TXCTL_40_MHZ_WIDTH: send this frame using 40 Mhz channel width
  222. * @IEEE80211_TXCTL_DUP_DATA: duplicate data frame on both 20 Mhz channels
  223. * @IEEE80211_TXCTL_SHORT_GI: send this frame using short guard interval
  224. */
  225. enum mac80211_tx_control_flags {
  226. IEEE80211_TXCTL_REQ_TX_STATUS = (1<<0),
  227. IEEE80211_TXCTL_DO_NOT_ENCRYPT = (1<<1),
  228. IEEE80211_TXCTL_USE_RTS_CTS = (1<<2),
  229. IEEE80211_TXCTL_USE_CTS_PROTECT = (1<<3),
  230. IEEE80211_TXCTL_NO_ACK = (1<<4),
  231. IEEE80211_TXCTL_RATE_CTRL_PROBE = (1<<5),
  232. IEEE80211_TXCTL_CLEAR_PS_FILT = (1<<6),
  233. IEEE80211_TXCTL_REQUEUE = (1<<7),
  234. IEEE80211_TXCTL_FIRST_FRAGMENT = (1<<8),
  235. IEEE80211_TXCTL_SHORT_PREAMBLE = (1<<9),
  236. IEEE80211_TXCTL_LONG_RETRY_LIMIT = (1<<10),
  237. IEEE80211_TXCTL_EAPOL_FRAME = (1<<11),
  238. IEEE80211_TXCTL_SEND_AFTER_DTIM = (1<<12),
  239. IEEE80211_TXCTL_AMPDU = (1<<13),
  240. IEEE80211_TXCTL_OFDM_HT = (1<<14),
  241. IEEE80211_TXCTL_GREEN_FIELD = (1<<15),
  242. IEEE80211_TXCTL_40_MHZ_WIDTH = (1<<16),
  243. IEEE80211_TXCTL_DUP_DATA = (1<<17),
  244. IEEE80211_TXCTL_SHORT_GI = (1<<18),
  245. };
  246. /* Transmit control fields. This data structure is passed to low-level driver
  247. * with each TX frame. The low-level driver is responsible for configuring
  248. * the hardware to use given values (depending on what is supported). */
  249. struct ieee80211_tx_control {
  250. struct ieee80211_vif *vif;
  251. struct ieee80211_rate *tx_rate;
  252. /* Transmit rate for RTS/CTS frame */
  253. struct ieee80211_rate *rts_cts_rate;
  254. /* retry rate for the last retries */
  255. struct ieee80211_rate *alt_retry_rate;
  256. u32 flags; /* tx control flags defined above */
  257. u8 key_idx; /* keyidx from hw->set_key(), undefined if
  258. * IEEE80211_TXCTL_DO_NOT_ENCRYPT is set */
  259. u8 retry_limit; /* 1 = only first attempt, 2 = one retry, ..
  260. * This could be used when set_retry_limit
  261. * is not implemented by the driver */
  262. u8 antenna_sel_tx; /* 0 = default/diversity, otherwise bit
  263. * position represents antenna number used */
  264. u8 icv_len; /* length of the ICV/MIC field in octets */
  265. u8 iv_len; /* length of the IV field in octets */
  266. u8 queue; /* hardware queue to use for this frame;
  267. * 0 = highest, hw->queues-1 = lowest */
  268. int type; /* internal */
  269. };
  270. /**
  271. * enum mac80211_rx_flags - receive flags
  272. *
  273. * These flags are used with the @flag member of &struct ieee80211_rx_status.
  274. * @RX_FLAG_MMIC_ERROR: Michael MIC error was reported on this frame.
  275. * Use together with %RX_FLAG_MMIC_STRIPPED.
  276. * @RX_FLAG_DECRYPTED: This frame was decrypted in hardware.
  277. * @RX_FLAG_RADIOTAP: This frame starts with a radiotap header.
  278. * @RX_FLAG_MMIC_STRIPPED: the Michael MIC is stripped off this frame,
  279. * verification has been done by the hardware.
  280. * @RX_FLAG_IV_STRIPPED: The IV/ICV are stripped from this frame.
  281. * If this flag is set, the stack cannot do any replay detection
  282. * hence the driver or hardware will have to do that.
  283. * @RX_FLAG_FAILED_FCS_CRC: Set this flag if the FCS check failed on
  284. * the frame.
  285. * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on
  286. * the frame.
  287. * @RX_FLAG_TSFT: The timestamp passed in the RX status (@mactime field)
  288. * is valid. This is useful in monitor mode and necessary for beacon frames
  289. * to enable IBSS merging.
  290. */
  291. enum mac80211_rx_flags {
  292. RX_FLAG_MMIC_ERROR = 1<<0,
  293. RX_FLAG_DECRYPTED = 1<<1,
  294. RX_FLAG_RADIOTAP = 1<<2,
  295. RX_FLAG_MMIC_STRIPPED = 1<<3,
  296. RX_FLAG_IV_STRIPPED = 1<<4,
  297. RX_FLAG_FAILED_FCS_CRC = 1<<5,
  298. RX_FLAG_FAILED_PLCP_CRC = 1<<6,
  299. RX_FLAG_TSFT = 1<<7,
  300. };
  301. /**
  302. * struct ieee80211_rx_status - receive status
  303. *
  304. * The low-level driver should provide this information (the subset
  305. * supported by hardware) to the 802.11 code with each received
  306. * frame.
  307. * @mactime: value in microseconds of the 64-bit Time Synchronization Function
  308. * (TSF) timer when the first data symbol (MPDU) arrived at the hardware.
  309. * @band: the active band when this frame was received
  310. * @freq: frequency the radio was tuned to when receiving this frame, in MHz
  311. * @ssi: signal strength when receiving this frame
  312. * @signal: used as 'qual' in statistics reporting
  313. * @noise: PHY noise when receiving this frame
  314. * @antenna: antenna used
  315. * @rate_idx: index of data rate into band's supported rates
  316. * @flag: %RX_FLAG_*
  317. */
  318. struct ieee80211_rx_status {
  319. u64 mactime;
  320. enum ieee80211_band band;
  321. int freq;
  322. int ssi;
  323. int signal;
  324. int noise;
  325. int antenna;
  326. int rate_idx;
  327. int flag;
  328. };
  329. /**
  330. * enum ieee80211_tx_status_flags - transmit status flags
  331. *
  332. * Status flags to indicate various transmit conditions.
  333. *
  334. * @IEEE80211_TX_STATUS_TX_FILTERED: The frame was not transmitted
  335. * because the destination STA was in powersave mode.
  336. * @IEEE80211_TX_STATUS_ACK: Frame was acknowledged
  337. * @IEEE80211_TX_STATUS_AMPDU: The frame was aggregated, so status
  338. * is for the whole aggregation.
  339. */
  340. enum ieee80211_tx_status_flags {
  341. IEEE80211_TX_STATUS_TX_FILTERED = 1<<0,
  342. IEEE80211_TX_STATUS_ACK = 1<<1,
  343. IEEE80211_TX_STATUS_AMPDU = 1<<2,
  344. };
  345. /**
  346. * struct ieee80211_tx_status - transmit status
  347. *
  348. * As much information as possible should be provided for each transmitted
  349. * frame with ieee80211_tx_status().
  350. *
  351. * @control: a copy of the &struct ieee80211_tx_control passed to the driver
  352. * in the tx() callback.
  353. * @flags: transmit status flags, defined above
  354. * @retry_count: number of retries
  355. * @excessive_retries: set to 1 if the frame was retried many times
  356. * but not acknowledged
  357. * @ampdu_ack_len: number of aggregated frames.
  358. * relevant only if IEEE80211_TX_STATUS_AMPDU was set.
  359. * @ampdu_ack_map: block ack bit map for the aggregation.
  360. * relevant only if IEEE80211_TX_STATUS_AMPDU was set.
  361. * @ack_signal: signal strength of the ACK frame
  362. * @queue_length: ?? REMOVE
  363. * @queue_number: ?? REMOVE
  364. */
  365. struct ieee80211_tx_status {
  366. struct ieee80211_tx_control control;
  367. u8 flags;
  368. u8 retry_count;
  369. bool excessive_retries;
  370. u8 ampdu_ack_len;
  371. u64 ampdu_ack_map;
  372. int ack_signal;
  373. int queue_length;
  374. int queue_number;
  375. };
  376. /**
  377. * enum ieee80211_conf_flags - configuration flags
  378. *
  379. * Flags to define PHY configuration options
  380. *
  381. * @IEEE80211_CONF_SHORT_SLOT_TIME: use 802.11g short slot time
  382. * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported)
  383. * @IEEE80211_CONF_SUPPORT_HT_MODE: use 802.11n HT capabilities (if supported)
  384. */
  385. enum ieee80211_conf_flags {
  386. IEEE80211_CONF_SHORT_SLOT_TIME = (1<<0),
  387. IEEE80211_CONF_RADIOTAP = (1<<1),
  388. IEEE80211_CONF_SUPPORT_HT_MODE = (1<<2),
  389. };
  390. /**
  391. * struct ieee80211_conf - configuration of the device
  392. *
  393. * This struct indicates how the driver shall configure the hardware.
  394. *
  395. * @radio_enabled: when zero, driver is required to switch off the radio.
  396. * TODO make a flag
  397. * @beacon_int: beacon interval (TODO make interface config)
  398. * @flags: configuration flags defined above
  399. * @power_level: requested transmit power (in dBm)
  400. * @max_antenna_gain: maximum antenna gain (in dBi)
  401. * @antenna_sel_tx: transmit antenna selection, 0: default/diversity,
  402. * 1/2: antenna 0/1
  403. * @antenna_sel_rx: receive antenna selection, like @antenna_sel_tx
  404. * @ht_conf: describes current self configuration of 802.11n HT capabilies
  405. * @ht_bss_conf: describes current BSS configuration of 802.11n HT parameters
  406. * @channel: the channel to tune to
  407. */
  408. struct ieee80211_conf {
  409. int radio_enabled;
  410. int beacon_int;
  411. u32 flags;
  412. int power_level;
  413. int max_antenna_gain;
  414. u8 antenna_sel_tx;
  415. u8 antenna_sel_rx;
  416. struct ieee80211_channel *channel;
  417. struct ieee80211_ht_info ht_conf;
  418. struct ieee80211_ht_bss_info ht_bss_conf;
  419. };
  420. /**
  421. * enum ieee80211_if_types - types of 802.11 network interfaces
  422. *
  423. * @IEEE80211_IF_TYPE_INVALID: invalid interface type, not used
  424. * by mac80211 itself
  425. * @IEEE80211_IF_TYPE_AP: interface in AP mode.
  426. * @IEEE80211_IF_TYPE_MGMT: special interface for communication with hostap
  427. * daemon. Drivers should never see this type.
  428. * @IEEE80211_IF_TYPE_STA: interface in STA (client) mode.
  429. * @IEEE80211_IF_TYPE_IBSS: interface in IBSS (ad-hoc) mode.
  430. * @IEEE80211_IF_TYPE_MNTR: interface in monitor (rfmon) mode.
  431. * @IEEE80211_IF_TYPE_WDS: interface in WDS mode.
  432. * @IEEE80211_IF_TYPE_VLAN: VLAN interface bound to an AP, drivers
  433. * will never see this type.
  434. * @IEEE80211_IF_TYPE_MESH_POINT: 802.11s mesh point
  435. */
  436. enum ieee80211_if_types {
  437. IEEE80211_IF_TYPE_INVALID,
  438. IEEE80211_IF_TYPE_AP,
  439. IEEE80211_IF_TYPE_STA,
  440. IEEE80211_IF_TYPE_IBSS,
  441. IEEE80211_IF_TYPE_MESH_POINT,
  442. IEEE80211_IF_TYPE_MNTR,
  443. IEEE80211_IF_TYPE_WDS,
  444. IEEE80211_IF_TYPE_VLAN,
  445. };
  446. /**
  447. * struct ieee80211_vif - per-interface data
  448. *
  449. * Data in this structure is continually present for driver
  450. * use during the life of a virtual interface.
  451. *
  452. * @type: type of this virtual interface
  453. * @drv_priv: data area for driver use, will always be aligned to
  454. * sizeof(void *).
  455. */
  456. struct ieee80211_vif {
  457. enum ieee80211_if_types type;
  458. /* must be last */
  459. u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
  460. };
  461. static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
  462. {
  463. #ifdef CONFIG_MAC80211_MESH
  464. return vif->type == IEEE80211_IF_TYPE_MESH_POINT;
  465. #endif
  466. return false;
  467. }
  468. /**
  469. * struct ieee80211_if_init_conf - initial configuration of an interface
  470. *
  471. * @vif: pointer to a driver-use per-interface structure. The pointer
  472. * itself is also used for various functions including
  473. * ieee80211_beacon_get() and ieee80211_get_buffered_bc().
  474. * @type: one of &enum ieee80211_if_types constants. Determines the type of
  475. * added/removed interface.
  476. * @mac_addr: pointer to MAC address of the interface. This pointer is valid
  477. * until the interface is removed (i.e. it cannot be used after
  478. * remove_interface() callback was called for this interface).
  479. *
  480. * This structure is used in add_interface() and remove_interface()
  481. * callbacks of &struct ieee80211_hw.
  482. *
  483. * When you allow multiple interfaces to be added to your PHY, take care
  484. * that the hardware can actually handle multiple MAC addresses. However,
  485. * also take care that when there's no interface left with mac_addr != %NULL
  486. * you remove the MAC address from the device to avoid acknowledging packets
  487. * in pure monitor mode.
  488. */
  489. struct ieee80211_if_init_conf {
  490. enum ieee80211_if_types type;
  491. struct ieee80211_vif *vif;
  492. void *mac_addr;
  493. };
  494. /**
  495. * struct ieee80211_if_conf - configuration of an interface
  496. *
  497. * @type: type of the interface. This is always the same as was specified in
  498. * &struct ieee80211_if_init_conf. The type of an interface never changes
  499. * during the life of the interface; this field is present only for
  500. * convenience.
  501. * @bssid: BSSID of the network we are associated to/creating.
  502. * @ssid: used (together with @ssid_len) by drivers for hardware that
  503. * generate beacons independently. The pointer is valid only during the
  504. * config_interface() call, so copy the value somewhere if you need
  505. * it.
  506. * @ssid_len: length of the @ssid field.
  507. * @beacon: beacon template. Valid only if @host_gen_beacon_template in
  508. * &struct ieee80211_hw is set. The driver is responsible of freeing
  509. * the sk_buff.
  510. * @beacon_control: tx_control for the beacon template, this field is only
  511. * valid when the @beacon field was set.
  512. *
  513. * This structure is passed to the config_interface() callback of
  514. * &struct ieee80211_hw.
  515. */
  516. struct ieee80211_if_conf {
  517. int type;
  518. u8 *bssid;
  519. u8 *ssid;
  520. size_t ssid_len;
  521. struct sk_buff *beacon;
  522. struct ieee80211_tx_control *beacon_control;
  523. };
  524. /**
  525. * enum ieee80211_key_alg - key algorithm
  526. * @ALG_WEP: WEP40 or WEP104
  527. * @ALG_TKIP: TKIP
  528. * @ALG_CCMP: CCMP (AES)
  529. */
  530. enum ieee80211_key_alg {
  531. ALG_WEP,
  532. ALG_TKIP,
  533. ALG_CCMP,
  534. };
  535. /**
  536. * enum ieee80211_key_flags - key flags
  537. *
  538. * These flags are used for communication about keys between the driver
  539. * and mac80211, with the @flags parameter of &struct ieee80211_key_conf.
  540. *
  541. * @IEEE80211_KEY_FLAG_WMM_STA: Set by mac80211, this flag indicates
  542. * that the STA this key will be used with could be using QoS.
  543. * @IEEE80211_KEY_FLAG_GENERATE_IV: This flag should be set by the
  544. * driver to indicate that it requires IV generation for this
  545. * particular key.
  546. * @IEEE80211_KEY_FLAG_GENERATE_MMIC: This flag should be set by
  547. * the driver for a TKIP key if it requires Michael MIC
  548. * generation in software.
  549. */
  550. enum ieee80211_key_flags {
  551. IEEE80211_KEY_FLAG_WMM_STA = 1<<0,
  552. IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1,
  553. IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2,
  554. };
  555. /**
  556. * struct ieee80211_key_conf - key information
  557. *
  558. * This key information is given by mac80211 to the driver by
  559. * the set_key() callback in &struct ieee80211_ops.
  560. *
  561. * @hw_key_idx: To be set by the driver, this is the key index the driver
  562. * wants to be given when a frame is transmitted and needs to be
  563. * encrypted in hardware.
  564. * @alg: The key algorithm.
  565. * @flags: key flags, see &enum ieee80211_key_flags.
  566. * @keyidx: the key index (0-3)
  567. * @keylen: key material length
  568. * @key: key material
  569. */
  570. struct ieee80211_key_conf {
  571. enum ieee80211_key_alg alg;
  572. u8 hw_key_idx;
  573. u8 flags;
  574. s8 keyidx;
  575. u8 keylen;
  576. u8 key[0];
  577. };
  578. /**
  579. * enum set_key_cmd - key command
  580. *
  581. * Used with the set_key() callback in &struct ieee80211_ops, this
  582. * indicates whether a key is being removed or added.
  583. *
  584. * @SET_KEY: a key is set
  585. * @DISABLE_KEY: a key must be disabled
  586. */
  587. enum set_key_cmd {
  588. SET_KEY, DISABLE_KEY,
  589. };
  590. /**
  591. * enum sta_notify_cmd - sta notify command
  592. *
  593. * Used with the sta_notify() callback in &struct ieee80211_ops, this
  594. * indicates addition and removal of a station to station table
  595. *
  596. * @STA_NOTIFY_ADD: a station was added to the station table
  597. * @STA_NOTIFY_REMOVE: a station being removed from the station table
  598. */
  599. enum sta_notify_cmd {
  600. STA_NOTIFY_ADD, STA_NOTIFY_REMOVE
  601. };
  602. /**
  603. * enum ieee80211_tkip_key_type - get tkip key
  604. *
  605. * Used by drivers which need to get a tkip key for skb. Some drivers need a
  606. * phase 1 key, others need a phase 2 key. A single function allows the driver
  607. * to get the key, this enum indicates what type of key is required.
  608. *
  609. * @IEEE80211_TKIP_P1_KEY: the driver needs a phase 1 key
  610. * @IEEE80211_TKIP_P2_KEY: the driver needs a phase 2 key
  611. */
  612. enum ieee80211_tkip_key_type {
  613. IEEE80211_TKIP_P1_KEY,
  614. IEEE80211_TKIP_P2_KEY,
  615. };
  616. /**
  617. * enum ieee80211_hw_flags - hardware flags
  618. *
  619. * These flags are used to indicate hardware capabilities to
  620. * the stack. Generally, flags here should have their meaning
  621. * done in a way that the simplest hardware doesn't need setting
  622. * any particular flags. There are some exceptions to this rule,
  623. * however, so you are advised to review these flags carefully.
  624. *
  625. * @IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE:
  626. * The device only needs to be supplied with a beacon template.
  627. * If you need the host to generate each beacon then don't use
  628. * this flag and call ieee80211_beacon_get() when you need the
  629. * next beacon frame. Note that if you set this flag, you must
  630. * implement the set_tim() callback for powersave mode to work
  631. * properly.
  632. * This flag is only relevant for access-point mode.
  633. *
  634. * @IEEE80211_HW_RX_INCLUDES_FCS:
  635. * Indicates that received frames passed to the stack include
  636. * the FCS at the end.
  637. *
  638. * @IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING:
  639. * Some wireless LAN chipsets buffer broadcast/multicast frames
  640. * for power saving stations in the hardware/firmware and others
  641. * rely on the host system for such buffering. This option is used
  642. * to configure the IEEE 802.11 upper layer to buffer broadcast and
  643. * multicast frames when there are power saving stations so that
  644. * the driver can fetch them with ieee80211_get_buffered_bc(). Note
  645. * that not setting this flag works properly only when the
  646. * %IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE is also not set because
  647. * otherwise the stack will not know when the DTIM beacon was sent.
  648. *
  649. * @IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE:
  650. * Hardware is not capable of short slot operation on the 2.4 GHz band.
  651. *
  652. * @IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE:
  653. * Hardware is not capable of receiving frames with short preamble on
  654. * the 2.4 GHz band.
  655. */
  656. enum ieee80211_hw_flags {
  657. IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE = 1<<0,
  658. IEEE80211_HW_RX_INCLUDES_FCS = 1<<1,
  659. IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING = 1<<2,
  660. IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE = 1<<3,
  661. IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4,
  662. };
  663. /**
  664. * struct ieee80211_hw - hardware information and state
  665. *
  666. * This structure contains the configuration and hardware
  667. * information for an 802.11 PHY.
  668. *
  669. * @wiphy: This points to the &struct wiphy allocated for this
  670. * 802.11 PHY. You must fill in the @perm_addr and @dev
  671. * members of this structure using SET_IEEE80211_DEV()
  672. * and SET_IEEE80211_PERM_ADDR(). Additionally, all supported
  673. * bands (with channels, bitrates) are registered here.
  674. *
  675. * @conf: &struct ieee80211_conf, device configuration, don't use.
  676. *
  677. * @workqueue: single threaded workqueue available for driver use,
  678. * allocated by mac80211 on registration and flushed on
  679. * unregistration.
  680. *
  681. * @priv: pointer to private area that was allocated for driver use
  682. * along with this structure.
  683. *
  684. * @flags: hardware flags, see &enum ieee80211_hw_flags.
  685. *
  686. * @extra_tx_headroom: headroom to reserve in each transmit skb
  687. * for use by the driver (e.g. for transmit headers.)
  688. *
  689. * @channel_change_time: time (in microseconds) it takes to change channels.
  690. *
  691. * @max_rssi: Maximum value for ssi in RX information, use
  692. * negative numbers for dBm and 0 to indicate no support.
  693. *
  694. * @max_signal: like @max_rssi, but for the signal value.
  695. *
  696. * @max_noise: like @max_rssi, but for the noise value.
  697. *
  698. * @queues: number of available hardware transmit queues for
  699. * data packets. WMM/QoS requires at least four.
  700. *
  701. * @rate_control_algorithm: rate control algorithm for this hardware.
  702. * If unset (NULL), the default algorithm will be used. Must be
  703. * set before calling ieee80211_register_hw().
  704. *
  705. * @vif_data_size: size (in bytes) of the drv_priv data area
  706. * within &struct ieee80211_vif.
  707. */
  708. struct ieee80211_hw {
  709. struct ieee80211_conf conf;
  710. struct wiphy *wiphy;
  711. struct workqueue_struct *workqueue;
  712. const char *rate_control_algorithm;
  713. void *priv;
  714. u32 flags;
  715. unsigned int extra_tx_headroom;
  716. int channel_change_time;
  717. int vif_data_size;
  718. u8 queues;
  719. s8 max_rssi;
  720. s8 max_signal;
  721. s8 max_noise;
  722. };
  723. /**
  724. * SET_IEEE80211_DEV - set device for 802.11 hardware
  725. *
  726. * @hw: the &struct ieee80211_hw to set the device for
  727. * @dev: the &struct device of this 802.11 device
  728. */
  729. static inline void SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev)
  730. {
  731. set_wiphy_dev(hw->wiphy, dev);
  732. }
  733. /**
  734. * SET_IEEE80211_PERM_ADDR - set the permanenet MAC address for 802.11 hardware
  735. *
  736. * @hw: the &struct ieee80211_hw to set the MAC address for
  737. * @addr: the address to set
  738. */
  739. static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr)
  740. {
  741. memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN);
  742. }
  743. /**
  744. * DOC: Hardware crypto acceleration
  745. *
  746. * mac80211 is capable of taking advantage of many hardware
  747. * acceleration designs for encryption and decryption operations.
  748. *
  749. * The set_key() callback in the &struct ieee80211_ops for a given
  750. * device is called to enable hardware acceleration of encryption and
  751. * decryption. The callback takes an @address parameter that will be
  752. * the broadcast address for default keys, the other station's hardware
  753. * address for individual keys or the zero address for keys that will
  754. * be used only for transmission.
  755. * Multiple transmission keys with the same key index may be used when
  756. * VLANs are configured for an access point.
  757. *
  758. * The @local_address parameter will always be set to our own address,
  759. * this is only relevant if you support multiple local addresses.
  760. *
  761. * When transmitting, the TX control data will use the @hw_key_idx
  762. * selected by the driver by modifying the &struct ieee80211_key_conf
  763. * pointed to by the @key parameter to the set_key() function.
  764. *
  765. * The set_key() call for the %SET_KEY command should return 0 if
  766. * the key is now in use, -%EOPNOTSUPP or -%ENOSPC if it couldn't be
  767. * added; if you return 0 then hw_key_idx must be assigned to the
  768. * hardware key index, you are free to use the full u8 range.
  769. *
  770. * When the cmd is %DISABLE_KEY then it must succeed.
  771. *
  772. * Note that it is permissible to not decrypt a frame even if a key
  773. * for it has been uploaded to hardware, the stack will not make any
  774. * decision based on whether a key has been uploaded or not but rather
  775. * based on the receive flags.
  776. *
  777. * The &struct ieee80211_key_conf structure pointed to by the @key
  778. * parameter is guaranteed to be valid until another call to set_key()
  779. * removes it, but it can only be used as a cookie to differentiate
  780. * keys.
  781. *
  782. * In TKIP some HW need to be provided a phase 1 key, for RX decryption
  783. * acceleration (i.e. iwlwifi). Those drivers should provide update_tkip_key
  784. * handler.
  785. * The update_tkip_key() call updates the driver with the new phase 1 key.
  786. * This happens everytime the iv16 wraps around (every 65536 packets). The
  787. * set_key() call will happen only once for each key (unless the AP did
  788. * rekeying), it will not include a valid phase 1 key. The valid phase 1 key is
  789. * provided by udpate_tkip_key only. The trigger that makes mac80211 call this
  790. * handler is software decryption with wrap around of iv16.
  791. */
  792. /**
  793. * DOC: Frame filtering
  794. *
  795. * mac80211 requires to see many management frames for proper
  796. * operation, and users may want to see many more frames when
  797. * in monitor mode. However, for best CPU usage and power consumption,
  798. * having as few frames as possible percolate through the stack is
  799. * desirable. Hence, the hardware should filter as much as possible.
  800. *
  801. * To achieve this, mac80211 uses filter flags (see below) to tell
  802. * the driver's configure_filter() function which frames should be
  803. * passed to mac80211 and which should be filtered out.
  804. *
  805. * The configure_filter() callback is invoked with the parameters
  806. * @mc_count and @mc_list for the combined multicast address list
  807. * of all virtual interfaces, @changed_flags telling which flags
  808. * were changed and @total_flags with the new flag states.
  809. *
  810. * If your device has no multicast address filters your driver will
  811. * need to check both the %FIF_ALLMULTI flag and the @mc_count
  812. * parameter to see whether multicast frames should be accepted
  813. * or dropped.
  814. *
  815. * All unsupported flags in @total_flags must be cleared.
  816. * Hardware does not support a flag if it is incapable of _passing_
  817. * the frame to the stack. Otherwise the driver must ignore
  818. * the flag, but not clear it.
  819. * You must _only_ clear the flag (announce no support for the
  820. * flag to mac80211) if you are not able to pass the packet type
  821. * to the stack (so the hardware always filters it).
  822. * So for example, you should clear @FIF_CONTROL, if your hardware
  823. * always filters control frames. If your hardware always passes
  824. * control frames to the kernel and is incapable of filtering them,
  825. * you do _not_ clear the @FIF_CONTROL flag.
  826. * This rule applies to all other FIF flags as well.
  827. */
  828. /**
  829. * enum ieee80211_filter_flags - hardware filter flags
  830. *
  831. * These flags determine what the filter in hardware should be
  832. * programmed to let through and what should not be passed to the
  833. * stack. It is always safe to pass more frames than requested,
  834. * but this has negative impact on power consumption.
  835. *
  836. * @FIF_PROMISC_IN_BSS: promiscuous mode within your BSS,
  837. * think of the BSS as your network segment and then this corresponds
  838. * to the regular ethernet device promiscuous mode.
  839. *
  840. * @FIF_ALLMULTI: pass all multicast frames, this is used if requested
  841. * by the user or if the hardware is not capable of filtering by
  842. * multicast address.
  843. *
  844. * @FIF_FCSFAIL: pass frames with failed FCS (but you need to set the
  845. * %RX_FLAG_FAILED_FCS_CRC for them)
  846. *
  847. * @FIF_PLCPFAIL: pass frames with failed PLCP CRC (but you need to set
  848. * the %RX_FLAG_FAILED_PLCP_CRC for them
  849. *
  850. * @FIF_BCN_PRBRESP_PROMISC: This flag is set during scanning to indicate
  851. * to the hardware that it should not filter beacons or probe responses
  852. * by BSSID. Filtering them can greatly reduce the amount of processing
  853. * mac80211 needs to do and the amount of CPU wakeups, so you should
  854. * honour this flag if possible.
  855. *
  856. * @FIF_CONTROL: pass control frames, if PROMISC_IN_BSS is not set then
  857. * only those addressed to this station
  858. *
  859. * @FIF_OTHER_BSS: pass frames destined to other BSSes
  860. */
  861. enum ieee80211_filter_flags {
  862. FIF_PROMISC_IN_BSS = 1<<0,
  863. FIF_ALLMULTI = 1<<1,
  864. FIF_FCSFAIL = 1<<2,
  865. FIF_PLCPFAIL = 1<<3,
  866. FIF_BCN_PRBRESP_PROMISC = 1<<4,
  867. FIF_CONTROL = 1<<5,
  868. FIF_OTHER_BSS = 1<<6,
  869. };
  870. /**
  871. * enum ieee80211_ampdu_mlme_action - A-MPDU actions
  872. *
  873. * These flags are used with the ampdu_action() callback in
  874. * &struct ieee80211_ops to indicate which action is needed.
  875. * @IEEE80211_AMPDU_RX_START: start Rx aggregation
  876. * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation
  877. * @IEEE80211_AMPDU_TX_START: start Tx aggregation
  878. * @IEEE80211_AMPDU_TX_STOP: stop Tx aggregation
  879. */
  880. enum ieee80211_ampdu_mlme_action {
  881. IEEE80211_AMPDU_RX_START,
  882. IEEE80211_AMPDU_RX_STOP,
  883. IEEE80211_AMPDU_TX_START,
  884. IEEE80211_AMPDU_TX_STOP,
  885. };
  886. /**
  887. * struct ieee80211_ops - callbacks from mac80211 to the driver
  888. *
  889. * This structure contains various callbacks that the driver may
  890. * handle or, in some cases, must handle, for example to configure
  891. * the hardware to a new channel or to transmit a frame.
  892. *
  893. * @tx: Handler that 802.11 module calls for each transmitted frame.
  894. * skb contains the buffer starting from the IEEE 802.11 header.
  895. * The low-level driver should send the frame out based on
  896. * configuration in the TX control data. Must be implemented and
  897. * atomic.
  898. *
  899. * @start: Called before the first netdevice attached to the hardware
  900. * is enabled. This should turn on the hardware and must turn on
  901. * frame reception (for possibly enabled monitor interfaces.)
  902. * Returns negative error codes, these may be seen in userspace,
  903. * or zero.
  904. * When the device is started it should not have a MAC address
  905. * to avoid acknowledging frames before a non-monitor device
  906. * is added.
  907. * Must be implemented.
  908. *
  909. * @stop: Called after last netdevice attached to the hardware
  910. * is disabled. This should turn off the hardware (at least
  911. * it must turn off frame reception.)
  912. * May be called right after add_interface if that rejects
  913. * an interface.
  914. * Must be implemented.
  915. *
  916. * @add_interface: Called when a netdevice attached to the hardware is
  917. * enabled. Because it is not called for monitor mode devices, @open
  918. * and @stop must be implemented.
  919. * The driver should perform any initialization it needs before
  920. * the device can be enabled. The initial configuration for the
  921. * interface is given in the conf parameter.
  922. * The callback may refuse to add an interface by returning a
  923. * negative error code (which will be seen in userspace.)
  924. * Must be implemented.
  925. *
  926. * @remove_interface: Notifies a driver that an interface is going down.
  927. * The @stop callback is called after this if it is the last interface
  928. * and no monitor interfaces are present.
  929. * When all interfaces are removed, the MAC address in the hardware
  930. * must be cleared so the device no longer acknowledges packets,
  931. * the mac_addr member of the conf structure is, however, set to the
  932. * MAC address of the device going away.
  933. * Hence, this callback must be implemented.
  934. *
  935. * @config: Handler for configuration requests. IEEE 802.11 code calls this
  936. * function to change hardware configuration, e.g., channel.
  937. *
  938. * @config_interface: Handler for configuration requests related to interfaces
  939. * (e.g. BSSID changes.)
  940. *
  941. * @bss_info_changed: Handler for configuration requests related to BSS
  942. * parameters that may vary during BSS's lifespan, and may affect low
  943. * level driver (e.g. assoc/disassoc status, erp parameters).
  944. * This function should not be used if no BSS has been set, unless
  945. * for association indication. The @changed parameter indicates which
  946. * of the bss parameters has changed when a call is made. This callback
  947. * has to be atomic.
  948. *
  949. * @configure_filter: Configure the device's RX filter.
  950. * See the section "Frame filtering" for more information.
  951. * This callback must be implemented and atomic.
  952. *
  953. * @set_tim: Set TIM bit. If the hardware/firmware takes care of beacon
  954. * generation (that is, %IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE is set)
  955. * mac80211 calls this function when a TIM bit must be set or cleared
  956. * for a given AID. Must be atomic.
  957. *
  958. * @set_key: See the section "Hardware crypto acceleration"
  959. * This callback can sleep, and is only called between add_interface
  960. * and remove_interface calls, i.e. while the interface with the
  961. * given local_address is enabled.
  962. *
  963. * @update_tkip_key: See the section "Hardware crypto acceleration"
  964. * This callback will be called in the context of Rx. Called for drivers
  965. * which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY.
  966. *
  967. * @hw_scan: Ask the hardware to service the scan request, no need to start
  968. * the scan state machine in stack. The scan must honour the channel
  969. * configuration done by the regulatory agent in the wiphy's registered
  970. * bands.
  971. *
  972. * @get_stats: return low-level statistics
  973. *
  974. * @get_tkip_seq: If your device implements TKIP encryption in hardware this
  975. * callback should be provided to read the TKIP transmit IVs (both IV32
  976. * and IV16) for the given key from hardware.
  977. *
  978. * @set_rts_threshold: Configuration of RTS threshold (if device needs it)
  979. *
  980. * @set_frag_threshold: Configuration of fragmentation threshold. Assign this if
  981. * the device does fragmentation by itself; if this method is assigned then
  982. * the stack will not do fragmentation.
  983. *
  984. * @set_retry_limit: Configuration of retry limits (if device needs it)
  985. *
  986. * @sta_notify: Notifies low level driver about addition or removal
  987. * of assocaited station or AP.
  988. *
  989. * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
  990. * bursting) for a hardware TX queue. The @queue parameter uses the
  991. * %IEEE80211_TX_QUEUE_* constants. Must be atomic.
  992. *
  993. * @get_tx_stats: Get statistics of the current TX queue status. This is used
  994. * to get number of currently queued packets (queue length), maximum queue
  995. * size (limit), and total number of packets sent using each TX queue
  996. * (count). This information is used for WMM to find out which TX
  997. * queues have room for more packets and by hostapd to provide
  998. * statistics about the current queueing state to external programs.
  999. *
  1000. * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently,
  1001. * this is only used for IBSS mode debugging and, as such, is not a
  1002. * required function. Must be atomic.
  1003. *
  1004. * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize
  1005. * with other STAs in the IBSS. This is only used in IBSS mode. This
  1006. * function is optional if the firmware/hardware takes full care of
  1007. * TSF synchronization.
  1008. *
  1009. * @beacon_update: Setup beacon data for IBSS beacons. Unlike access point,
  1010. * IBSS uses a fixed beacon frame which is configured using this
  1011. * function.
  1012. * If the driver returns success (0) from this callback, it owns
  1013. * the skb. That means the driver is responsible to kfree_skb() it.
  1014. * The control structure is not dynamically allocated. That means the
  1015. * driver does not own the pointer and if it needs it somewhere
  1016. * outside of the context of this function, it must copy it
  1017. * somewhere else.
  1018. * This handler is required only for IBSS mode.
  1019. *
  1020. * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us.
  1021. * This is needed only for IBSS mode and the result of this function is
  1022. * used to determine whether to reply to Probe Requests.
  1023. *
  1024. * @conf_ht: Configures low level driver with 802.11n HT data. Must be atomic.
  1025. *
  1026. * @ampdu_action: Perform a certain A-MPDU action
  1027. * The RA/TID combination determines the destination and TID we want
  1028. * the ampdu action to be performed for. The action is defined through
  1029. * ieee80211_ampdu_mlme_action. Starting sequence number (@ssn)
  1030. * is the first frame we expect to perform the action on. notice
  1031. * that TX/RX_STOP can pass NULL for this parameter.
  1032. */
  1033. struct ieee80211_ops {
  1034. int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb,
  1035. struct ieee80211_tx_control *control);
  1036. int (*start)(struct ieee80211_hw *hw);
  1037. void (*stop)(struct ieee80211_hw *hw);
  1038. int (*add_interface)(struct ieee80211_hw *hw,
  1039. struct ieee80211_if_init_conf *conf);
  1040. void (*remove_interface)(struct ieee80211_hw *hw,
  1041. struct ieee80211_if_init_conf *conf);
  1042. int (*config)(struct ieee80211_hw *hw, struct ieee80211_conf *conf);
  1043. int (*config_interface)(struct ieee80211_hw *hw,
  1044. struct ieee80211_vif *vif,
  1045. struct ieee80211_if_conf *conf);
  1046. void (*bss_info_changed)(struct ieee80211_hw *hw,
  1047. struct ieee80211_vif *vif,
  1048. struct ieee80211_bss_conf *info,
  1049. u32 changed);
  1050. void (*configure_filter)(struct ieee80211_hw *hw,
  1051. unsigned int changed_flags,
  1052. unsigned int *total_flags,
  1053. int mc_count, struct dev_addr_list *mc_list);
  1054. int (*set_tim)(struct ieee80211_hw *hw, int aid, int set);
  1055. int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd,
  1056. const u8 *local_address, const u8 *address,
  1057. struct ieee80211_key_conf *key);
  1058. void (*update_tkip_key)(struct ieee80211_hw *hw,
  1059. struct ieee80211_key_conf *conf, const u8 *address,
  1060. u32 iv32, u16 *phase1key);
  1061. int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len);
  1062. int (*get_stats)(struct ieee80211_hw *hw,
  1063. struct ieee80211_low_level_stats *stats);
  1064. void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx,
  1065. u32 *iv32, u16 *iv16);
  1066. int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value);
  1067. int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value);
  1068. int (*set_retry_limit)(struct ieee80211_hw *hw,
  1069. u32 short_retry, u32 long_retr);
  1070. void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  1071. enum sta_notify_cmd, const u8 *addr);
  1072. int (*conf_tx)(struct ieee80211_hw *hw, int queue,
  1073. const struct ieee80211_tx_queue_params *params);
  1074. int (*get_tx_stats)(struct ieee80211_hw *hw,
  1075. struct ieee80211_tx_queue_stats *stats);
  1076. u64 (*get_tsf)(struct ieee80211_hw *hw);
  1077. void (*reset_tsf)(struct ieee80211_hw *hw);
  1078. int (*beacon_update)(struct ieee80211_hw *hw,
  1079. struct sk_buff *skb,
  1080. struct ieee80211_tx_control *control);
  1081. int (*tx_last_beacon)(struct ieee80211_hw *hw);
  1082. int (*conf_ht)(struct ieee80211_hw *hw, struct ieee80211_conf *conf);
  1083. int (*ampdu_action)(struct ieee80211_hw *hw,
  1084. enum ieee80211_ampdu_mlme_action action,
  1085. const u8 *addr, u16 tid, u16 *ssn);
  1086. };
  1087. /**
  1088. * ieee80211_alloc_hw - Allocate a new hardware device
  1089. *
  1090. * This must be called once for each hardware device. The returned pointer
  1091. * must be used to refer to this device when calling other functions.
  1092. * mac80211 allocates a private data area for the driver pointed to by
  1093. * @priv in &struct ieee80211_hw, the size of this area is given as
  1094. * @priv_data_len.
  1095. *
  1096. * @priv_data_len: length of private data
  1097. * @ops: callbacks for this device
  1098. */
  1099. struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
  1100. const struct ieee80211_ops *ops);
  1101. /**
  1102. * ieee80211_register_hw - Register hardware device
  1103. *
  1104. * You must call this function before any other functions in
  1105. * mac80211. Note that before a hardware can be registered, you
  1106. * need to fill the contained wiphy's information.
  1107. *
  1108. * @hw: the device to register as returned by ieee80211_alloc_hw()
  1109. */
  1110. int ieee80211_register_hw(struct ieee80211_hw *hw);
  1111. #ifdef CONFIG_MAC80211_LEDS
  1112. extern char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw);
  1113. extern char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw);
  1114. extern char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw);
  1115. extern char *__ieee80211_get_radio_led_name(struct ieee80211_hw *hw);
  1116. #endif
  1117. /**
  1118. * ieee80211_get_tx_led_name - get name of TX LED
  1119. *
  1120. * mac80211 creates a transmit LED trigger for each wireless hardware
  1121. * that can be used to drive LEDs if your driver registers a LED device.
  1122. * This function returns the name (or %NULL if not configured for LEDs)
  1123. * of the trigger so you can automatically link the LED device.
  1124. *
  1125. * @hw: the hardware to get the LED trigger name for
  1126. */
  1127. static inline char *ieee80211_get_tx_led_name(struct ieee80211_hw *hw)
  1128. {
  1129. #ifdef CONFIG_MAC80211_LEDS
  1130. return __ieee80211_get_tx_led_name(hw);
  1131. #else
  1132. return NULL;
  1133. #endif
  1134. }
  1135. /**
  1136. * ieee80211_get_rx_led_name - get name of RX LED
  1137. *
  1138. * mac80211 creates a receive LED trigger for each wireless hardware
  1139. * that can be used to drive LEDs if your driver registers a LED device.
  1140. * This function returns the name (or %NULL if not configured for LEDs)
  1141. * of the trigger so you can automatically link the LED device.
  1142. *
  1143. * @hw: the hardware to get the LED trigger name for
  1144. */
  1145. static inline char *ieee80211_get_rx_led_name(struct ieee80211_hw *hw)
  1146. {
  1147. #ifdef CONFIG_MAC80211_LEDS
  1148. return __ieee80211_get_rx_led_name(hw);
  1149. #else
  1150. return NULL;
  1151. #endif
  1152. }
  1153. /**
  1154. * ieee80211_get_assoc_led_name - get name of association LED
  1155. *
  1156. * mac80211 creates a association LED trigger for each wireless hardware
  1157. * that can be used to drive LEDs if your driver registers a LED device.
  1158. * This function returns the name (or %NULL if not configured for LEDs)
  1159. * of the trigger so you can automatically link the LED device.
  1160. *
  1161. * @hw: the hardware to get the LED trigger name for
  1162. */
  1163. static inline char *ieee80211_get_assoc_led_name(struct ieee80211_hw *hw)
  1164. {
  1165. #ifdef CONFIG_MAC80211_LEDS
  1166. return __ieee80211_get_assoc_led_name(hw);
  1167. #else
  1168. return NULL;
  1169. #endif
  1170. }
  1171. /**
  1172. * ieee80211_get_radio_led_name - get name of radio LED
  1173. *
  1174. * mac80211 creates a radio change LED trigger for each wireless hardware
  1175. * that can be used to drive LEDs if your driver registers a LED device.
  1176. * This function returns the name (or %NULL if not configured for LEDs)
  1177. * of the trigger so you can automatically link the LED device.
  1178. *
  1179. * @hw: the hardware to get the LED trigger name for
  1180. */
  1181. static inline char *ieee80211_get_radio_led_name(struct ieee80211_hw *hw)
  1182. {
  1183. #ifdef CONFIG_MAC80211_LEDS
  1184. return __ieee80211_get_radio_led_name(hw);
  1185. #else
  1186. return NULL;
  1187. #endif
  1188. }
  1189. /**
  1190. * ieee80211_unregister_hw - Unregister a hardware device
  1191. *
  1192. * This function instructs mac80211 to free allocated resources
  1193. * and unregister netdevices from the networking subsystem.
  1194. *
  1195. * @hw: the hardware to unregister
  1196. */
  1197. void ieee80211_unregister_hw(struct ieee80211_hw *hw);
  1198. /**
  1199. * ieee80211_free_hw - free hardware descriptor
  1200. *
  1201. * This function frees everything that was allocated, including the
  1202. * private data for the driver. You must call ieee80211_unregister_hw()
  1203. * before calling this function
  1204. *
  1205. * @hw: the hardware to free
  1206. */
  1207. void ieee80211_free_hw(struct ieee80211_hw *hw);
  1208. /* trick to avoid symbol clashes with the ieee80211 subsystem */
  1209. void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
  1210. struct ieee80211_rx_status *status);
  1211. /**
  1212. * ieee80211_rx - receive frame
  1213. *
  1214. * Use this function to hand received frames to mac80211. The receive
  1215. * buffer in @skb must start with an IEEE 802.11 header or a radiotap
  1216. * header if %RX_FLAG_RADIOTAP is set in the @status flags.
  1217. *
  1218. * This function may not be called in IRQ context. Calls to this function
  1219. * for a single hardware must be synchronized against each other. Calls
  1220. * to this function and ieee80211_rx_irqsafe() may not be mixed for a
  1221. * single hardware.
  1222. *
  1223. * @hw: the hardware this frame came in on
  1224. * @skb: the buffer to receive, owned by mac80211 after this call
  1225. * @status: status of this frame; the status pointer need not be valid
  1226. * after this function returns
  1227. */
  1228. static inline void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
  1229. struct ieee80211_rx_status *status)
  1230. {
  1231. __ieee80211_rx(hw, skb, status);
  1232. }
  1233. /**
  1234. * ieee80211_rx_irqsafe - receive frame
  1235. *
  1236. * Like ieee80211_rx() but can be called in IRQ context
  1237. * (internally defers to a tasklet.)
  1238. *
  1239. * Calls to this function and ieee80211_rx() may not be mixed for a
  1240. * single hardware.
  1241. *
  1242. * @hw: the hardware this frame came in on
  1243. * @skb: the buffer to receive, owned by mac80211 after this call
  1244. * @status: status of this frame; the status pointer need not be valid
  1245. * after this function returns and is not freed by mac80211,
  1246. * it is recommended that it points to a stack area
  1247. */
  1248. void ieee80211_rx_irqsafe(struct ieee80211_hw *hw,
  1249. struct sk_buff *skb,
  1250. struct ieee80211_rx_status *status);
  1251. /**
  1252. * ieee80211_tx_status - transmit status callback
  1253. *
  1254. * Call this function for all transmitted frames after they have been
  1255. * transmitted. It is permissible to not call this function for
  1256. * multicast frames but this can affect statistics.
  1257. *
  1258. * This function may not be called in IRQ context. Calls to this function
  1259. * for a single hardware must be synchronized against each other. Calls
  1260. * to this function and ieee80211_tx_status_irqsafe() may not be mixed
  1261. * for a single hardware.
  1262. *
  1263. * @hw: the hardware the frame was transmitted by
  1264. * @skb: the frame that was transmitted, owned by mac80211 after this call
  1265. * @status: status information for this frame; the status pointer need not
  1266. * be valid after this function returns and is not freed by mac80211,
  1267. * it is recommended that it points to a stack area
  1268. */
  1269. void ieee80211_tx_status(struct ieee80211_hw *hw,
  1270. struct sk_buff *skb,
  1271. struct ieee80211_tx_status *status);
  1272. /**
  1273. * ieee80211_tx_status_irqsafe - irq-safe transmit status callback
  1274. *
  1275. * Like ieee80211_tx_status() but can be called in IRQ context
  1276. * (internally defers to a tasklet.)
  1277. *
  1278. * Calls to this function and ieee80211_tx_status() may not be mixed for a
  1279. * single hardware.
  1280. *
  1281. * @hw: the hardware the frame was transmitted by
  1282. * @skb: the frame that was transmitted, owned by mac80211 after this call
  1283. * @status: status information for this frame; the status pointer need not
  1284. * be valid after this function returns and is not freed by mac80211,
  1285. * it is recommended that it points to a stack area
  1286. */
  1287. void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
  1288. struct sk_buff *skb,
  1289. struct ieee80211_tx_status *status);
  1290. /**
  1291. * ieee80211_beacon_get - beacon generation function
  1292. * @hw: pointer obtained from ieee80211_alloc_hw().
  1293. * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
  1294. * @control: will be filled with information needed to send this beacon.
  1295. *
  1296. * If the beacon frames are generated by the host system (i.e., not in
  1297. * hardware/firmware), the low-level driver uses this function to receive
  1298. * the next beacon frame from the 802.11 code. The low-level is responsible
  1299. * for calling this function before beacon data is needed (e.g., based on
  1300. * hardware interrupt). Returned skb is used only once and low-level driver
  1301. * is responsible of freeing it.
  1302. */
  1303. struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
  1304. struct ieee80211_vif *vif,
  1305. struct ieee80211_tx_control *control);
  1306. /**
  1307. * ieee80211_rts_get - RTS frame generation function
  1308. * @hw: pointer obtained from ieee80211_alloc_hw().
  1309. * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
  1310. * @frame: pointer to the frame that is going to be protected by the RTS.
  1311. * @frame_len: the frame length (in octets).
  1312. * @frame_txctl: &struct ieee80211_tx_control of the frame.
  1313. * @rts: The buffer where to store the RTS frame.
  1314. *
  1315. * If the RTS frames are generated by the host system (i.e., not in
  1316. * hardware/firmware), the low-level driver uses this function to receive
  1317. * the next RTS frame from the 802.11 code. The low-level is responsible
  1318. * for calling this function before and RTS frame is needed.
  1319. */
  1320. void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  1321. const void *frame, size_t frame_len,
  1322. const struct ieee80211_tx_control *frame_txctl,
  1323. struct ieee80211_rts *rts);
  1324. /**
  1325. * ieee80211_rts_duration - Get the duration field for an RTS frame
  1326. * @hw: pointer obtained from ieee80211_alloc_hw().
  1327. * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
  1328. * @frame_len: the length of the frame that is going to be protected by the RTS.
  1329. * @frame_txctl: &struct ieee80211_tx_control of the frame.
  1330. *
  1331. * If the RTS is generated in firmware, but the host system must provide
  1332. * the duration field, the low-level driver uses this function to receive
  1333. * the duration field value in little-endian byteorder.
  1334. */
  1335. __le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
  1336. struct ieee80211_vif *vif, size_t frame_len,
  1337. const struct ieee80211_tx_control *frame_txctl);
  1338. /**
  1339. * ieee80211_ctstoself_get - CTS-to-self frame generation function
  1340. * @hw: pointer obtained from ieee80211_alloc_hw().
  1341. * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
  1342. * @frame: pointer to the frame that is going to be protected by the CTS-to-self.
  1343. * @frame_len: the frame length (in octets).
  1344. * @frame_txctl: &struct ieee80211_tx_control of the frame.
  1345. * @cts: The buffer where to store the CTS-to-self frame.
  1346. *
  1347. * If the CTS-to-self frames are generated by the host system (i.e., not in
  1348. * hardware/firmware), the low-level driver uses this function to receive
  1349. * the next CTS-to-self frame from the 802.11 code. The low-level is responsible
  1350. * for calling this function before and CTS-to-self frame is needed.
  1351. */
  1352. void ieee80211_ctstoself_get(struct ieee80211_hw *hw,
  1353. struct ieee80211_vif *vif,
  1354. const void *frame, size_t frame_len,
  1355. const struct ieee80211_tx_control *frame_txctl,
  1356. struct ieee80211_cts *cts);
  1357. /**
  1358. * ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame
  1359. * @hw: pointer obtained from ieee80211_alloc_hw().
  1360. * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
  1361. * @frame_len: the length of the frame that is going to be protected by the CTS-to-self.
  1362. * @frame_txctl: &struct ieee80211_tx_control of the frame.
  1363. *
  1364. * If the CTS-to-self is generated in firmware, but the host system must provide
  1365. * the duration field, the low-level driver uses this function to receive
  1366. * the duration field value in little-endian byteorder.
  1367. */
  1368. __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
  1369. struct ieee80211_vif *vif,
  1370. size_t frame_len,
  1371. const struct ieee80211_tx_control *frame_txctl);
  1372. /**
  1373. * ieee80211_generic_frame_duration - Calculate the duration field for a frame
  1374. * @hw: pointer obtained from ieee80211_alloc_hw().
  1375. * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
  1376. * @frame_len: the length of the frame.
  1377. * @rate: the rate at which the frame is going to be transmitted.
  1378. *
  1379. * Calculate the duration field of some generic frame, given its
  1380. * length and transmission rate (in 100kbps).
  1381. */
  1382. __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
  1383. struct ieee80211_vif *vif,
  1384. size_t frame_len,
  1385. struct ieee80211_rate *rate);
  1386. /**
  1387. * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames
  1388. * @hw: pointer as obtained from ieee80211_alloc_hw().
  1389. * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
  1390. * @control: will be filled with information needed to send returned frame.
  1391. *
  1392. * Function for accessing buffered broadcast and multicast frames. If
  1393. * hardware/firmware does not implement buffering of broadcast/multicast
  1394. * frames when power saving is used, 802.11 code buffers them in the host
  1395. * memory. The low-level driver uses this function to fetch next buffered
  1396. * frame. In most cases, this is used when generating beacon frame. This
  1397. * function returns a pointer to the next buffered skb or NULL if no more
  1398. * buffered frames are available.
  1399. *
  1400. * Note: buffered frames are returned only after DTIM beacon frame was
  1401. * generated with ieee80211_beacon_get() and the low-level driver must thus
  1402. * call ieee80211_beacon_get() first. ieee80211_get_buffered_bc() returns
  1403. * NULL if the previous generated beacon was not DTIM, so the low-level driver
  1404. * does not need to check for DTIM beacons separately and should be able to
  1405. * use common code for all beacons.
  1406. */
  1407. struct sk_buff *
  1408. ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  1409. struct ieee80211_tx_control *control);
  1410. /**
  1411. * ieee80211_get_hdrlen_from_skb - get header length from data
  1412. *
  1413. * Given an skb with a raw 802.11 header at the data pointer this function
  1414. * returns the 802.11 header length in bytes (not including encryption
  1415. * headers). If the data in the sk_buff is too short to contain a valid 802.11
  1416. * header the function returns 0.
  1417. *
  1418. * @skb: the frame
  1419. */
  1420. int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
  1421. /**
  1422. * ieee80211_get_hdrlen - get header length from frame control
  1423. *
  1424. * This function returns the 802.11 header length in bytes (not including
  1425. * encryption headers.)
  1426. *
  1427. * @fc: the frame control field (in CPU endianness)
  1428. */
  1429. int ieee80211_get_hdrlen(u16 fc);
  1430. /**
  1431. * ieee80211_get_tkip_key - get a TKIP rc4 for skb
  1432. *
  1433. * This function computes a TKIP rc4 key for an skb. It computes
  1434. * a phase 1 key if needed (iv16 wraps around). This function is to
  1435. * be used by drivers which can do HW encryption but need to compute
  1436. * to phase 1/2 key in SW.
  1437. *
  1438. * @keyconf: the parameter passed with the set key
  1439. * @skb: the skb for which the key is needed
  1440. * @rc4key: a buffer to which the key will be written
  1441. */
  1442. void ieee80211_get_tkip_key(struct ieee80211_key_conf *keyconf,
  1443. struct sk_buff *skb,
  1444. enum ieee80211_tkip_key_type type, u8 *key);
  1445. /**
  1446. * ieee80211_wake_queue - wake specific queue
  1447. * @hw: pointer as obtained from ieee80211_alloc_hw().
  1448. * @queue: queue number (counted from zero).
  1449. *
  1450. * Drivers should use this function instead of netif_wake_queue.
  1451. */
  1452. void ieee80211_wake_queue(struct ieee80211_hw *hw, int queue);
  1453. /**
  1454. * ieee80211_stop_queue - stop specific queue
  1455. * @hw: pointer as obtained from ieee80211_alloc_hw().
  1456. * @queue: queue number (counted from zero).
  1457. *
  1458. * Drivers should use this function instead of netif_stop_queue.
  1459. */
  1460. void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue);
  1461. /**
  1462. * ieee80211_start_queues - start all queues
  1463. * @hw: pointer to as obtained from ieee80211_alloc_hw().
  1464. *
  1465. * Drivers should use this function instead of netif_start_queue.
  1466. */
  1467. void ieee80211_start_queues(struct ieee80211_hw *hw);
  1468. /**
  1469. * ieee80211_stop_queues - stop all queues
  1470. * @hw: pointer as obtained from ieee80211_alloc_hw().
  1471. *
  1472. * Drivers should use this function instead of netif_stop_queue.
  1473. */
  1474. void ieee80211_stop_queues(struct ieee80211_hw *hw);
  1475. /**
  1476. * ieee80211_wake_queues - wake all queues
  1477. * @hw: pointer as obtained from ieee80211_alloc_hw().
  1478. *
  1479. * Drivers should use this function instead of netif_wake_queue.
  1480. */
  1481. void ieee80211_wake_queues(struct ieee80211_hw *hw);
  1482. /**
  1483. * ieee80211_scan_completed - completed hardware scan
  1484. *
  1485. * When hardware scan offload is used (i.e. the hw_scan() callback is
  1486. * assigned) this function needs to be called by the driver to notify
  1487. * mac80211 that the scan finished.
  1488. *
  1489. * @hw: the hardware that finished the scan
  1490. */
  1491. void ieee80211_scan_completed(struct ieee80211_hw *hw);
  1492. /**
  1493. * ieee80211_iterate_active_interfaces - iterate active interfaces
  1494. *
  1495. * This function iterates over the interfaces associated with a given
  1496. * hardware that are currently active and calls the callback for them.
  1497. *
  1498. * @hw: the hardware struct of which the interfaces should be iterated over
  1499. * @iterator: the iterator function to call, cannot sleep
  1500. * @data: first argument of the iterator function
  1501. */
  1502. void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw,
  1503. void (*iterator)(void *data, u8 *mac,
  1504. struct ieee80211_vif *vif),
  1505. void *data);
  1506. /**
  1507. * ieee80211_start_tx_ba_session - Start a tx Block Ack session.
  1508. * @hw: pointer as obtained from ieee80211_alloc_hw().
  1509. * @ra: receiver address of the BA session recipient
  1510. * @tid: the TID to BA on.
  1511. * @return: success if addBA request was sent, failure otherwise
  1512. *
  1513. * Although mac80211/low level driver/user space application can estimate
  1514. * the need to start aggregation on a certain RA/TID, the session level
  1515. * will be managed by the mac80211.
  1516. */
  1517. int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid);
  1518. /**
  1519. * ieee80211_start_tx_ba_cb - low level driver ready to aggregate.
  1520. * @hw: pointer as obtained from ieee80211_alloc_hw().
  1521. * @ra: receiver address of the BA session recipient.
  1522. * @tid: the TID to BA on.
  1523. *
  1524. * This function must be called by low level driver once it has
  1525. * finished with preparations for the BA session.
  1526. */
  1527. void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid);
  1528. /**
  1529. * ieee80211_start_tx_ba_cb_irqsafe - low level driver ready to aggregate.
  1530. * @hw: pointer as obtained from ieee80211_alloc_hw().
  1531. * @ra: receiver address of the BA session recipient.
  1532. * @tid: the TID to BA on.
  1533. *
  1534. * This function must be called by low level driver once it has
  1535. * finished with preparations for the BA session.
  1536. * This version of the function is irq safe.
  1537. */
  1538. void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra,
  1539. u16 tid);
  1540. /**
  1541. * ieee80211_stop_tx_ba_session - Stop a Block Ack session.
  1542. * @hw: pointer as obtained from ieee80211_alloc_hw().
  1543. * @ra: receiver address of the BA session recipient
  1544. * @tid: the TID to stop BA.
  1545. * @initiator: if indicates initiator DELBA frame will be sent.
  1546. * @return: error if no sta with matching da found, success otherwise
  1547. *
  1548. * Although mac80211/low level driver/user space application can estimate
  1549. * the need to stop aggregation on a certain RA/TID, the session level
  1550. * will be managed by the mac80211.
  1551. */
  1552. int ieee80211_stop_tx_ba_session(struct ieee80211_hw *hw,
  1553. u8 *ra, u16 tid,
  1554. enum ieee80211_back_parties initiator);
  1555. /**
  1556. * ieee80211_stop_tx_ba_cb - low level driver ready to stop aggregate.
  1557. * @hw: pointer as obtained from ieee80211_alloc_hw().
  1558. * @ra: receiver address of the BA session recipient.
  1559. * @tid: the desired TID to BA on.
  1560. *
  1561. * This function must be called by low level driver once it has
  1562. * finished with preparations for the BA session tear down.
  1563. */
  1564. void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid);
  1565. /**
  1566. * ieee80211_stop_tx_ba_cb_irqsafe - low level driver ready to stop aggregate.
  1567. * @hw: pointer as obtained from ieee80211_alloc_hw().
  1568. * @ra: receiver address of the BA session recipient.
  1569. * @tid: the desired TID to BA on.
  1570. *
  1571. * This function must be called by low level driver once it has
  1572. * finished with preparations for the BA session tear down.
  1573. * This version of the function is irq safe.
  1574. */
  1575. void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra,
  1576. u16 tid);
  1577. #endif /* MAC80211_H */