rt2x00.h 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292
  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. * rt2x00lib callback functions.
  450. */
  451. struct rt2x00lib_ops {
  452. /*
  453. * Interrupt handlers.
  454. */
  455. irq_handler_t irq_handler;
  456. /*
  457. * TX status tasklet handler.
  458. */
  459. void (*txstatus_tasklet) (unsigned long data);
  460. void (*pretbtt_tasklet) (unsigned long data);
  461. void (*tbtt_tasklet) (unsigned long data);
  462. void (*rxdone_tasklet) (unsigned long data);
  463. void (*autowake_tasklet) (unsigned long data);
  464. /*
  465. * Device init handlers.
  466. */
  467. int (*probe_hw) (struct rt2x00_dev *rt2x00dev);
  468. char *(*get_firmware_name) (struct rt2x00_dev *rt2x00dev);
  469. int (*check_firmware) (struct rt2x00_dev *rt2x00dev,
  470. const u8 *data, const size_t len);
  471. int (*load_firmware) (struct rt2x00_dev *rt2x00dev,
  472. const u8 *data, const size_t len);
  473. /*
  474. * Device initialization/deinitialization handlers.
  475. */
  476. int (*initialize) (struct rt2x00_dev *rt2x00dev);
  477. void (*uninitialize) (struct rt2x00_dev *rt2x00dev);
  478. /*
  479. * queue initialization handlers
  480. */
  481. bool (*get_entry_state) (struct queue_entry *entry);
  482. void (*clear_entry) (struct queue_entry *entry);
  483. /*
  484. * Radio control handlers.
  485. */
  486. int (*set_device_state) (struct rt2x00_dev *rt2x00dev,
  487. enum dev_state state);
  488. int (*rfkill_poll) (struct rt2x00_dev *rt2x00dev);
  489. void (*link_stats) (struct rt2x00_dev *rt2x00dev,
  490. struct link_qual *qual);
  491. void (*reset_tuner) (struct rt2x00_dev *rt2x00dev,
  492. struct link_qual *qual);
  493. void (*link_tuner) (struct rt2x00_dev *rt2x00dev,
  494. struct link_qual *qual, const u32 count);
  495. void (*gain_calibration) (struct rt2x00_dev *rt2x00dev);
  496. /*
  497. * Data queue handlers.
  498. */
  499. void (*watchdog) (struct rt2x00_dev *rt2x00dev);
  500. void (*start_queue) (struct data_queue *queue);
  501. void (*kick_queue) (struct data_queue *queue);
  502. void (*stop_queue) (struct data_queue *queue);
  503. void (*flush_queue) (struct data_queue *queue, bool drop);
  504. void (*tx_dma_done) (struct queue_entry *entry);
  505. /*
  506. * TX control handlers
  507. */
  508. void (*write_tx_desc) (struct queue_entry *entry,
  509. struct txentry_desc *txdesc);
  510. void (*write_tx_data) (struct queue_entry *entry,
  511. struct txentry_desc *txdesc);
  512. void (*write_beacon) (struct queue_entry *entry,
  513. struct txentry_desc *txdesc);
  514. void (*clear_beacon) (struct queue_entry *entry);
  515. int (*get_tx_data_len) (struct queue_entry *entry);
  516. /*
  517. * RX control handlers
  518. */
  519. void (*fill_rxdone) (struct queue_entry *entry,
  520. struct rxdone_entry_desc *rxdesc);
  521. /*
  522. * Configuration handlers.
  523. */
  524. int (*config_shared_key) (struct rt2x00_dev *rt2x00dev,
  525. struct rt2x00lib_crypto *crypto,
  526. struct ieee80211_key_conf *key);
  527. int (*config_pairwise_key) (struct rt2x00_dev *rt2x00dev,
  528. struct rt2x00lib_crypto *crypto,
  529. struct ieee80211_key_conf *key);
  530. void (*config_filter) (struct rt2x00_dev *rt2x00dev,
  531. const unsigned int filter_flags);
  532. void (*config_intf) (struct rt2x00_dev *rt2x00dev,
  533. struct rt2x00_intf *intf,
  534. struct rt2x00intf_conf *conf,
  535. const unsigned int flags);
  536. #define CONFIG_UPDATE_TYPE ( 1 << 1 )
  537. #define CONFIG_UPDATE_MAC ( 1 << 2 )
  538. #define CONFIG_UPDATE_BSSID ( 1 << 3 )
  539. void (*config_erp) (struct rt2x00_dev *rt2x00dev,
  540. struct rt2x00lib_erp *erp,
  541. u32 changed);
  542. void (*config_ant) (struct rt2x00_dev *rt2x00dev,
  543. struct antenna_setup *ant);
  544. void (*config) (struct rt2x00_dev *rt2x00dev,
  545. struct rt2x00lib_conf *libconf,
  546. const unsigned int changed_flags);
  547. };
  548. /*
  549. * rt2x00 driver callback operation structure.
  550. */
  551. struct rt2x00_ops {
  552. const char *name;
  553. const unsigned int max_sta_intf;
  554. const unsigned int max_ap_intf;
  555. const unsigned int eeprom_size;
  556. const unsigned int rf_size;
  557. const unsigned int tx_queues;
  558. const unsigned int extra_tx_headroom;
  559. const struct data_queue_desc *rx;
  560. const struct data_queue_desc *tx;
  561. const struct data_queue_desc *bcn;
  562. const struct data_queue_desc *atim;
  563. const struct rt2x00lib_ops *lib;
  564. const void *drv;
  565. const struct ieee80211_ops *hw;
  566. #ifdef CONFIG_RT2X00_LIB_DEBUGFS
  567. const struct rt2x00debug *debugfs;
  568. #endif /* CONFIG_RT2X00_LIB_DEBUGFS */
  569. };
  570. /*
  571. * rt2x00 state flags
  572. */
  573. enum rt2x00_state_flags {
  574. /*
  575. * Device flags
  576. */
  577. DEVICE_STATE_PRESENT,
  578. DEVICE_STATE_REGISTERED_HW,
  579. DEVICE_STATE_INITIALIZED,
  580. DEVICE_STATE_STARTED,
  581. DEVICE_STATE_ENABLED_RADIO,
  582. DEVICE_STATE_SCANNING,
  583. /*
  584. * Driver configuration
  585. */
  586. CONFIG_CHANNEL_HT40,
  587. CONFIG_POWERSAVING,
  588. };
  589. /*
  590. * rt2x00 capability flags
  591. */
  592. enum rt2x00_capability_flags {
  593. /*
  594. * Requirements
  595. */
  596. REQUIRE_FIRMWARE,
  597. REQUIRE_BEACON_GUARD,
  598. REQUIRE_ATIM_QUEUE,
  599. REQUIRE_DMA,
  600. REQUIRE_COPY_IV,
  601. REQUIRE_L2PAD,
  602. REQUIRE_TXSTATUS_FIFO,
  603. REQUIRE_TASKLET_CONTEXT,
  604. REQUIRE_SW_SEQNO,
  605. REQUIRE_HT_TX_DESC,
  606. REQUIRE_PS_AUTOWAKE,
  607. /*
  608. * Capabilities
  609. */
  610. CAPABILITY_HW_BUTTON,
  611. CAPABILITY_HW_CRYPTO,
  612. CAPABILITY_POWER_LIMIT,
  613. CAPABILITY_CONTROL_FILTERS,
  614. CAPABILITY_CONTROL_FILTER_PSPOLL,
  615. CAPABILITY_PRE_TBTT_INTERRUPT,
  616. CAPABILITY_LINK_TUNING,
  617. CAPABILITY_FRAME_TYPE,
  618. CAPABILITY_RF_SEQUENCE,
  619. CAPABILITY_EXTERNAL_LNA_A,
  620. CAPABILITY_EXTERNAL_LNA_BG,
  621. CAPABILITY_DOUBLE_ANTENNA,
  622. CAPABILITY_BT_COEXIST,
  623. };
  624. /*
  625. * rt2x00 device structure.
  626. */
  627. struct rt2x00_dev {
  628. /*
  629. * Device structure.
  630. * The structure stored in here depends on the
  631. * system bus (PCI or USB).
  632. * When accessing this variable, the rt2x00dev_{pci,usb}
  633. * macros should be used for correct typecasting.
  634. */
  635. struct device *dev;
  636. /*
  637. * Callback functions.
  638. */
  639. const struct rt2x00_ops *ops;
  640. /*
  641. * IEEE80211 control structure.
  642. */
  643. struct ieee80211_hw *hw;
  644. struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
  645. enum ieee80211_band curr_band;
  646. int curr_freq;
  647. /*
  648. * If enabled, the debugfs interface structures
  649. * required for deregistration of debugfs.
  650. */
  651. #ifdef CONFIG_RT2X00_LIB_DEBUGFS
  652. struct rt2x00debug_intf *debugfs_intf;
  653. #endif /* CONFIG_RT2X00_LIB_DEBUGFS */
  654. /*
  655. * LED structure for changing the LED status
  656. * by mac8011 or the kernel.
  657. */
  658. #ifdef CONFIG_RT2X00_LIB_LEDS
  659. struct rt2x00_led led_radio;
  660. struct rt2x00_led led_assoc;
  661. struct rt2x00_led led_qual;
  662. u16 led_mcu_reg;
  663. #endif /* CONFIG_RT2X00_LIB_LEDS */
  664. /*
  665. * Device state flags.
  666. * In these flags the current status is stored.
  667. * Access to these flags should occur atomically.
  668. */
  669. unsigned long flags;
  670. /*
  671. * Device capabiltiy flags.
  672. * In these flags the device/driver capabilities are stored.
  673. * Access to these flags should occur non-atomically.
  674. */
  675. unsigned long cap_flags;
  676. /*
  677. * Device information, Bus IRQ and name (PCI, SoC)
  678. */
  679. int irq;
  680. const char *name;
  681. /*
  682. * Chipset identification.
  683. */
  684. struct rt2x00_chip chip;
  685. /*
  686. * hw capability specifications.
  687. */
  688. struct hw_mode_spec spec;
  689. /*
  690. * This is the default TX/RX antenna setup as indicated
  691. * by the device's EEPROM.
  692. */
  693. struct antenna_setup default_ant;
  694. /*
  695. * Register pointers
  696. * csr.base: CSR base register address. (PCI)
  697. * csr.cache: CSR cache for usb_control_msg. (USB)
  698. */
  699. union csr {
  700. void __iomem *base;
  701. void *cache;
  702. } csr;
  703. /*
  704. * Mutex to protect register accesses.
  705. * For PCI and USB devices it protects against concurrent indirect
  706. * register access (BBP, RF, MCU) since accessing those
  707. * registers require multiple calls to the CSR registers.
  708. * For USB devices it also protects the csr_cache since that
  709. * field is used for normal CSR access and it cannot support
  710. * multiple callers simultaneously.
  711. */
  712. struct mutex csr_mutex;
  713. /*
  714. * Current packet filter configuration for the device.
  715. * This contains all currently active FIF_* flags send
  716. * to us by mac80211 during configure_filter().
  717. */
  718. unsigned int packet_filter;
  719. /*
  720. * Interface details:
  721. * - Open ap interface count.
  722. * - Open sta interface count.
  723. * - Association count.
  724. * - Beaconing enabled count.
  725. */
  726. unsigned int intf_ap_count;
  727. unsigned int intf_sta_count;
  728. unsigned int intf_associated;
  729. unsigned int intf_beaconing;
  730. /*
  731. * Link quality
  732. */
  733. struct link link;
  734. /*
  735. * EEPROM data.
  736. */
  737. __le16 *eeprom;
  738. /*
  739. * Active RF register values.
  740. * These are stored here so we don't need
  741. * to read the rf registers and can directly
  742. * use this value instead.
  743. * This field should be accessed by using
  744. * rt2x00_rf_read() and rt2x00_rf_write().
  745. */
  746. u32 *rf;
  747. /*
  748. * LNA gain
  749. */
  750. short lna_gain;
  751. /*
  752. * Current TX power value.
  753. */
  754. u16 tx_power;
  755. /*
  756. * Current retry values.
  757. */
  758. u8 short_retry;
  759. u8 long_retry;
  760. /*
  761. * Rssi <-> Dbm offset
  762. */
  763. u8 rssi_offset;
  764. /*
  765. * Frequency offset (for rt61pci & rt73usb).
  766. */
  767. u8 freq_offset;
  768. /*
  769. * Calibration information (for rt2800usb & rt2800pci).
  770. * [0] -> BW20
  771. * [1] -> BW40
  772. */
  773. u8 calibration[2];
  774. /*
  775. * Association id.
  776. */
  777. u16 aid;
  778. /*
  779. * Beacon interval.
  780. */
  781. u16 beacon_int;
  782. /**
  783. * Timestamp of last received beacon
  784. */
  785. unsigned long last_beacon;
  786. /*
  787. * Low level statistics which will have
  788. * to be kept up to date while device is running.
  789. */
  790. struct ieee80211_low_level_stats low_level_stats;
  791. /**
  792. * Work queue for all work which should not be placed
  793. * on the mac80211 workqueue (because of dependencies
  794. * between various work structures).
  795. */
  796. struct workqueue_struct *workqueue;
  797. /*
  798. * Scheduled work.
  799. * NOTE: intf_work will use ieee80211_iterate_active_interfaces()
  800. * which means it cannot be placed on the hw->workqueue
  801. * due to RTNL locking requirements.
  802. */
  803. struct work_struct intf_work;
  804. /**
  805. * Scheduled work for TX/RX done handling (USB devices)
  806. */
  807. struct work_struct rxdone_work;
  808. struct work_struct txdone_work;
  809. /*
  810. * Powersaving work
  811. */
  812. struct delayed_work autowakeup_work;
  813. /*
  814. * Data queue arrays for RX, TX, Beacon and ATIM.
  815. */
  816. unsigned int data_queues;
  817. struct data_queue *rx;
  818. struct data_queue *tx;
  819. struct data_queue *bcn;
  820. struct data_queue *atim;
  821. /*
  822. * Firmware image.
  823. */
  824. const struct firmware *fw;
  825. /*
  826. * FIFO for storing tx status reports between isr and tasklet.
  827. */
  828. DECLARE_KFIFO_PTR(txstatus_fifo, u32);
  829. /*
  830. * Timer to ensure tx status reports are read (rt2800usb).
  831. */
  832. struct timer_list txstatus_timer;
  833. /*
  834. * Tasklet for processing tx status reports (rt2800pci).
  835. */
  836. struct tasklet_struct txstatus_tasklet;
  837. struct tasklet_struct pretbtt_tasklet;
  838. struct tasklet_struct tbtt_tasklet;
  839. struct tasklet_struct rxdone_tasklet;
  840. struct tasklet_struct autowake_tasklet;
  841. /*
  842. * Protect the interrupt mask register.
  843. */
  844. spinlock_t irqmask_lock;
  845. };
  846. /*
  847. * Register defines.
  848. * Some registers require multiple attempts before success,
  849. * in those cases REGISTER_BUSY_COUNT attempts should be
  850. * taken with a REGISTER_BUSY_DELAY interval.
  851. */
  852. #define REGISTER_BUSY_COUNT 100
  853. #define REGISTER_BUSY_DELAY 100
  854. /*
  855. * Generic RF access.
  856. * The RF is being accessed by word index.
  857. */
  858. static inline void rt2x00_rf_read(struct rt2x00_dev *rt2x00dev,
  859. const unsigned int word, u32 *data)
  860. {
  861. BUG_ON(word < 1 || word > rt2x00dev->ops->rf_size / sizeof(u32));
  862. *data = rt2x00dev->rf[word - 1];
  863. }
  864. static inline void rt2x00_rf_write(struct rt2x00_dev *rt2x00dev,
  865. const unsigned int word, u32 data)
  866. {
  867. BUG_ON(word < 1 || word > rt2x00dev->ops->rf_size / sizeof(u32));
  868. rt2x00dev->rf[word - 1] = data;
  869. }
  870. /*
  871. * Generic EEPROM access.
  872. * The EEPROM is being accessed by word index.
  873. */
  874. static inline void *rt2x00_eeprom_addr(struct rt2x00_dev *rt2x00dev,
  875. const unsigned int word)
  876. {
  877. return (void *)&rt2x00dev->eeprom[word];
  878. }
  879. static inline void rt2x00_eeprom_read(struct rt2x00_dev *rt2x00dev,
  880. const unsigned int word, u16 *data)
  881. {
  882. *data = le16_to_cpu(rt2x00dev->eeprom[word]);
  883. }
  884. static inline void rt2x00_eeprom_write(struct rt2x00_dev *rt2x00dev,
  885. const unsigned int word, u16 data)
  886. {
  887. rt2x00dev->eeprom[word] = cpu_to_le16(data);
  888. }
  889. /*
  890. * Chipset handlers
  891. */
  892. static inline void rt2x00_set_chip(struct rt2x00_dev *rt2x00dev,
  893. const u16 rt, const u16 rf, const u16 rev)
  894. {
  895. rt2x00dev->chip.rt = rt;
  896. rt2x00dev->chip.rf = rf;
  897. rt2x00dev->chip.rev = rev;
  898. INFO(rt2x00dev,
  899. "Chipset detected - rt: %04x, rf: %04x, rev: %04x.\n",
  900. rt2x00dev->chip.rt, rt2x00dev->chip.rf, rt2x00dev->chip.rev);
  901. }
  902. static inline bool rt2x00_rt(struct rt2x00_dev *rt2x00dev, const u16 rt)
  903. {
  904. return (rt2x00dev->chip.rt == rt);
  905. }
  906. static inline bool rt2x00_rf(struct rt2x00_dev *rt2x00dev, const u16 rf)
  907. {
  908. return (rt2x00dev->chip.rf == rf);
  909. }
  910. static inline u16 rt2x00_rev(struct rt2x00_dev *rt2x00dev)
  911. {
  912. return rt2x00dev->chip.rev;
  913. }
  914. static inline bool rt2x00_rt_rev(struct rt2x00_dev *rt2x00dev,
  915. const u16 rt, const u16 rev)
  916. {
  917. return (rt2x00_rt(rt2x00dev, rt) && rt2x00_rev(rt2x00dev) == rev);
  918. }
  919. static inline bool rt2x00_rt_rev_lt(struct rt2x00_dev *rt2x00dev,
  920. const u16 rt, const u16 rev)
  921. {
  922. return (rt2x00_rt(rt2x00dev, rt) && rt2x00_rev(rt2x00dev) < rev);
  923. }
  924. static inline bool rt2x00_rt_rev_gte(struct rt2x00_dev *rt2x00dev,
  925. const u16 rt, const u16 rev)
  926. {
  927. return (rt2x00_rt(rt2x00dev, rt) && rt2x00_rev(rt2x00dev) >= rev);
  928. }
  929. static inline void rt2x00_set_chip_intf(struct rt2x00_dev *rt2x00dev,
  930. enum rt2x00_chip_intf intf)
  931. {
  932. rt2x00dev->chip.intf = intf;
  933. }
  934. static inline bool rt2x00_intf(struct rt2x00_dev *rt2x00dev,
  935. enum rt2x00_chip_intf intf)
  936. {
  937. return (rt2x00dev->chip.intf == intf);
  938. }
  939. static inline bool rt2x00_is_pci(struct rt2x00_dev *rt2x00dev)
  940. {
  941. return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_PCI) ||
  942. rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_PCIE);
  943. }
  944. static inline bool rt2x00_is_pcie(struct rt2x00_dev *rt2x00dev)
  945. {
  946. return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_PCIE);
  947. }
  948. static inline bool rt2x00_is_usb(struct rt2x00_dev *rt2x00dev)
  949. {
  950. return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_USB);
  951. }
  952. static inline bool rt2x00_is_soc(struct rt2x00_dev *rt2x00dev)
  953. {
  954. return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_SOC);
  955. }
  956. /**
  957. * rt2x00queue_map_txskb - Map a skb into DMA for TX purposes.
  958. * @entry: Pointer to &struct queue_entry
  959. */
  960. void rt2x00queue_map_txskb(struct queue_entry *entry);
  961. /**
  962. * rt2x00queue_unmap_skb - Unmap a skb from DMA.
  963. * @entry: Pointer to &struct queue_entry
  964. */
  965. void rt2x00queue_unmap_skb(struct queue_entry *entry);
  966. /**
  967. * rt2x00queue_get_tx_queue - Convert tx queue index to queue pointer
  968. * @rt2x00dev: Pointer to &struct rt2x00_dev.
  969. * @queue: rt2x00 queue index (see &enum data_queue_qid).
  970. *
  971. * Returns NULL for non tx queues.
  972. */
  973. static inline struct data_queue *
  974. rt2x00queue_get_tx_queue(struct rt2x00_dev *rt2x00dev,
  975. const enum data_queue_qid queue)
  976. {
  977. if (queue < rt2x00dev->ops->tx_queues && rt2x00dev->tx)
  978. return &rt2x00dev->tx[queue];
  979. if (queue == QID_ATIM)
  980. return rt2x00dev->atim;
  981. return NULL;
  982. }
  983. /**
  984. * rt2x00queue_get_entry - Get queue entry where the given index points to.
  985. * @queue: Pointer to &struct data_queue from where we obtain the entry.
  986. * @index: Index identifier for obtaining the correct index.
  987. */
  988. struct queue_entry *rt2x00queue_get_entry(struct data_queue *queue,
  989. enum queue_index index);
  990. /**
  991. * rt2x00queue_pause_queue - Pause a data queue
  992. * @queue: Pointer to &struct data_queue.
  993. *
  994. * This function will pause the data queue locally, preventing
  995. * new frames to be added to the queue (while the hardware is
  996. * still allowed to run).
  997. */
  998. void rt2x00queue_pause_queue(struct data_queue *queue);
  999. /**
  1000. * rt2x00queue_unpause_queue - unpause a data queue
  1001. * @queue: Pointer to &struct data_queue.
  1002. *
  1003. * This function will unpause the data queue locally, allowing
  1004. * new frames to be added to the queue again.
  1005. */
  1006. void rt2x00queue_unpause_queue(struct data_queue *queue);
  1007. /**
  1008. * rt2x00queue_start_queue - Start a data queue
  1009. * @queue: Pointer to &struct data_queue.
  1010. *
  1011. * This function will start handling all pending frames in the queue.
  1012. */
  1013. void rt2x00queue_start_queue(struct data_queue *queue);
  1014. /**
  1015. * rt2x00queue_stop_queue - Halt a data queue
  1016. * @queue: Pointer to &struct data_queue.
  1017. *
  1018. * This function will stop all pending frames in the queue.
  1019. */
  1020. void rt2x00queue_stop_queue(struct data_queue *queue);
  1021. /**
  1022. * rt2x00queue_flush_queue - Flush a data queue
  1023. * @queue: Pointer to &struct data_queue.
  1024. * @drop: True to drop all pending frames.
  1025. *
  1026. * This function will flush the queue. After this call
  1027. * the queue is guaranteed to be empty.
  1028. */
  1029. void rt2x00queue_flush_queue(struct data_queue *queue, bool drop);
  1030. /**
  1031. * rt2x00queue_start_queues - Start all data queues
  1032. * @rt2x00dev: Pointer to &struct rt2x00_dev.
  1033. *
  1034. * This function will loop through all available queues to start them
  1035. */
  1036. void rt2x00queue_start_queues(struct rt2x00_dev *rt2x00dev);
  1037. /**
  1038. * rt2x00queue_stop_queues - Halt all data queues
  1039. * @rt2x00dev: Pointer to &struct rt2x00_dev.
  1040. *
  1041. * This function will loop through all available queues to stop
  1042. * any pending frames.
  1043. */
  1044. void rt2x00queue_stop_queues(struct rt2x00_dev *rt2x00dev);
  1045. /**
  1046. * rt2x00queue_flush_queues - Flush all data queues
  1047. * @rt2x00dev: Pointer to &struct rt2x00_dev.
  1048. * @drop: True to drop all pending frames.
  1049. *
  1050. * This function will loop through all available queues to flush
  1051. * any pending frames.
  1052. */
  1053. void rt2x00queue_flush_queues(struct rt2x00_dev *rt2x00dev, bool drop);
  1054. /*
  1055. * Debugfs handlers.
  1056. */
  1057. /**
  1058. * rt2x00debug_dump_frame - Dump a frame to userspace through debugfs.
  1059. * @rt2x00dev: Pointer to &struct rt2x00_dev.
  1060. * @type: The type of frame that is being dumped.
  1061. * @skb: The skb containing the frame to be dumped.
  1062. */
  1063. #ifdef CONFIG_RT2X00_LIB_DEBUGFS
  1064. void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev,
  1065. enum rt2x00_dump_type type, struct sk_buff *skb);
  1066. #else
  1067. static inline void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev,
  1068. enum rt2x00_dump_type type,
  1069. struct sk_buff *skb)
  1070. {
  1071. }
  1072. #endif /* CONFIG_RT2X00_LIB_DEBUGFS */
  1073. /*
  1074. * Interrupt context handlers.
  1075. */
  1076. void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev);
  1077. void rt2x00lib_pretbtt(struct rt2x00_dev *rt2x00dev);
  1078. void rt2x00lib_dmastart(struct queue_entry *entry);
  1079. void rt2x00lib_dmadone(struct queue_entry *entry);
  1080. void rt2x00lib_txdone(struct queue_entry *entry,
  1081. struct txdone_entry_desc *txdesc);
  1082. void rt2x00lib_txdone_noinfo(struct queue_entry *entry, u32 status);
  1083. void rt2x00lib_rxdone(struct queue_entry *entry);
  1084. /*
  1085. * mac80211 handlers.
  1086. */
  1087. void rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb);
  1088. int rt2x00mac_start(struct ieee80211_hw *hw);
  1089. void rt2x00mac_stop(struct ieee80211_hw *hw);
  1090. int rt2x00mac_add_interface(struct ieee80211_hw *hw,
  1091. struct ieee80211_vif *vif);
  1092. void rt2x00mac_remove_interface(struct ieee80211_hw *hw,
  1093. struct ieee80211_vif *vif);
  1094. int rt2x00mac_config(struct ieee80211_hw *hw, u32 changed);
  1095. void rt2x00mac_configure_filter(struct ieee80211_hw *hw,
  1096. unsigned int changed_flags,
  1097. unsigned int *total_flags,
  1098. u64 multicast);
  1099. int rt2x00mac_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
  1100. bool set);
  1101. #ifdef CONFIG_RT2X00_LIB_CRYPTO
  1102. int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
  1103. struct ieee80211_vif *vif, struct ieee80211_sta *sta,
  1104. struct ieee80211_key_conf *key);
  1105. #else
  1106. #define rt2x00mac_set_key NULL
  1107. #endif /* CONFIG_RT2X00_LIB_CRYPTO */
  1108. void rt2x00mac_sw_scan_start(struct ieee80211_hw *hw);
  1109. void rt2x00mac_sw_scan_complete(struct ieee80211_hw *hw);
  1110. int rt2x00mac_get_stats(struct ieee80211_hw *hw,
  1111. struct ieee80211_low_level_stats *stats);
  1112. void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw,
  1113. struct ieee80211_vif *vif,
  1114. struct ieee80211_bss_conf *bss_conf,
  1115. u32 changes);
  1116. int rt2x00mac_conf_tx(struct ieee80211_hw *hw, u16 queue,
  1117. const struct ieee80211_tx_queue_params *params);
  1118. void rt2x00mac_rfkill_poll(struct ieee80211_hw *hw);
  1119. void rt2x00mac_flush(struct ieee80211_hw *hw, bool drop);
  1120. int rt2x00mac_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant);
  1121. int rt2x00mac_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant);
  1122. void rt2x00mac_get_ringparam(struct ieee80211_hw *hw,
  1123. u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max);
  1124. bool rt2x00mac_tx_frames_pending(struct ieee80211_hw *hw);
  1125. /*
  1126. * Driver allocation handlers.
  1127. */
  1128. int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev);
  1129. void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev);
  1130. #ifdef CONFIG_PM
  1131. int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state);
  1132. int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev);
  1133. #endif /* CONFIG_PM */
  1134. #endif /* RT2X00_H */