rt2x00.h 33 KB

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