rt2x00.h 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320
  1. /*
  2. Copyright (C) 2010 Willow Garage <http://www.willowgarage.com>
  3. Copyright (C) 2004 - 2010 Ivo van Doorn <IvDoorn@gmail.com>
  4. Copyright (C) 2004 - 2009 Gertjan van Wingerde <gwingerde@gmail.com>
  5. <http://rt2x00.serialmonkey.com>
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the
  16. Free Software Foundation, Inc.,
  17. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. */
  19. /*
  20. Module: rt2x00
  21. Abstract: rt2x00 global information.
  22. */
  23. #ifndef RT2X00_H
  24. #define RT2X00_H
  25. #include <linux/bitops.h>
  26. #include <linux/interrupt.h>
  27. #include <linux/skbuff.h>
  28. #include <linux/workqueue.h>
  29. #include <linux/firmware.h>
  30. #include <linux/leds.h>
  31. #include <linux/mutex.h>
  32. #include <linux/etherdevice.h>
  33. #include <linux/input-polldev.h>
  34. #include <linux/kfifo.h>
  35. #include <linux/timer.h>
  36. #include <net/mac80211.h>
  37. #include "rt2x00debug.h"
  38. #include "rt2x00dump.h"
  39. #include "rt2x00leds.h"
  40. #include "rt2x00reg.h"
  41. #include "rt2x00queue.h"
  42. /*
  43. * Module information.
  44. */
  45. #define DRV_VERSION "2.3.0"
  46. #define DRV_PROJECT "http://rt2x00.serialmonkey.com"
  47. /*
  48. * Debug definitions.
  49. * Debug output has to be enabled during compile time.
  50. */
  51. #define DEBUG_PRINTK_MSG(__dev, __kernlvl, __lvl, __msg, __args...) \
  52. printk(__kernlvl "%s -> %s: %s - " __msg, \
  53. wiphy_name((__dev)->hw->wiphy), __func__, __lvl, ##__args)
  54. #define DEBUG_PRINTK_PROBE(__kernlvl, __lvl, __msg, __args...) \
  55. printk(__kernlvl "%s -> %s: %s - " __msg, \
  56. KBUILD_MODNAME, __func__, __lvl, ##__args)
  57. #ifdef CONFIG_RT2X00_DEBUG
  58. #define DEBUG_PRINTK(__dev, __kernlvl, __lvl, __msg, __args...) \
  59. DEBUG_PRINTK_MSG(__dev, __kernlvl, __lvl, __msg, ##__args)
  60. #else
  61. #define DEBUG_PRINTK(__dev, __kernlvl, __lvl, __msg, __args...) \
  62. do { } while (0)
  63. #endif /* CONFIG_RT2X00_DEBUG */
  64. /*
  65. * Various debug levels.
  66. * The debug levels PANIC and ERROR both indicate serious problems,
  67. * for this reason they should never be ignored.
  68. * The special ERROR_PROBE message is for messages that are generated
  69. * when the rt2x00_dev is not yet initialized.
  70. */
  71. #define PANIC(__dev, __msg, __args...) \
  72. DEBUG_PRINTK_MSG(__dev, KERN_CRIT, "Panic", __msg, ##__args)
  73. #define ERROR(__dev, __msg, __args...) \
  74. DEBUG_PRINTK_MSG(__dev, KERN_ERR, "Error", __msg, ##__args)
  75. #define ERROR_PROBE(__msg, __args...) \
  76. DEBUG_PRINTK_PROBE(KERN_ERR, "Error", __msg, ##__args)
  77. #define WARNING(__dev, __msg, __args...) \
  78. DEBUG_PRINTK(__dev, KERN_WARNING, "Warning", __msg, ##__args)
  79. #define NOTICE(__dev, __msg, __args...) \
  80. DEBUG_PRINTK(__dev, KERN_NOTICE, "Notice", __msg, ##__args)
  81. #define INFO(__dev, __msg, __args...) \
  82. DEBUG_PRINTK(__dev, KERN_INFO, "Info", __msg, ##__args)
  83. #define DEBUG(__dev, __msg, __args...) \
  84. DEBUG_PRINTK(__dev, KERN_DEBUG, "Debug", __msg, ##__args)
  85. #define EEPROM(__dev, __msg, __args...) \
  86. DEBUG_PRINTK(__dev, KERN_DEBUG, "EEPROM recovery", __msg, ##__args)
  87. /*
  88. * Duration calculations
  89. * The rate variable passed is: 100kbs.
  90. * To convert from bytes to bits we multiply size with 8,
  91. * then the size is multiplied with 10 to make the
  92. * real rate -> rate argument correction.
  93. */
  94. #define GET_DURATION(__size, __rate) (((__size) * 8 * 10) / (__rate))
  95. #define GET_DURATION_RES(__size, __rate)(((__size) * 8 * 10) % (__rate))
  96. /*
  97. * Determine the number of L2 padding bytes required between the header and
  98. * the payload.
  99. */
  100. #define L2PAD_SIZE(__hdrlen) (-(__hdrlen) & 3)
  101. /*
  102. * Determine the alignment requirement,
  103. * to make sure the 802.11 payload is padded to a 4-byte boundrary
  104. * we must determine the address of the payload and calculate the
  105. * amount of bytes needed to move the data.
  106. */
  107. #define ALIGN_SIZE(__skb, __header) \
  108. ( ((unsigned long)((__skb)->data + (__header))) & 3 )
  109. /*
  110. * Constants for extra TX headroom for alignment purposes.
  111. */
  112. #define RT2X00_ALIGN_SIZE 4 /* Only whole frame needs alignment */
  113. #define RT2X00_L2PAD_SIZE 8 /* Both header & payload need alignment */
  114. /*
  115. * Standard timing and size defines.
  116. * These values should follow the ieee80211 specifications.
  117. */
  118. #define ACK_SIZE 14
  119. #define IEEE80211_HEADER 24
  120. #define PLCP 48
  121. #define BEACON 100
  122. #define PREAMBLE 144
  123. #define SHORT_PREAMBLE 72
  124. #define SLOT_TIME 20
  125. #define SHORT_SLOT_TIME 9
  126. #define SIFS 10
  127. #define PIFS ( SIFS + SLOT_TIME )
  128. #define SHORT_PIFS ( SIFS + SHORT_SLOT_TIME )
  129. #define DIFS ( PIFS + SLOT_TIME )
  130. #define SHORT_DIFS ( SHORT_PIFS + SHORT_SLOT_TIME )
  131. #define EIFS ( SIFS + DIFS + \
  132. GET_DURATION(IEEE80211_HEADER + ACK_SIZE, 10) )
  133. #define SHORT_EIFS ( SIFS + SHORT_DIFS + \
  134. GET_DURATION(IEEE80211_HEADER + ACK_SIZE, 10) )
  135. /*
  136. * Structure for average calculation
  137. * The avg field contains the actual average value,
  138. * but avg_weight is internally used during calculations
  139. * to prevent rounding errors.
  140. */
  141. struct avg_val {
  142. int avg;
  143. int avg_weight;
  144. };
  145. enum rt2x00_chip_intf {
  146. RT2X00_CHIP_INTF_PCI,
  147. RT2X00_CHIP_INTF_PCIE,
  148. RT2X00_CHIP_INTF_USB,
  149. RT2X00_CHIP_INTF_SOC,
  150. };
  151. /*
  152. * Chipset identification
  153. * The chipset on the device is composed of a RT and RF chip.
  154. * The chipset combination is important for determining device capabilities.
  155. */
  156. struct rt2x00_chip {
  157. u16 rt;
  158. #define RT2460 0x2460
  159. #define RT2560 0x2560
  160. #define RT2570 0x2570
  161. #define RT2661 0x2661
  162. #define RT2573 0x2573
  163. #define RT2860 0x2860 /* 2.4GHz */
  164. #define RT2872 0x2872 /* WSOC */
  165. #define RT2883 0x2883 /* WSOC */
  166. #define RT3070 0x3070
  167. #define RT3071 0x3071
  168. #define RT3090 0x3090 /* 2.4GHz PCIe */
  169. #define RT3390 0x3390
  170. #define RT3572 0x3572
  171. #define RT3593 0x3593 /* PCIe */
  172. #define RT3883 0x3883 /* WSOC */
  173. #define RT5390 0x5390 /* 2.4GHz */
  174. u16 rf;
  175. u16 rev;
  176. enum rt2x00_chip_intf intf;
  177. };
  178. /*
  179. * RF register values that belong to a particular channel.
  180. */
  181. struct rf_channel {
  182. int channel;
  183. u32 rf1;
  184. u32 rf2;
  185. u32 rf3;
  186. u32 rf4;
  187. };
  188. /*
  189. * Channel information structure
  190. */
  191. struct channel_info {
  192. unsigned int flags;
  193. #define GEOGRAPHY_ALLOWED 0x00000001
  194. short max_power;
  195. short default_power1;
  196. short default_power2;
  197. };
  198. /*
  199. * Antenna setup values.
  200. */
  201. struct antenna_setup {
  202. enum antenna rx;
  203. enum antenna tx;
  204. u8 rx_chain_num;
  205. u8 tx_chain_num;
  206. };
  207. /*
  208. * Quality statistics about the currently active link.
  209. */
  210. struct link_qual {
  211. /*
  212. * Statistics required for Link tuning by driver
  213. * The rssi value is provided by rt2x00lib during the
  214. * link_tuner() callback function.
  215. * The false_cca field is filled during the link_stats()
  216. * callback function and could be used during the
  217. * link_tuner() callback function.
  218. */
  219. int rssi;
  220. int false_cca;
  221. /*
  222. * VGC levels
  223. * Hardware driver will tune the VGC level during each call
  224. * to the link_tuner() callback function. This vgc_level is
  225. * is determined based on the link quality statistics like
  226. * average RSSI and the false CCA count.
  227. *
  228. * In some cases the drivers need to differentiate between
  229. * the currently "desired" VGC level and the level configured
  230. * in the hardware. The latter is important to reduce the
  231. * number of BBP register reads to reduce register access
  232. * overhead. For this reason we store both values here.
  233. */
  234. u8 vgc_level;
  235. u8 vgc_level_reg;
  236. /*
  237. * Statistics required for Signal quality calculation.
  238. * These fields might be changed during the link_stats()
  239. * callback function.
  240. */
  241. int rx_success;
  242. int rx_failed;
  243. int tx_success;
  244. int tx_failed;
  245. };
  246. /*
  247. * Antenna settings about the currently active link.
  248. */
  249. struct link_ant {
  250. /*
  251. * Antenna flags
  252. */
  253. unsigned int flags;
  254. #define ANTENNA_RX_DIVERSITY 0x00000001
  255. #define ANTENNA_TX_DIVERSITY 0x00000002
  256. #define ANTENNA_MODE_SAMPLE 0x00000004
  257. /*
  258. * Currently active TX/RX antenna setup.
  259. * When software diversity is used, this will indicate
  260. * which antenna is actually used at this time.
  261. */
  262. struct antenna_setup active;
  263. /*
  264. * RSSI history information for the antenna.
  265. * Used to determine when to switch antenna
  266. * when using software diversity.
  267. */
  268. int rssi_history;
  269. /*
  270. * Current RSSI average of the currently active antenna.
  271. * Similar to the avg_rssi in the link_qual structure
  272. * this value is updated by using the walking average.
  273. */
  274. struct avg_val rssi_ant;
  275. };
  276. /*
  277. * To optimize the quality of the link we need to store
  278. * the quality of received frames and periodically
  279. * optimize the link.
  280. */
  281. struct link {
  282. /*
  283. * Link tuner counter
  284. * The number of times the link has been tuned
  285. * since the radio has been switched on.
  286. */
  287. u32 count;
  288. /*
  289. * Quality measurement values.
  290. */
  291. struct link_qual qual;
  292. /*
  293. * TX/RX antenna setup.
  294. */
  295. struct link_ant ant;
  296. /*
  297. * Currently active average RSSI value
  298. */
  299. struct avg_val avg_rssi;
  300. /*
  301. * Work structure for scheduling periodic link tuning.
  302. */
  303. struct delayed_work work;
  304. /*
  305. * Work structure for scheduling periodic watchdog monitoring.
  306. * This work must be scheduled on the kernel workqueue, while
  307. * all other work structures must be queued on the mac80211
  308. * workqueue. This guarantees that the watchdog can schedule
  309. * other work structures and wait for their completion in order
  310. * to bring the device/driver back into the desired state.
  311. */
  312. struct delayed_work watchdog_work;
  313. /*
  314. * Work structure for scheduling periodic AGC adjustments.
  315. */
  316. struct delayed_work agc_work;
  317. };
  318. enum rt2x00_delayed_flags {
  319. DELAYED_UPDATE_BEACON,
  320. };
  321. /*
  322. * Interface structure
  323. * Per interface configuration details, this structure
  324. * is allocated as the private data for ieee80211_vif.
  325. */
  326. struct rt2x00_intf {
  327. /*
  328. * beacon->skb must be protected with the mutex.
  329. */
  330. struct mutex beacon_skb_mutex;
  331. /*
  332. * Entry in the beacon queue which belongs to
  333. * this interface. Each interface has its own
  334. * dedicated beacon entry.
  335. */
  336. struct queue_entry *beacon;
  337. bool enable_beacon;
  338. /*
  339. * Actions that needed rescheduling.
  340. */
  341. unsigned long delayed_flags;
  342. /*
  343. * Software sequence counter, this is only required
  344. * for hardware which doesn't support hardware
  345. * sequence counting.
  346. */
  347. spinlock_t seqlock;
  348. u16 seqno;
  349. };
  350. static inline struct rt2x00_intf* vif_to_intf(struct ieee80211_vif *vif)
  351. {
  352. return (struct rt2x00_intf *)vif->drv_priv;
  353. }
  354. /**
  355. * struct hw_mode_spec: Hardware specifications structure
  356. *
  357. * Details about the supported modes, rates and channels
  358. * of a particular chipset. This is used by rt2x00lib
  359. * to build the ieee80211_hw_mode array for mac80211.
  360. *
  361. * @supported_bands: Bitmask contained the supported bands (2.4GHz, 5.2GHz).
  362. * @supported_rates: Rate types which are supported (CCK, OFDM).
  363. * @num_channels: Number of supported channels. This is used as array size
  364. * for @tx_power_a, @tx_power_bg and @channels.
  365. * @channels: Device/chipset specific channel values (See &struct rf_channel).
  366. * @channels_info: Additional information for channels (See &struct channel_info).
  367. * @ht: Driver HT Capabilities (See &ieee80211_sta_ht_cap).
  368. */
  369. struct hw_mode_spec {
  370. unsigned int supported_bands;
  371. #define SUPPORT_BAND_2GHZ 0x00000001
  372. #define SUPPORT_BAND_5GHZ 0x00000002
  373. unsigned int supported_rates;
  374. #define SUPPORT_RATE_CCK 0x00000001
  375. #define SUPPORT_RATE_OFDM 0x00000002
  376. unsigned int num_channels;
  377. const struct rf_channel *channels;
  378. const struct channel_info *channels_info;
  379. struct ieee80211_sta_ht_cap ht;
  380. };
  381. /*
  382. * Configuration structure wrapper around the
  383. * mac80211 configuration structure.
  384. * When mac80211 configures the driver, rt2x00lib
  385. * can precalculate values which are equal for all
  386. * rt2x00 drivers. Those values can be stored in here.
  387. */
  388. struct rt2x00lib_conf {
  389. struct ieee80211_conf *conf;
  390. struct rf_channel rf;
  391. struct channel_info channel;
  392. };
  393. /*
  394. * Configuration structure for erp settings.
  395. */
  396. struct rt2x00lib_erp {
  397. int short_preamble;
  398. int cts_protection;
  399. u32 basic_rates;
  400. int slot_time;
  401. short sifs;
  402. short pifs;
  403. short difs;
  404. short eifs;
  405. u16 beacon_int;
  406. u16 ht_opmode;
  407. };
  408. /*
  409. * Configuration structure for hardware encryption.
  410. */
  411. struct rt2x00lib_crypto {
  412. enum cipher cipher;
  413. enum set_key_cmd cmd;
  414. const u8 *address;
  415. u32 bssidx;
  416. u8 key[16];
  417. u8 tx_mic[8];
  418. u8 rx_mic[8];
  419. };
  420. /*
  421. * Configuration structure wrapper around the
  422. * rt2x00 interface configuration handler.
  423. */
  424. struct rt2x00intf_conf {
  425. /*
  426. * Interface type
  427. */
  428. enum nl80211_iftype type;
  429. /*
  430. * TSF sync value, this is dependent on the operation type.
  431. */
  432. enum tsf_sync sync;
  433. /*
  434. * The MAC and BSSID addresses are simple array of bytes,
  435. * these arrays are little endian, so when sending the addresses
  436. * to the drivers, copy the it into a endian-signed variable.
  437. *
  438. * Note that all devices (except rt2500usb) have 32 bits
  439. * register word sizes. This means that whatever variable we
  440. * pass _must_ be a multiple of 32 bits. Otherwise the device
  441. * might not accept what we are sending to it.
  442. * This will also make it easier for the driver to write
  443. * the data to the device.
  444. */
  445. __le32 mac[2];
  446. __le32 bssid[2];
  447. };
  448. /*
  449. * Private structure for storing STA details
  450. * wcid: Wireless Client ID
  451. */
  452. struct rt2x00_sta {
  453. int wcid;
  454. };
  455. static inline struct rt2x00_sta* sta_to_rt2x00_sta(struct ieee80211_sta *sta)
  456. {
  457. return (struct rt2x00_sta *)sta->drv_priv;
  458. }
  459. /*
  460. * rt2x00lib callback functions.
  461. */
  462. struct rt2x00lib_ops {
  463. /*
  464. * Interrupt handlers.
  465. */
  466. irq_handler_t irq_handler;
  467. /*
  468. * TX status tasklet handler.
  469. */
  470. void (*txstatus_tasklet) (unsigned long data);
  471. void (*pretbtt_tasklet) (unsigned long data);
  472. void (*tbtt_tasklet) (unsigned long data);
  473. void (*rxdone_tasklet) (unsigned long data);
  474. void (*autowake_tasklet) (unsigned long data);
  475. /*
  476. * Device init handlers.
  477. */
  478. int (*probe_hw) (struct rt2x00_dev *rt2x00dev);
  479. char *(*get_firmware_name) (struct rt2x00_dev *rt2x00dev);
  480. int (*check_firmware) (struct rt2x00_dev *rt2x00dev,
  481. const u8 *data, const size_t len);
  482. int (*load_firmware) (struct rt2x00_dev *rt2x00dev,
  483. const u8 *data, const size_t len);
  484. /*
  485. * Device initialization/deinitialization handlers.
  486. */
  487. int (*initialize) (struct rt2x00_dev *rt2x00dev);
  488. void (*uninitialize) (struct rt2x00_dev *rt2x00dev);
  489. /*
  490. * queue initialization handlers
  491. */
  492. bool (*get_entry_state) (struct queue_entry *entry);
  493. void (*clear_entry) (struct queue_entry *entry);
  494. /*
  495. * Radio control handlers.
  496. */
  497. int (*set_device_state) (struct rt2x00_dev *rt2x00dev,
  498. enum dev_state state);
  499. int (*rfkill_poll) (struct rt2x00_dev *rt2x00dev);
  500. void (*link_stats) (struct rt2x00_dev *rt2x00dev,
  501. struct link_qual *qual);
  502. void (*reset_tuner) (struct rt2x00_dev *rt2x00dev,
  503. struct link_qual *qual);
  504. void (*link_tuner) (struct rt2x00_dev *rt2x00dev,
  505. struct link_qual *qual, const u32 count);
  506. void (*gain_calibration) (struct rt2x00_dev *rt2x00dev);
  507. /*
  508. * Data queue handlers.
  509. */
  510. void (*watchdog) (struct rt2x00_dev *rt2x00dev);
  511. void (*start_queue) (struct data_queue *queue);
  512. void (*kick_queue) (struct data_queue *queue);
  513. void (*stop_queue) (struct data_queue *queue);
  514. void (*flush_queue) (struct data_queue *queue, bool drop);
  515. void (*tx_dma_done) (struct queue_entry *entry);
  516. /*
  517. * TX control handlers
  518. */
  519. void (*write_tx_desc) (struct queue_entry *entry,
  520. struct txentry_desc *txdesc);
  521. void (*write_tx_data) (struct queue_entry *entry,
  522. struct txentry_desc *txdesc);
  523. void (*write_beacon) (struct queue_entry *entry,
  524. struct txentry_desc *txdesc);
  525. void (*clear_beacon) (struct queue_entry *entry);
  526. int (*get_tx_data_len) (struct queue_entry *entry);
  527. /*
  528. * RX control handlers
  529. */
  530. void (*fill_rxdone) (struct queue_entry *entry,
  531. struct rxdone_entry_desc *rxdesc);
  532. /*
  533. * Configuration handlers.
  534. */
  535. int (*config_shared_key) (struct rt2x00_dev *rt2x00dev,
  536. struct rt2x00lib_crypto *crypto,
  537. struct ieee80211_key_conf *key);
  538. int (*config_pairwise_key) (struct rt2x00_dev *rt2x00dev,
  539. struct rt2x00lib_crypto *crypto,
  540. struct ieee80211_key_conf *key);
  541. void (*config_filter) (struct rt2x00_dev *rt2x00dev,
  542. const unsigned int filter_flags);
  543. void (*config_intf) (struct rt2x00_dev *rt2x00dev,
  544. struct rt2x00_intf *intf,
  545. struct rt2x00intf_conf *conf,
  546. const unsigned int flags);
  547. #define CONFIG_UPDATE_TYPE ( 1 << 1 )
  548. #define CONFIG_UPDATE_MAC ( 1 << 2 )
  549. #define CONFIG_UPDATE_BSSID ( 1 << 3 )
  550. void (*config_erp) (struct rt2x00_dev *rt2x00dev,
  551. struct rt2x00lib_erp *erp,
  552. u32 changed);
  553. void (*config_ant) (struct rt2x00_dev *rt2x00dev,
  554. struct antenna_setup *ant);
  555. void (*config) (struct rt2x00_dev *rt2x00dev,
  556. struct rt2x00lib_conf *libconf,
  557. const unsigned int changed_flags);
  558. int (*sta_add) (struct rt2x00_dev *rt2x00dev,
  559. struct ieee80211_vif *vif,
  560. struct ieee80211_sta *sta);
  561. int (*sta_remove) (struct rt2x00_dev *rt2x00dev,
  562. int wcid);
  563. };
  564. /*
  565. * rt2x00 driver callback operation structure.
  566. */
  567. struct rt2x00_ops {
  568. const char *name;
  569. const unsigned int max_sta_intf;
  570. const unsigned int max_ap_intf;
  571. const unsigned int eeprom_size;
  572. const unsigned int rf_size;
  573. const unsigned int tx_queues;
  574. const unsigned int extra_tx_headroom;
  575. const struct data_queue_desc *rx;
  576. const struct data_queue_desc *tx;
  577. const struct data_queue_desc *bcn;
  578. const struct data_queue_desc *atim;
  579. const struct rt2x00lib_ops *lib;
  580. const void *drv;
  581. const struct ieee80211_ops *hw;
  582. #ifdef CONFIG_RT2X00_LIB_DEBUGFS
  583. const struct rt2x00debug *debugfs;
  584. #endif /* CONFIG_RT2X00_LIB_DEBUGFS */
  585. };
  586. /*
  587. * rt2x00 state flags
  588. */
  589. enum rt2x00_state_flags {
  590. /*
  591. * Device flags
  592. */
  593. DEVICE_STATE_PRESENT,
  594. DEVICE_STATE_REGISTERED_HW,
  595. DEVICE_STATE_INITIALIZED,
  596. DEVICE_STATE_STARTED,
  597. DEVICE_STATE_ENABLED_RADIO,
  598. DEVICE_STATE_SCANNING,
  599. /*
  600. * Driver configuration
  601. */
  602. CONFIG_CHANNEL_HT40,
  603. CONFIG_POWERSAVING,
  604. };
  605. /*
  606. * rt2x00 capability flags
  607. */
  608. enum rt2x00_capability_flags {
  609. /*
  610. * Requirements
  611. */
  612. REQUIRE_FIRMWARE,
  613. REQUIRE_BEACON_GUARD,
  614. REQUIRE_ATIM_QUEUE,
  615. REQUIRE_DMA,
  616. REQUIRE_COPY_IV,
  617. REQUIRE_L2PAD,
  618. REQUIRE_TXSTATUS_FIFO,
  619. REQUIRE_TASKLET_CONTEXT,
  620. REQUIRE_SW_SEQNO,
  621. REQUIRE_HT_TX_DESC,
  622. REQUIRE_PS_AUTOWAKE,
  623. /*
  624. * Capabilities
  625. */
  626. CAPABILITY_HW_BUTTON,
  627. CAPABILITY_HW_CRYPTO,
  628. CAPABILITY_POWER_LIMIT,
  629. CAPABILITY_CONTROL_FILTERS,
  630. CAPABILITY_CONTROL_FILTER_PSPOLL,
  631. CAPABILITY_PRE_TBTT_INTERRUPT,
  632. CAPABILITY_LINK_TUNING,
  633. CAPABILITY_FRAME_TYPE,
  634. CAPABILITY_RF_SEQUENCE,
  635. CAPABILITY_EXTERNAL_LNA_A,
  636. CAPABILITY_EXTERNAL_LNA_BG,
  637. CAPABILITY_DOUBLE_ANTENNA,
  638. CAPABILITY_BT_COEXIST,
  639. };
  640. /*
  641. * rt2x00 device structure.
  642. */
  643. struct rt2x00_dev {
  644. /*
  645. * Device structure.
  646. * The structure stored in here depends on the
  647. * system bus (PCI or USB).
  648. * When accessing this variable, the rt2x00dev_{pci,usb}
  649. * macros should be used for correct typecasting.
  650. */
  651. struct device *dev;
  652. /*
  653. * Callback functions.
  654. */
  655. const struct rt2x00_ops *ops;
  656. /*
  657. * IEEE80211 control structure.
  658. */
  659. struct ieee80211_hw *hw;
  660. struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
  661. enum ieee80211_band curr_band;
  662. int curr_freq;
  663. /*
  664. * If enabled, the debugfs interface structures
  665. * required for deregistration of debugfs.
  666. */
  667. #ifdef CONFIG_RT2X00_LIB_DEBUGFS
  668. struct rt2x00debug_intf *debugfs_intf;
  669. #endif /* CONFIG_RT2X00_LIB_DEBUGFS */
  670. /*
  671. * LED structure for changing the LED status
  672. * by mac8011 or the kernel.
  673. */
  674. #ifdef CONFIG_RT2X00_LIB_LEDS
  675. struct rt2x00_led led_radio;
  676. struct rt2x00_led led_assoc;
  677. struct rt2x00_led led_qual;
  678. u16 led_mcu_reg;
  679. #endif /* CONFIG_RT2X00_LIB_LEDS */
  680. /*
  681. * Device state flags.
  682. * In these flags the current status is stored.
  683. * Access to these flags should occur atomically.
  684. */
  685. unsigned long flags;
  686. /*
  687. * Device capabiltiy flags.
  688. * In these flags the device/driver capabilities are stored.
  689. * Access to these flags should occur non-atomically.
  690. */
  691. unsigned long cap_flags;
  692. /*
  693. * Device information, Bus IRQ and name (PCI, SoC)
  694. */
  695. int irq;
  696. const char *name;
  697. /*
  698. * Chipset identification.
  699. */
  700. struct rt2x00_chip chip;
  701. /*
  702. * hw capability specifications.
  703. */
  704. struct hw_mode_spec spec;
  705. /*
  706. * This is the default TX/RX antenna setup as indicated
  707. * by the device's EEPROM.
  708. */
  709. struct antenna_setup default_ant;
  710. /*
  711. * Register pointers
  712. * csr.base: CSR base register address. (PCI)
  713. * csr.cache: CSR cache for usb_control_msg. (USB)
  714. */
  715. union csr {
  716. void __iomem *base;
  717. void *cache;
  718. } csr;
  719. /*
  720. * Mutex to protect register accesses.
  721. * For PCI and USB devices it protects against concurrent indirect
  722. * register access (BBP, RF, MCU) since accessing those
  723. * registers require multiple calls to the CSR registers.
  724. * For USB devices it also protects the csr_cache since that
  725. * field is used for normal CSR access and it cannot support
  726. * multiple callers simultaneously.
  727. */
  728. struct mutex csr_mutex;
  729. /*
  730. * Current packet filter configuration for the device.
  731. * This contains all currently active FIF_* flags send
  732. * to us by mac80211 during configure_filter().
  733. */
  734. unsigned int packet_filter;
  735. /*
  736. * Interface details:
  737. * - Open ap interface count.
  738. * - Open sta interface count.
  739. * - Association count.
  740. * - Beaconing enabled count.
  741. */
  742. unsigned int intf_ap_count;
  743. unsigned int intf_sta_count;
  744. unsigned int intf_associated;
  745. unsigned int intf_beaconing;
  746. /*
  747. * Link quality
  748. */
  749. struct link link;
  750. /*
  751. * EEPROM data.
  752. */
  753. __le16 *eeprom;
  754. /*
  755. * Active RF register values.
  756. * These are stored here so we don't need
  757. * to read the rf registers and can directly
  758. * use this value instead.
  759. * This field should be accessed by using
  760. * rt2x00_rf_read() and rt2x00_rf_write().
  761. */
  762. u32 *rf;
  763. /*
  764. * LNA gain
  765. */
  766. short lna_gain;
  767. /*
  768. * Current TX power value.
  769. */
  770. u16 tx_power;
  771. /*
  772. * Current retry values.
  773. */
  774. u8 short_retry;
  775. u8 long_retry;
  776. /*
  777. * Rssi <-> Dbm offset
  778. */
  779. u8 rssi_offset;
  780. /*
  781. * Frequency offset (for rt61pci & rt73usb).
  782. */
  783. u8 freq_offset;
  784. /*
  785. * Calibration information (for rt2800usb & rt2800pci).
  786. * [0] -> BW20
  787. * [1] -> BW40
  788. */
  789. u8 calibration[2];
  790. /*
  791. * Association id.
  792. */
  793. u16 aid;
  794. /*
  795. * Beacon interval.
  796. */
  797. u16 beacon_int;
  798. /**
  799. * Timestamp of last received beacon
  800. */
  801. unsigned long last_beacon;
  802. /*
  803. * Low level statistics which will have
  804. * to be kept up to date while device is running.
  805. */
  806. struct ieee80211_low_level_stats low_level_stats;
  807. /**
  808. * Work queue for all work which should not be placed
  809. * on the mac80211 workqueue (because of dependencies
  810. * between various work structures).
  811. */
  812. struct workqueue_struct *workqueue;
  813. /*
  814. * Scheduled work.
  815. * NOTE: intf_work will use ieee80211_iterate_active_interfaces()
  816. * which means it cannot be placed on the hw->workqueue
  817. * due to RTNL locking requirements.
  818. */
  819. struct work_struct intf_work;
  820. /**
  821. * Scheduled work for TX/RX done handling (USB devices)
  822. */
  823. struct work_struct rxdone_work;
  824. struct work_struct txdone_work;
  825. /*
  826. * Powersaving work
  827. */
  828. struct delayed_work autowakeup_work;
  829. /*
  830. * Data queue arrays for RX, TX, Beacon and ATIM.
  831. */
  832. unsigned int data_queues;
  833. struct data_queue *rx;
  834. struct data_queue *tx;
  835. struct data_queue *bcn;
  836. struct data_queue *atim;
  837. /*
  838. * Firmware image.
  839. */
  840. const struct firmware *fw;
  841. /*
  842. * FIFO for storing tx status reports between isr and tasklet.
  843. */
  844. DECLARE_KFIFO_PTR(txstatus_fifo, u32);
  845. /*
  846. * Timer to ensure tx status reports are read (rt2800usb).
  847. */
  848. struct timer_list txstatus_timer;
  849. /*
  850. * Tasklet for processing tx status reports (rt2800pci).
  851. */
  852. struct tasklet_struct txstatus_tasklet;
  853. struct tasklet_struct pretbtt_tasklet;
  854. struct tasklet_struct tbtt_tasklet;
  855. struct tasklet_struct rxdone_tasklet;
  856. struct tasklet_struct autowake_tasklet;
  857. /*
  858. * Protect the interrupt mask register.
  859. */
  860. spinlock_t irqmask_lock;
  861. };
  862. /*
  863. * Register defines.
  864. * Some registers require multiple attempts before success,
  865. * in those cases REGISTER_BUSY_COUNT attempts should be
  866. * taken with a REGISTER_BUSY_DELAY interval.
  867. */
  868. #define REGISTER_BUSY_COUNT 100
  869. #define REGISTER_BUSY_DELAY 100
  870. /*
  871. * Generic RF access.
  872. * The RF is being accessed by word index.
  873. */
  874. static inline void rt2x00_rf_read(struct rt2x00_dev *rt2x00dev,
  875. const unsigned int word, u32 *data)
  876. {
  877. BUG_ON(word < 1 || word > rt2x00dev->ops->rf_size / sizeof(u32));
  878. *data = rt2x00dev->rf[word - 1];
  879. }
  880. static inline void rt2x00_rf_write(struct rt2x00_dev *rt2x00dev,
  881. const unsigned int word, u32 data)
  882. {
  883. BUG_ON(word < 1 || word > rt2x00dev->ops->rf_size / sizeof(u32));
  884. rt2x00dev->rf[word - 1] = data;
  885. }
  886. /*
  887. * Generic EEPROM access.
  888. * The EEPROM is being accessed by word index.
  889. */
  890. static inline void *rt2x00_eeprom_addr(struct rt2x00_dev *rt2x00dev,
  891. const unsigned int word)
  892. {
  893. return (void *)&rt2x00dev->eeprom[word];
  894. }
  895. static inline void rt2x00_eeprom_read(struct rt2x00_dev *rt2x00dev,
  896. const unsigned int word, u16 *data)
  897. {
  898. *data = le16_to_cpu(rt2x00dev->eeprom[word]);
  899. }
  900. static inline void rt2x00_eeprom_write(struct rt2x00_dev *rt2x00dev,
  901. const unsigned int word, u16 data)
  902. {
  903. rt2x00dev->eeprom[word] = cpu_to_le16(data);
  904. }
  905. /*
  906. * Chipset handlers
  907. */
  908. static inline void rt2x00_set_chip(struct rt2x00_dev *rt2x00dev,
  909. const u16 rt, const u16 rf, const u16 rev)
  910. {
  911. rt2x00dev->chip.rt = rt;
  912. rt2x00dev->chip.rf = rf;
  913. rt2x00dev->chip.rev = rev;
  914. INFO(rt2x00dev,
  915. "Chipset detected - rt: %04x, rf: %04x, rev: %04x.\n",
  916. rt2x00dev->chip.rt, rt2x00dev->chip.rf, rt2x00dev->chip.rev);
  917. }
  918. static inline bool rt2x00_rt(struct rt2x00_dev *rt2x00dev, const u16 rt)
  919. {
  920. return (rt2x00dev->chip.rt == rt);
  921. }
  922. static inline bool rt2x00_rf(struct rt2x00_dev *rt2x00dev, const u16 rf)
  923. {
  924. return (rt2x00dev->chip.rf == rf);
  925. }
  926. static inline u16 rt2x00_rev(struct rt2x00_dev *rt2x00dev)
  927. {
  928. return rt2x00dev->chip.rev;
  929. }
  930. static inline bool rt2x00_rt_rev(struct rt2x00_dev *rt2x00dev,
  931. const u16 rt, const u16 rev)
  932. {
  933. return (rt2x00_rt(rt2x00dev, rt) && rt2x00_rev(rt2x00dev) == rev);
  934. }
  935. static inline bool rt2x00_rt_rev_lt(struct rt2x00_dev *rt2x00dev,
  936. const u16 rt, const u16 rev)
  937. {
  938. return (rt2x00_rt(rt2x00dev, rt) && rt2x00_rev(rt2x00dev) < rev);
  939. }
  940. static inline bool rt2x00_rt_rev_gte(struct rt2x00_dev *rt2x00dev,
  941. const u16 rt, const u16 rev)
  942. {
  943. return (rt2x00_rt(rt2x00dev, rt) && rt2x00_rev(rt2x00dev) >= rev);
  944. }
  945. static inline void rt2x00_set_chip_intf(struct rt2x00_dev *rt2x00dev,
  946. enum rt2x00_chip_intf intf)
  947. {
  948. rt2x00dev->chip.intf = intf;
  949. }
  950. static inline bool rt2x00_intf(struct rt2x00_dev *rt2x00dev,
  951. enum rt2x00_chip_intf intf)
  952. {
  953. return (rt2x00dev->chip.intf == intf);
  954. }
  955. static inline bool rt2x00_is_pci(struct rt2x00_dev *rt2x00dev)
  956. {
  957. return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_PCI) ||
  958. rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_PCIE);
  959. }
  960. static inline bool rt2x00_is_pcie(struct rt2x00_dev *rt2x00dev)
  961. {
  962. return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_PCIE);
  963. }
  964. static inline bool rt2x00_is_usb(struct rt2x00_dev *rt2x00dev)
  965. {
  966. return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_USB);
  967. }
  968. static inline bool rt2x00_is_soc(struct rt2x00_dev *rt2x00dev)
  969. {
  970. return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_SOC);
  971. }
  972. /**
  973. * rt2x00queue_map_txskb - Map a skb into DMA for TX purposes.
  974. * @entry: Pointer to &struct queue_entry
  975. */
  976. void rt2x00queue_map_txskb(struct queue_entry *entry);
  977. /**
  978. * rt2x00queue_unmap_skb - Unmap a skb from DMA.
  979. * @entry: Pointer to &struct queue_entry
  980. */
  981. void rt2x00queue_unmap_skb(struct queue_entry *entry);
  982. /**
  983. * rt2x00queue_get_tx_queue - Convert tx queue index to queue pointer
  984. * @rt2x00dev: Pointer to &struct rt2x00_dev.
  985. * @queue: rt2x00 queue index (see &enum data_queue_qid).
  986. *
  987. * Returns NULL for non tx queues.
  988. */
  989. static inline struct data_queue *
  990. rt2x00queue_get_tx_queue(struct rt2x00_dev *rt2x00dev,
  991. const enum data_queue_qid queue)
  992. {
  993. if (queue < rt2x00dev->ops->tx_queues && rt2x00dev->tx)
  994. return &rt2x00dev->tx[queue];
  995. if (queue == QID_ATIM)
  996. return rt2x00dev->atim;
  997. return NULL;
  998. }
  999. /**
  1000. * rt2x00queue_get_entry - Get queue entry where the given index points to.
  1001. * @queue: Pointer to &struct data_queue from where we obtain the entry.
  1002. * @index: Index identifier for obtaining the correct index.
  1003. */
  1004. struct queue_entry *rt2x00queue_get_entry(struct data_queue *queue,
  1005. enum queue_index index);
  1006. /**
  1007. * rt2x00queue_pause_queue - Pause a data queue
  1008. * @queue: Pointer to &struct data_queue.
  1009. *
  1010. * This function will pause the data queue locally, preventing
  1011. * new frames to be added to the queue (while the hardware is
  1012. * still allowed to run).
  1013. */
  1014. void rt2x00queue_pause_queue(struct data_queue *queue);
  1015. /**
  1016. * rt2x00queue_unpause_queue - unpause a data queue
  1017. * @queue: Pointer to &struct data_queue.
  1018. *
  1019. * This function will unpause the data queue locally, allowing
  1020. * new frames to be added to the queue again.
  1021. */
  1022. void rt2x00queue_unpause_queue(struct data_queue *queue);
  1023. /**
  1024. * rt2x00queue_start_queue - Start a data queue
  1025. * @queue: Pointer to &struct data_queue.
  1026. *
  1027. * This function will start handling all pending frames in the queue.
  1028. */
  1029. void rt2x00queue_start_queue(struct data_queue *queue);
  1030. /**
  1031. * rt2x00queue_stop_queue - Halt a data queue
  1032. * @queue: Pointer to &struct data_queue.
  1033. *
  1034. * This function will stop all pending frames in the queue.
  1035. */
  1036. void rt2x00queue_stop_queue(struct data_queue *queue);
  1037. /**
  1038. * rt2x00queue_flush_queue - Flush a data queue
  1039. * @queue: Pointer to &struct data_queue.
  1040. * @drop: True to drop all pending frames.
  1041. *
  1042. * This function will flush the queue. After this call
  1043. * the queue is guaranteed to be empty.
  1044. */
  1045. void rt2x00queue_flush_queue(struct data_queue *queue, bool drop);
  1046. /**
  1047. * rt2x00queue_start_queues - Start all data queues
  1048. * @rt2x00dev: Pointer to &struct rt2x00_dev.
  1049. *
  1050. * This function will loop through all available queues to start them
  1051. */
  1052. void rt2x00queue_start_queues(struct rt2x00_dev *rt2x00dev);
  1053. /**
  1054. * rt2x00queue_stop_queues - Halt all data queues
  1055. * @rt2x00dev: Pointer to &struct rt2x00_dev.
  1056. *
  1057. * This function will loop through all available queues to stop
  1058. * any pending frames.
  1059. */
  1060. void rt2x00queue_stop_queues(struct rt2x00_dev *rt2x00dev);
  1061. /**
  1062. * rt2x00queue_flush_queues - Flush all data queues
  1063. * @rt2x00dev: Pointer to &struct rt2x00_dev.
  1064. * @drop: True to drop all pending frames.
  1065. *
  1066. * This function will loop through all available queues to flush
  1067. * any pending frames.
  1068. */
  1069. void rt2x00queue_flush_queues(struct rt2x00_dev *rt2x00dev, bool drop);
  1070. /*
  1071. * Debugfs handlers.
  1072. */
  1073. /**
  1074. * rt2x00debug_dump_frame - Dump a frame to userspace through debugfs.
  1075. * @rt2x00dev: Pointer to &struct rt2x00_dev.
  1076. * @type: The type of frame that is being dumped.
  1077. * @skb: The skb containing the frame to be dumped.
  1078. */
  1079. #ifdef CONFIG_RT2X00_LIB_DEBUGFS
  1080. void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev,
  1081. enum rt2x00_dump_type type, struct sk_buff *skb);
  1082. #else
  1083. static inline void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev,
  1084. enum rt2x00_dump_type type,
  1085. struct sk_buff *skb)
  1086. {
  1087. }
  1088. #endif /* CONFIG_RT2X00_LIB_DEBUGFS */
  1089. /*
  1090. * Utility functions.
  1091. */
  1092. u32 rt2x00lib_get_bssidx(struct rt2x00_dev *rt2x00dev,
  1093. struct ieee80211_vif *vif);
  1094. /*
  1095. * Interrupt context handlers.
  1096. */
  1097. void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev);
  1098. void rt2x00lib_pretbtt(struct rt2x00_dev *rt2x00dev);
  1099. void rt2x00lib_dmastart(struct queue_entry *entry);
  1100. void rt2x00lib_dmadone(struct queue_entry *entry);
  1101. void rt2x00lib_txdone(struct queue_entry *entry,
  1102. struct txdone_entry_desc *txdesc);
  1103. void rt2x00lib_txdone_noinfo(struct queue_entry *entry, u32 status);
  1104. void rt2x00lib_rxdone(struct queue_entry *entry);
  1105. /*
  1106. * mac80211 handlers.
  1107. */
  1108. void rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb);
  1109. int rt2x00mac_start(struct ieee80211_hw *hw);
  1110. void rt2x00mac_stop(struct ieee80211_hw *hw);
  1111. int rt2x00mac_add_interface(struct ieee80211_hw *hw,
  1112. struct ieee80211_vif *vif);
  1113. void rt2x00mac_remove_interface(struct ieee80211_hw *hw,
  1114. struct ieee80211_vif *vif);
  1115. int rt2x00mac_config(struct ieee80211_hw *hw, u32 changed);
  1116. void rt2x00mac_configure_filter(struct ieee80211_hw *hw,
  1117. unsigned int changed_flags,
  1118. unsigned int *total_flags,
  1119. u64 multicast);
  1120. int rt2x00mac_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
  1121. bool set);
  1122. #ifdef CONFIG_RT2X00_LIB_CRYPTO
  1123. int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
  1124. struct ieee80211_vif *vif, struct ieee80211_sta *sta,
  1125. struct ieee80211_key_conf *key);
  1126. #else
  1127. #define rt2x00mac_set_key NULL
  1128. #endif /* CONFIG_RT2X00_LIB_CRYPTO */
  1129. int rt2x00mac_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  1130. struct ieee80211_sta *sta);
  1131. int rt2x00mac_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
  1132. struct ieee80211_sta *sta);
  1133. void rt2x00mac_sw_scan_start(struct ieee80211_hw *hw);
  1134. void rt2x00mac_sw_scan_complete(struct ieee80211_hw *hw);
  1135. int rt2x00mac_get_stats(struct ieee80211_hw *hw,
  1136. struct ieee80211_low_level_stats *stats);
  1137. void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw,
  1138. struct ieee80211_vif *vif,
  1139. struct ieee80211_bss_conf *bss_conf,
  1140. u32 changes);
  1141. int rt2x00mac_conf_tx(struct ieee80211_hw *hw, u16 queue,
  1142. const struct ieee80211_tx_queue_params *params);
  1143. void rt2x00mac_rfkill_poll(struct ieee80211_hw *hw);
  1144. void rt2x00mac_flush(struct ieee80211_hw *hw, bool drop);
  1145. int rt2x00mac_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant);
  1146. int rt2x00mac_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant);
  1147. void rt2x00mac_get_ringparam(struct ieee80211_hw *hw,
  1148. u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max);
  1149. bool rt2x00mac_tx_frames_pending(struct ieee80211_hw *hw);
  1150. /*
  1151. * Driver allocation handlers.
  1152. */
  1153. int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev);
  1154. void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev);
  1155. #ifdef CONFIG_PM
  1156. int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state);
  1157. int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev);
  1158. #endif /* CONFIG_PM */
  1159. #endif /* RT2X00_H */