rt2x00queue.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. /*
  2. Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
  3. <http://rt2x00.serialmonkey.com>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the
  14. Free Software Foundation, Inc.,
  15. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  16. */
  17. /*
  18. Module: rt2x00
  19. Abstract: rt2x00 queue datastructures and routines
  20. */
  21. #ifndef RT2X00QUEUE_H
  22. #define RT2X00QUEUE_H
  23. #include <linux/prefetch.h>
  24. /**
  25. * DOC: Entrie frame size
  26. *
  27. * Ralink PCI devices demand the Frame size to be a multiple of 128 bytes,
  28. * for USB devices this restriction does not apply, but the value of
  29. * 2432 makes sense since it is big enough to contain the maximum fragment
  30. * size according to the ieee802.11 specs.
  31. */
  32. #define DATA_FRAME_SIZE 2432
  33. #define MGMT_FRAME_SIZE 256
  34. /**
  35. * DOC: Number of entries per queue
  36. *
  37. * Under normal load without fragmentation 12 entries are sufficient
  38. * without the queue being filled up to the maximum. When using fragmentation
  39. * and the queue threshold code we need to add some additional margins to
  40. * make sure the queue will never (or only under extreme load) fill up
  41. * completely.
  42. * Since we don't use preallocated DMA having a large number of queue entries
  43. * will have only minimal impact on the memory requirements for the queue.
  44. */
  45. #define RX_ENTRIES 24
  46. #define TX_ENTRIES 24
  47. #define BEACON_ENTRIES 1
  48. #define ATIM_ENTRIES 8
  49. /**
  50. * enum data_queue_qid: Queue identification
  51. *
  52. * @QID_AC_BE: AC BE queue
  53. * @QID_AC_BK: AC BK queue
  54. * @QID_AC_VI: AC VI queue
  55. * @QID_AC_VO: AC VO queue
  56. * @QID_HCCA: HCCA queue
  57. * @QID_MGMT: MGMT queue (prio queue)
  58. * @QID_RX: RX queue
  59. * @QID_OTHER: None of the above (don't use, only present for completeness)
  60. * @QID_BEACON: Beacon queue (value unspecified, don't send it to device)
  61. * @QID_ATIM: Atim queue (value unspeficied, don't send it to device)
  62. */
  63. enum data_queue_qid {
  64. QID_AC_BE = 0,
  65. QID_AC_BK = 1,
  66. QID_AC_VI = 2,
  67. QID_AC_VO = 3,
  68. QID_HCCA = 4,
  69. QID_MGMT = 13,
  70. QID_RX = 14,
  71. QID_OTHER = 15,
  72. QID_BEACON,
  73. QID_ATIM,
  74. };
  75. /**
  76. * enum skb_frame_desc_flags: Flags for &struct skb_frame_desc
  77. *
  78. * @SKBDESC_DMA_MAPPED_RX: &skb_dma field has been mapped for RX
  79. * @SKBDESC_DMA_MAPPED_TX: &skb_dma field has been mapped for TX
  80. * @FRAME_DESC_IV_STRIPPED: Frame contained a IV/EIV provided by
  81. * mac80211 but was stripped for processing by the driver.
  82. */
  83. enum skb_frame_desc_flags {
  84. SKBDESC_DMA_MAPPED_RX = 1 << 0,
  85. SKBDESC_DMA_MAPPED_TX = 1 << 1,
  86. FRAME_DESC_IV_STRIPPED = 1 << 2,
  87. };
  88. /**
  89. * struct skb_frame_desc: Descriptor information for the skb buffer
  90. *
  91. * This structure is placed over the driver_data array, this means that
  92. * this structure should not exceed the size of that array (40 bytes).
  93. *
  94. * @flags: Frame flags, see &enum skb_frame_desc_flags.
  95. * @desc_len: Length of the frame descriptor.
  96. * @tx_rate_idx: the index of the TX rate, used for TX status reporting
  97. * @tx_rate_flags: the TX rate flags, used for TX status reporting
  98. * @desc: Pointer to descriptor part of the frame.
  99. * Note that this pointer could point to something outside
  100. * of the scope of the skb->data pointer.
  101. * @iv: IV/EIV data used during encryption/decryption.
  102. * @skb_dma: (PCI-only) the DMA address associated with the sk buffer.
  103. * @entry: The entry to which this sk buffer belongs.
  104. */
  105. struct skb_frame_desc {
  106. u8 flags;
  107. u8 desc_len;
  108. u8 tx_rate_idx;
  109. u8 tx_rate_flags;
  110. void *desc;
  111. __le32 iv[2];
  112. dma_addr_t skb_dma;
  113. struct queue_entry *entry;
  114. };
  115. /**
  116. * get_skb_frame_desc - Obtain the rt2x00 frame descriptor from a sk_buff.
  117. * @skb: &struct sk_buff from where we obtain the &struct skb_frame_desc
  118. */
  119. static inline struct skb_frame_desc* get_skb_frame_desc(struct sk_buff *skb)
  120. {
  121. BUILD_BUG_ON(sizeof(struct skb_frame_desc) >
  122. IEEE80211_TX_INFO_DRIVER_DATA_SIZE);
  123. return (struct skb_frame_desc *)&IEEE80211_SKB_CB(skb)->driver_data;
  124. }
  125. /**
  126. * enum rxdone_entry_desc_flags: Flags for &struct rxdone_entry_desc
  127. *
  128. * @RXDONE_SIGNAL_PLCP: Signal field contains the plcp value.
  129. * @RXDONE_SIGNAL_BITRATE: Signal field contains the bitrate value.
  130. * @RXDONE_MY_BSS: Does this frame originate from device's BSS.
  131. * @RXDONE_CRYPTO_IV: Driver provided IV/EIV data.
  132. * @RXDONE_CRYPTO_ICV: Driver provided ICV data.
  133. */
  134. enum rxdone_entry_desc_flags {
  135. RXDONE_SIGNAL_PLCP = 1 << 0,
  136. RXDONE_SIGNAL_BITRATE = 1 << 1,
  137. RXDONE_MY_BSS = 1 << 2,
  138. RXDONE_CRYPTO_IV = 1 << 3,
  139. RXDONE_CRYPTO_ICV = 1 << 4,
  140. };
  141. /**
  142. * RXDONE_SIGNAL_MASK - Define to mask off all &rxdone_entry_desc_flags flags
  143. * except for the RXDONE_SIGNAL_* flags. This is useful to convert the dev_flags
  144. * from &rxdone_entry_desc to a signal value type.
  145. */
  146. #define RXDONE_SIGNAL_MASK \
  147. ( RXDONE_SIGNAL_PLCP | RXDONE_SIGNAL_BITRATE )
  148. /**
  149. * struct rxdone_entry_desc: RX Entry descriptor
  150. *
  151. * Summary of information that has been read from the RX frame descriptor.
  152. *
  153. * @timestamp: RX Timestamp
  154. * @signal: Signal of the received frame.
  155. * @rssi: RSSI of the received frame.
  156. * @noise: Measured noise during frame reception.
  157. * @size: Data size of the received frame.
  158. * @flags: MAC80211 receive flags (See &enum mac80211_rx_flags).
  159. * @dev_flags: Ralink receive flags (See &enum rxdone_entry_desc_flags).
  160. * @cipher: Cipher type used during decryption.
  161. * @cipher_status: Decryption status.
  162. * @iv: IV/EIV data used during decryption.
  163. * @icv: ICV data used during decryption.
  164. */
  165. struct rxdone_entry_desc {
  166. u64 timestamp;
  167. int signal;
  168. int rssi;
  169. int noise;
  170. int size;
  171. int flags;
  172. int dev_flags;
  173. u8 cipher;
  174. u8 cipher_status;
  175. __le32 iv[2];
  176. __le32 icv;
  177. };
  178. /**
  179. * enum txdone_entry_desc_flags: Flags for &struct txdone_entry_desc
  180. *
  181. * @TXDONE_UNKNOWN: Hardware could not determine success of transmission.
  182. * @TXDONE_SUCCESS: Frame was successfully send
  183. * @TXDONE_FAILURE: Frame was not successfully send
  184. * @TXDONE_EXCESSIVE_RETRY: In addition to &TXDONE_FAILURE, the
  185. * frame transmission failed due to excessive retries.
  186. */
  187. enum txdone_entry_desc_flags {
  188. TXDONE_UNKNOWN,
  189. TXDONE_SUCCESS,
  190. TXDONE_FAILURE,
  191. TXDONE_EXCESSIVE_RETRY,
  192. };
  193. /**
  194. * struct txdone_entry_desc: TX done entry descriptor
  195. *
  196. * Summary of information that has been read from the TX frame descriptor
  197. * after the device is done with transmission.
  198. *
  199. * @flags: TX done flags (See &enum txdone_entry_desc_flags).
  200. * @retry: Retry count.
  201. */
  202. struct txdone_entry_desc {
  203. unsigned long flags;
  204. int retry;
  205. };
  206. /**
  207. * enum txentry_desc_flags: Status flags for TX entry descriptor
  208. *
  209. * @ENTRY_TXD_RTS_FRAME: This frame is a RTS frame.
  210. * @ENTRY_TXD_CTS_FRAME: This frame is a CTS-to-self frame.
  211. * @ENTRY_TXD_GENERATE_SEQ: This frame requires sequence counter.
  212. * @ENTRY_TXD_FIRST_FRAGMENT: This is the first frame.
  213. * @ENTRY_TXD_MORE_FRAG: This frame is followed by another fragment.
  214. * @ENTRY_TXD_REQ_TIMESTAMP: Require timestamp to be inserted.
  215. * @ENTRY_TXD_BURST: This frame belongs to the same burst event.
  216. * @ENTRY_TXD_ACK: An ACK is required for this frame.
  217. * @ENTRY_TXD_RETRY_MODE: When set, the long retry count is used.
  218. * @ENTRY_TXD_ENCRYPT: This frame should be encrypted.
  219. * @ENTRY_TXD_ENCRYPT_PAIRWISE: Use pairwise key table (instead of shared).
  220. * @ENTRY_TXD_ENCRYPT_IV: Generate IV/EIV in hardware.
  221. * @ENTRY_TXD_ENCRYPT_MMIC: Generate MIC in hardware.
  222. */
  223. enum txentry_desc_flags {
  224. ENTRY_TXD_RTS_FRAME,
  225. ENTRY_TXD_CTS_FRAME,
  226. ENTRY_TXD_GENERATE_SEQ,
  227. ENTRY_TXD_FIRST_FRAGMENT,
  228. ENTRY_TXD_MORE_FRAG,
  229. ENTRY_TXD_REQ_TIMESTAMP,
  230. ENTRY_TXD_BURST,
  231. ENTRY_TXD_ACK,
  232. ENTRY_TXD_RETRY_MODE,
  233. ENTRY_TXD_ENCRYPT,
  234. ENTRY_TXD_ENCRYPT_PAIRWISE,
  235. ENTRY_TXD_ENCRYPT_IV,
  236. ENTRY_TXD_ENCRYPT_MMIC,
  237. };
  238. /**
  239. * struct txentry_desc: TX Entry descriptor
  240. *
  241. * Summary of information for the frame descriptor before sending a TX frame.
  242. *
  243. * @flags: Descriptor flags (See &enum queue_entry_flags).
  244. * @queue: Queue identification (See &enum data_queue_qid).
  245. * @length_high: PLCP length high word.
  246. * @length_low: PLCP length low word.
  247. * @signal: PLCP signal.
  248. * @service: PLCP service.
  249. * @rate_mode: Rate mode (See @enum rate_modulation).
  250. * @retry_limit: Max number of retries.
  251. * @aifs: AIFS value.
  252. * @ifs: IFS value.
  253. * @cw_min: cwmin value.
  254. * @cw_max: cwmax value.
  255. * @cipher: Cipher type used for encryption.
  256. * @key_idx: Key index used for encryption.
  257. * @iv_offset: Position where IV should be inserted by hardware.
  258. */
  259. struct txentry_desc {
  260. unsigned long flags;
  261. enum data_queue_qid queue;
  262. u16 length_high;
  263. u16 length_low;
  264. u16 signal;
  265. u16 service;
  266. u16 rate_mode;
  267. short retry_limit;
  268. short aifs;
  269. short ifs;
  270. short cw_min;
  271. short cw_max;
  272. enum cipher cipher;
  273. u16 key_idx;
  274. u16 iv_offset;
  275. };
  276. /**
  277. * enum queue_entry_flags: Status flags for queue entry
  278. *
  279. * @ENTRY_BCN_ASSIGNED: This entry has been assigned to an interface.
  280. * As long as this bit is set, this entry may only be touched
  281. * through the interface structure.
  282. * @ENTRY_OWNER_DEVICE_DATA: This entry is owned by the device for data
  283. * transfer (either TX or RX depending on the queue). The entry should
  284. * only be touched after the device has signaled it is done with it.
  285. * @ENTRY_OWNER_DEVICE_CRYPTO: This entry is owned by the device for data
  286. * encryption or decryption. The entry should only be touched after
  287. * the device has signaled it is done with it.
  288. * @ENTRY_DATA_PENDING: This entry contains a valid frame and is waiting
  289. * for the signal to start sending.
  290. */
  291. enum queue_entry_flags {
  292. ENTRY_BCN_ASSIGNED,
  293. ENTRY_OWNER_DEVICE_DATA,
  294. ENTRY_OWNER_DEVICE_CRYPTO,
  295. ENTRY_DATA_PENDING,
  296. };
  297. /**
  298. * struct queue_entry: Entry inside the &struct data_queue
  299. *
  300. * @flags: Entry flags, see &enum queue_entry_flags.
  301. * @queue: The data queue (&struct data_queue) to which this entry belongs.
  302. * @skb: The buffer which is currently being transmitted (for TX queue),
  303. * or used to directly recieve data in (for RX queue).
  304. * @entry_idx: The entry index number.
  305. * @priv_data: Private data belonging to this queue entry. The pointer
  306. * points to data specific to a particular driver and queue type.
  307. */
  308. struct queue_entry {
  309. unsigned long flags;
  310. struct data_queue *queue;
  311. struct sk_buff *skb;
  312. unsigned int entry_idx;
  313. void *priv_data;
  314. };
  315. /**
  316. * enum queue_index: Queue index type
  317. *
  318. * @Q_INDEX: Index pointer to the current entry in the queue, if this entry is
  319. * owned by the hardware then the queue is considered to be full.
  320. * @Q_INDEX_DONE: Index pointer to the next entry which will be completed by
  321. * the hardware and for which we need to run the txdone handler. If this
  322. * entry is not owned by the hardware the queue is considered to be empty.
  323. * @Q_INDEX_CRYPTO: Index pointer to the next entry which encryption/decription
  324. * will be completed by the hardware next.
  325. * @Q_INDEX_MAX: Keep last, used in &struct data_queue to determine the size
  326. * of the index array.
  327. */
  328. enum queue_index {
  329. Q_INDEX,
  330. Q_INDEX_DONE,
  331. Q_INDEX_CRYPTO,
  332. Q_INDEX_MAX,
  333. };
  334. /**
  335. * struct data_queue: Data queue
  336. *
  337. * @rt2x00dev: Pointer to main &struct rt2x00dev where this queue belongs to.
  338. * @entries: Base address of the &struct queue_entry which are
  339. * part of this queue.
  340. * @qid: The queue identification, see &enum data_queue_qid.
  341. * @lock: Spinlock to protect index handling. Whenever @index, @index_done or
  342. * @index_crypt needs to be changed this lock should be grabbed to prevent
  343. * index corruption due to concurrency.
  344. * @count: Number of frames handled in the queue.
  345. * @limit: Maximum number of entries in the queue.
  346. * @threshold: Minimum number of free entries before queue is kicked by force.
  347. * @length: Number of frames in queue.
  348. * @index: Index pointers to entry positions in the queue,
  349. * use &enum queue_index to get a specific index field.
  350. * @txop: maximum burst time.
  351. * @aifs: The aifs value for outgoing frames (field ignored in RX queue).
  352. * @cw_min: The cw min value for outgoing frames (field ignored in RX queue).
  353. * @cw_max: The cw max value for outgoing frames (field ignored in RX queue).
  354. * @data_size: Maximum data size for the frames in this queue.
  355. * @desc_size: Hardware descriptor size for the data in this queue.
  356. * @usb_endpoint: Device endpoint used for communication (USB only)
  357. * @usb_maxpacket: Max packet size for given endpoint (USB only)
  358. */
  359. struct data_queue {
  360. struct rt2x00_dev *rt2x00dev;
  361. struct queue_entry *entries;
  362. enum data_queue_qid qid;
  363. spinlock_t lock;
  364. unsigned int count;
  365. unsigned short limit;
  366. unsigned short threshold;
  367. unsigned short length;
  368. unsigned short index[Q_INDEX_MAX];
  369. unsigned short txop;
  370. unsigned short aifs;
  371. unsigned short cw_min;
  372. unsigned short cw_max;
  373. unsigned short data_size;
  374. unsigned short desc_size;
  375. unsigned short usb_endpoint;
  376. unsigned short usb_maxpacket;
  377. };
  378. /**
  379. * struct data_queue_desc: Data queue description
  380. *
  381. * The information in this structure is used by drivers
  382. * to inform rt2x00lib about the creation of the data queue.
  383. *
  384. * @entry_num: Maximum number of entries for a queue.
  385. * @data_size: Maximum data size for the frames in this queue.
  386. * @desc_size: Hardware descriptor size for the data in this queue.
  387. * @priv_size: Size of per-queue_entry private data.
  388. */
  389. struct data_queue_desc {
  390. unsigned short entry_num;
  391. unsigned short data_size;
  392. unsigned short desc_size;
  393. unsigned short priv_size;
  394. };
  395. /**
  396. * queue_end - Return pointer to the last queue (HELPER MACRO).
  397. * @__dev: Pointer to &struct rt2x00_dev
  398. *
  399. * Using the base rx pointer and the maximum number of available queues,
  400. * this macro will return the address of 1 position beyond the end of the
  401. * queues array.
  402. */
  403. #define queue_end(__dev) \
  404. &(__dev)->rx[(__dev)->data_queues]
  405. /**
  406. * tx_queue_end - Return pointer to the last TX queue (HELPER MACRO).
  407. * @__dev: Pointer to &struct rt2x00_dev
  408. *
  409. * Using the base tx pointer and the maximum number of available TX
  410. * queues, this macro will return the address of 1 position beyond
  411. * the end of the TX queue array.
  412. */
  413. #define tx_queue_end(__dev) \
  414. &(__dev)->tx[(__dev)->ops->tx_queues]
  415. /**
  416. * queue_next - Return pointer to next queue in list (HELPER MACRO).
  417. * @__queue: Current queue for which we need the next queue
  418. *
  419. * Using the current queue address we take the address directly
  420. * after the queue to take the next queue. Note that this macro
  421. * should be used carefully since it does not protect against
  422. * moving past the end of the list. (See macros &queue_end and
  423. * &tx_queue_end for determining the end of the queue).
  424. */
  425. #define queue_next(__queue) \
  426. &(__queue)[1]
  427. /**
  428. * queue_loop - Loop through the queues within a specific range (HELPER MACRO).
  429. * @__entry: Pointer where the current queue entry will be stored in.
  430. * @__start: Start queue pointer.
  431. * @__end: End queue pointer.
  432. *
  433. * This macro will loop through all queues between &__start and &__end.
  434. */
  435. #define queue_loop(__entry, __start, __end) \
  436. for ((__entry) = (__start); \
  437. prefetch(queue_next(__entry)), (__entry) != (__end);\
  438. (__entry) = queue_next(__entry))
  439. /**
  440. * queue_for_each - Loop through all queues
  441. * @__dev: Pointer to &struct rt2x00_dev
  442. * @__entry: Pointer where the current queue entry will be stored in.
  443. *
  444. * This macro will loop through all available queues.
  445. */
  446. #define queue_for_each(__dev, __entry) \
  447. queue_loop(__entry, (__dev)->rx, queue_end(__dev))
  448. /**
  449. * tx_queue_for_each - Loop through the TX queues
  450. * @__dev: Pointer to &struct rt2x00_dev
  451. * @__entry: Pointer where the current queue entry will be stored in.
  452. *
  453. * This macro will loop through all TX related queues excluding
  454. * the Beacon and Atim queues.
  455. */
  456. #define tx_queue_for_each(__dev, __entry) \
  457. queue_loop(__entry, (__dev)->tx, tx_queue_end(__dev))
  458. /**
  459. * txall_queue_for_each - Loop through all TX related queues
  460. * @__dev: Pointer to &struct rt2x00_dev
  461. * @__entry: Pointer where the current queue entry will be stored in.
  462. *
  463. * This macro will loop through all TX related queues including
  464. * the Beacon and Atim queues.
  465. */
  466. #define txall_queue_for_each(__dev, __entry) \
  467. queue_loop(__entry, (__dev)->tx, queue_end(__dev))
  468. /**
  469. * rt2x00queue_empty - Check if the queue is empty.
  470. * @queue: Queue to check if empty.
  471. */
  472. static inline int rt2x00queue_empty(struct data_queue *queue)
  473. {
  474. return queue->length == 0;
  475. }
  476. /**
  477. * rt2x00queue_full - Check if the queue is full.
  478. * @queue: Queue to check if full.
  479. */
  480. static inline int rt2x00queue_full(struct data_queue *queue)
  481. {
  482. return queue->length == queue->limit;
  483. }
  484. /**
  485. * rt2x00queue_free - Check the number of available entries in queue.
  486. * @queue: Queue to check.
  487. */
  488. static inline int rt2x00queue_available(struct data_queue *queue)
  489. {
  490. return queue->limit - queue->length;
  491. }
  492. /**
  493. * rt2x00queue_threshold - Check if the queue is below threshold
  494. * @queue: Queue to check.
  495. */
  496. static inline int rt2x00queue_threshold(struct data_queue *queue)
  497. {
  498. return rt2x00queue_available(queue) < queue->threshold;
  499. }
  500. /**
  501. * _rt2x00_desc_read - Read a word from the hardware descriptor.
  502. * @desc: Base descriptor address
  503. * @word: Word index from where the descriptor should be read.
  504. * @value: Address where the descriptor value should be written into.
  505. */
  506. static inline void _rt2x00_desc_read(__le32 *desc, const u8 word, __le32 *value)
  507. {
  508. *value = desc[word];
  509. }
  510. /**
  511. * rt2x00_desc_read - Read a word from the hardware descriptor, this
  512. * function will take care of the byte ordering.
  513. * @desc: Base descriptor address
  514. * @word: Word index from where the descriptor should be read.
  515. * @value: Address where the descriptor value should be written into.
  516. */
  517. static inline void rt2x00_desc_read(__le32 *desc, const u8 word, u32 *value)
  518. {
  519. __le32 tmp;
  520. _rt2x00_desc_read(desc, word, &tmp);
  521. *value = le32_to_cpu(tmp);
  522. }
  523. /**
  524. * rt2x00_desc_write - write a word to the hardware descriptor, this
  525. * function will take care of the byte ordering.
  526. * @desc: Base descriptor address
  527. * @word: Word index from where the descriptor should be written.
  528. * @value: Value that should be written into the descriptor.
  529. */
  530. static inline void _rt2x00_desc_write(__le32 *desc, const u8 word, __le32 value)
  531. {
  532. desc[word] = value;
  533. }
  534. /**
  535. * rt2x00_desc_write - write a word to the hardware descriptor.
  536. * @desc: Base descriptor address
  537. * @word: Word index from where the descriptor should be written.
  538. * @value: Value that should be written into the descriptor.
  539. */
  540. static inline void rt2x00_desc_write(__le32 *desc, const u8 word, u32 value)
  541. {
  542. _rt2x00_desc_write(desc, word, cpu_to_le32(value));
  543. }
  544. #endif /* RT2X00QUEUE_H */