desc.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. /*
  2. * Copyright (c) 2004-2008 Reyk Floeter <reyk@openbsd.org>
  3. * Copyright (c) 2006-2008 Nick Kossifidis <mickflemm@gmail.com>
  4. *
  5. * Permission to use, copy, modify, and distribute this software for any
  6. * purpose with or without fee is hereby granted, provided that the above
  7. * copyright notice and this permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  10. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  11. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  12. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  13. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  14. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  15. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16. *
  17. */
  18. /*
  19. * RX/TX descriptor structures
  20. */
  21. /**
  22. * struct ath5k_hw_rx_ctl - Common hardware RX control descriptor
  23. * @rx_control_0: RX control word 0
  24. * @rx_control_1: RX control word 1
  25. */
  26. struct ath5k_hw_rx_ctl {
  27. u32 rx_control_0;
  28. u32 rx_control_1;
  29. } __packed __aligned(4);
  30. /* RX control word 1 fields/flags */
  31. #define AR5K_DESC_RX_CTL1_BUF_LEN 0x00000fff /* data buffer length */
  32. #define AR5K_DESC_RX_CTL1_INTREQ 0x00002000 /* RX interrupt request */
  33. /**
  34. * struct ath5k_hw_rx_status - Common hardware RX status descriptor
  35. * @rx_status_0: RX status word 0
  36. * @rx_status_1: RX status word 1
  37. *
  38. * 5210, 5211 and 5212 differ only in the fields and flags defined below
  39. */
  40. struct ath5k_hw_rx_status {
  41. u32 rx_status_0;
  42. u32 rx_status_1;
  43. } __packed __aligned(4);
  44. /* 5210/5211 */
  45. /* RX status word 0 fields/flags */
  46. #define AR5K_5210_RX_DESC_STATUS0_DATA_LEN 0x00000fff /* RX data length */
  47. #define AR5K_5210_RX_DESC_STATUS0_MORE 0x00001000 /* more desc for this frame */
  48. #define AR5K_5210_RX_DESC_STATUS0_RECEIVE_ANT_5210 0x00004000 /* [5210] receive on ant 1 */
  49. #define AR5K_5210_RX_DESC_STATUS0_RECEIVE_RATE 0x00078000 /* reception rate */
  50. #define AR5K_5210_RX_DESC_STATUS0_RECEIVE_RATE_S 15
  51. #define AR5K_5210_RX_DESC_STATUS0_RECEIVE_SIGNAL 0x07f80000 /* rssi */
  52. #define AR5K_5210_RX_DESC_STATUS0_RECEIVE_SIGNAL_S 19
  53. #define AR5K_5210_RX_DESC_STATUS0_RECEIVE_ANT_5211 0x38000000 /* [5211] receive antenna */
  54. #define AR5K_5210_RX_DESC_STATUS0_RECEIVE_ANT_5211_S 27
  55. /* RX status word 1 fields/flags */
  56. #define AR5K_5210_RX_DESC_STATUS1_DONE 0x00000001 /* descriptor complete */
  57. #define AR5K_5210_RX_DESC_STATUS1_FRAME_RECEIVE_OK 0x00000002 /* reception success */
  58. #define AR5K_5210_RX_DESC_STATUS1_CRC_ERROR 0x00000004 /* CRC error */
  59. #define AR5K_5210_RX_DESC_STATUS1_FIFO_OVERRUN_5210 0x00000008 /* [5210] FIFO overrun */
  60. #define AR5K_5210_RX_DESC_STATUS1_DECRYPT_CRC_ERROR 0x00000010 /* decryption CRC failure */
  61. #define AR5K_5210_RX_DESC_STATUS1_PHY_ERROR 0x000000e0 /* PHY error */
  62. #define AR5K_5210_RX_DESC_STATUS1_PHY_ERROR_S 5
  63. #define AR5K_5210_RX_DESC_STATUS1_KEY_INDEX_VALID 0x00000100 /* key index valid */
  64. #define AR5K_5210_RX_DESC_STATUS1_KEY_INDEX 0x00007e00 /* decryption key index */
  65. #define AR5K_5210_RX_DESC_STATUS1_KEY_INDEX_S 9
  66. #define AR5K_5210_RX_DESC_STATUS1_RECEIVE_TIMESTAMP 0x0fff8000 /* 13 bit of TSF */
  67. #define AR5K_5210_RX_DESC_STATUS1_RECEIVE_TIMESTAMP_S 15
  68. #define AR5K_5210_RX_DESC_STATUS1_KEY_CACHE_MISS 0x10000000 /* key cache miss */
  69. /* 5212 */
  70. /* RX status word 0 fields/flags */
  71. #define AR5K_5212_RX_DESC_STATUS0_DATA_LEN 0x00000fff /* RX data length */
  72. #define AR5K_5212_RX_DESC_STATUS0_MORE 0x00001000 /* more desc for this frame */
  73. #define AR5K_5212_RX_DESC_STATUS0_DECOMP_CRC_ERROR 0x00002000 /* decompression CRC error */
  74. #define AR5K_5212_RX_DESC_STATUS0_RECEIVE_RATE 0x000f8000 /* reception rate */
  75. #define AR5K_5212_RX_DESC_STATUS0_RECEIVE_RATE_S 15
  76. #define AR5K_5212_RX_DESC_STATUS0_RECEIVE_SIGNAL 0x0ff00000 /* rssi */
  77. #define AR5K_5212_RX_DESC_STATUS0_RECEIVE_SIGNAL_S 20
  78. #define AR5K_5212_RX_DESC_STATUS0_RECEIVE_ANTENNA 0xf0000000 /* receive antenna */
  79. #define AR5K_5212_RX_DESC_STATUS0_RECEIVE_ANTENNA_S 28
  80. /* RX status word 1 fields/flags */
  81. #define AR5K_5212_RX_DESC_STATUS1_DONE 0x00000001 /* descriptor complete */
  82. #define AR5K_5212_RX_DESC_STATUS1_FRAME_RECEIVE_OK 0x00000002 /* frame reception success */
  83. #define AR5K_5212_RX_DESC_STATUS1_CRC_ERROR 0x00000004 /* CRC error */
  84. #define AR5K_5212_RX_DESC_STATUS1_DECRYPT_CRC_ERROR 0x00000008 /* decryption CRC failure */
  85. #define AR5K_5212_RX_DESC_STATUS1_PHY_ERROR 0x00000010 /* PHY error */
  86. #define AR5K_5212_RX_DESC_STATUS1_MIC_ERROR 0x00000020 /* MIC decrypt error */
  87. #define AR5K_5212_RX_DESC_STATUS1_KEY_INDEX_VALID 0x00000100 /* key index valid */
  88. #define AR5K_5212_RX_DESC_STATUS1_KEY_INDEX 0x0000fe00 /* decryption key index */
  89. #define AR5K_5212_RX_DESC_STATUS1_KEY_INDEX_S 9
  90. #define AR5K_5212_RX_DESC_STATUS1_RECEIVE_TIMESTAMP 0x7fff0000 /* first 15bit of the TSF */
  91. #define AR5K_5212_RX_DESC_STATUS1_RECEIVE_TIMESTAMP_S 16
  92. #define AR5K_5212_RX_DESC_STATUS1_KEY_CACHE_MISS 0x80000000 /* key cache miss */
  93. #define AR5K_5212_RX_DESC_STATUS1_PHY_ERROR_CODE 0x0000ff00 /* phy error code overlays key index and valid fields */
  94. #define AR5K_5212_RX_DESC_STATUS1_PHY_ERROR_CODE_S 8
  95. /**
  96. * enum ath5k_phy_error_code - PHY Error codes
  97. * @AR5K_RX_PHY_ERROR_UNDERRUN: Transmit underrun, [5210] No error
  98. * @AR5K_RX_PHY_ERROR_TIMING: Timing error
  99. * @AR5K_RX_PHY_ERROR_PARITY: Illegal parity
  100. * @AR5K_RX_PHY_ERROR_RATE: Illegal rate
  101. * @AR5K_RX_PHY_ERROR_LENGTH: Illegal length
  102. * @AR5K_RX_PHY_ERROR_RADAR: Radar detect, [5210] 64 QAM rate
  103. * @AR5K_RX_PHY_ERROR_SERVICE: Illegal service
  104. * @AR5K_RX_PHY_ERROR_TOR: Transmit override receive
  105. * @AR5K_RX_PHY_ERROR_OFDM_TIMING: OFDM Timing error [5212+]
  106. * @AR5K_RX_PHY_ERROR_OFDM_SIGNAL_PARITY: OFDM Signal parity error [5212+]
  107. * @AR5K_RX_PHY_ERROR_OFDM_RATE_ILLEGAL: OFDM Illegal rate [5212+]
  108. * @AR5K_RX_PHY_ERROR_OFDM_LENGTH_ILLEGAL: OFDM Illegal length [5212+]
  109. * @AR5K_RX_PHY_ERROR_OFDM_POWER_DROP: OFDM Power drop [5212+]
  110. * @AR5K_RX_PHY_ERROR_OFDM_SERVICE: OFDM Service (?) [5212+]
  111. * @AR5K_RX_PHY_ERROR_OFDM_RESTART: OFDM Restart (?) [5212+]
  112. * @AR5K_RX_PHY_ERROR_CCK_TIMING: CCK Timing error [5212+]
  113. * @AR5K_RX_PHY_ERROR_CCK_HEADER_CRC: Header CRC error [5212+]
  114. * @AR5K_RX_PHY_ERROR_CCK_RATE_ILLEGAL: Illegal rate [5212+]
  115. * @AR5K_RX_PHY_ERROR_CCK_SERVICE: CCK Service (?) [5212+]
  116. * @AR5K_RX_PHY_ERROR_CCK_RESTART: CCK Restart (?) [5212+]
  117. */
  118. enum ath5k_phy_error_code {
  119. AR5K_RX_PHY_ERROR_UNDERRUN = 0,
  120. AR5K_RX_PHY_ERROR_TIMING = 1,
  121. AR5K_RX_PHY_ERROR_PARITY = 2,
  122. AR5K_RX_PHY_ERROR_RATE = 3,
  123. AR5K_RX_PHY_ERROR_LENGTH = 4,
  124. AR5K_RX_PHY_ERROR_RADAR = 5,
  125. AR5K_RX_PHY_ERROR_SERVICE = 6,
  126. AR5K_RX_PHY_ERROR_TOR = 7,
  127. AR5K_RX_PHY_ERROR_OFDM_TIMING = 17,
  128. AR5K_RX_PHY_ERROR_OFDM_SIGNAL_PARITY = 18,
  129. AR5K_RX_PHY_ERROR_OFDM_RATE_ILLEGAL = 19,
  130. AR5K_RX_PHY_ERROR_OFDM_LENGTH_ILLEGAL = 20,
  131. AR5K_RX_PHY_ERROR_OFDM_POWER_DROP = 21,
  132. AR5K_RX_PHY_ERROR_OFDM_SERVICE = 22,
  133. AR5K_RX_PHY_ERROR_OFDM_RESTART = 23,
  134. AR5K_RX_PHY_ERROR_CCK_TIMING = 25,
  135. AR5K_RX_PHY_ERROR_CCK_HEADER_CRC = 26,
  136. AR5K_RX_PHY_ERROR_CCK_RATE_ILLEGAL = 27,
  137. AR5K_RX_PHY_ERROR_CCK_SERVICE = 30,
  138. AR5K_RX_PHY_ERROR_CCK_RESTART = 31,
  139. };
  140. /**
  141. * struct ath5k_hw_2w_tx_ctl - 5210/5211 hardware 2-word TX control descriptor
  142. * @tx_control_0: TX control word 0
  143. * @tx_control_1: TX control word 1
  144. */
  145. struct ath5k_hw_2w_tx_ctl {
  146. u32 tx_control_0;
  147. u32 tx_control_1;
  148. } __packed __aligned(4);
  149. /* TX control word 0 fields/flags */
  150. #define AR5K_2W_TX_DESC_CTL0_FRAME_LEN 0x00000fff /* frame length */
  151. #define AR5K_2W_TX_DESC_CTL0_HEADER_LEN_5210 0x0003f000 /* [5210] header length */
  152. #define AR5K_2W_TX_DESC_CTL0_HEADER_LEN_5210_S 12
  153. #define AR5K_2W_TX_DESC_CTL0_XMIT_RATE 0x003c0000 /* tx rate */
  154. #define AR5K_2W_TX_DESC_CTL0_XMIT_RATE_S 18
  155. #define AR5K_2W_TX_DESC_CTL0_RTSENA 0x00400000 /* RTS/CTS enable */
  156. #define AR5K_2W_TX_DESC_CTL0_LONG_PACKET_5210 0x00800000 /* [5210] long packet */
  157. #define AR5K_2W_TX_DESC_CTL0_VEOL_5211 0x00800000 /* [5211] virtual end-of-list */
  158. #define AR5K_2W_TX_DESC_CTL0_CLRDMASK 0x01000000 /* clear destination mask */
  159. #define AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT_5210 0x02000000 /* [5210] antenna selection */
  160. #define AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT_5211 0x1e000000 /* [5211] antenna selection */
  161. #define AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT \
  162. (ah->ah_version == AR5K_AR5210 ? \
  163. AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT_5210 : \
  164. AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT_5211)
  165. #define AR5K_2W_TX_DESC_CTL0_ANT_MODE_XMIT_S 25
  166. #define AR5K_2W_TX_DESC_CTL0_FRAME_TYPE_5210 0x1c000000 /* [5210] frame type */
  167. #define AR5K_2W_TX_DESC_CTL0_FRAME_TYPE_5210_S 26
  168. #define AR5K_2W_TX_DESC_CTL0_INTREQ 0x20000000 /* TX interrupt request */
  169. #define AR5K_2W_TX_DESC_CTL0_ENCRYPT_KEY_VALID 0x40000000 /* key is valid */
  170. /* TX control word 1 fields/flags */
  171. #define AR5K_2W_TX_DESC_CTL1_BUF_LEN 0x00000fff /* data buffer length */
  172. #define AR5K_2W_TX_DESC_CTL1_MORE 0x00001000 /* more desc for this frame */
  173. #define AR5K_2W_TX_DESC_CTL1_ENC_KEY_IDX_5210 0x0007e000 /* [5210] key table index */
  174. #define AR5K_2W_TX_DESC_CTL1_ENC_KEY_IDX_5211 0x000fe000 /* [5211] key table index */
  175. #define AR5K_2W_TX_DESC_CTL1_ENC_KEY_IDX \
  176. (ah->ah_version == AR5K_AR5210 ? \
  177. AR5K_2W_TX_DESC_CTL1_ENC_KEY_IDX_5210 : \
  178. AR5K_2W_TX_DESC_CTL1_ENC_KEY_IDX_5211)
  179. #define AR5K_2W_TX_DESC_CTL1_ENC_KEY_IDX_S 13
  180. #define AR5K_2W_TX_DESC_CTL1_FRAME_TYPE_5211 0x00700000 /* [5211] frame type */
  181. #define AR5K_2W_TX_DESC_CTL1_FRAME_TYPE_5211_S 20
  182. #define AR5K_2W_TX_DESC_CTL1_NOACK_5211 0x00800000 /* [5211] no ACK */
  183. #define AR5K_2W_TX_DESC_CTL1_RTS_DURATION_5210 0xfff80000 /* [5210] lower 13 bit of duration */
  184. /* Frame types */
  185. #define AR5K_AR5210_TX_DESC_FRAME_TYPE_NORMAL 0
  186. #define AR5K_AR5210_TX_DESC_FRAME_TYPE_ATIM 1
  187. #define AR5K_AR5210_TX_DESC_FRAME_TYPE_PSPOLL 2
  188. #define AR5K_AR5210_TX_DESC_FRAME_TYPE_NO_DELAY 3
  189. #define AR5K_AR5211_TX_DESC_FRAME_TYPE_BEACON 3
  190. #define AR5K_AR5210_TX_DESC_FRAME_TYPE_PIFS 4
  191. #define AR5K_AR5211_TX_DESC_FRAME_TYPE_PRESP 4
  192. /**
  193. * struct ath5k_hw_4w_tx_ctl - 5212 hardware 4-word TX control descriptor
  194. * @tx_control_0: TX control word 0
  195. * @tx_control_1: TX control word 1
  196. * @tx_control_2: TX control word 2
  197. * @tx_control_3: TX control word 3
  198. */
  199. struct ath5k_hw_4w_tx_ctl {
  200. u32 tx_control_0;
  201. u32 tx_control_1;
  202. u32 tx_control_2;
  203. u32 tx_control_3;
  204. } __packed __aligned(4);
  205. /* TX control word 0 fields/flags */
  206. #define AR5K_4W_TX_DESC_CTL0_FRAME_LEN 0x00000fff /* frame length */
  207. #define AR5K_4W_TX_DESC_CTL0_XMIT_POWER 0x003f0000 /* transmit power */
  208. #define AR5K_4W_TX_DESC_CTL0_XMIT_POWER_S 16
  209. #define AR5K_4W_TX_DESC_CTL0_RTSENA 0x00400000 /* RTS/CTS enable */
  210. #define AR5K_4W_TX_DESC_CTL0_VEOL 0x00800000 /* virtual end-of-list */
  211. #define AR5K_4W_TX_DESC_CTL0_CLRDMASK 0x01000000 /* clear destination mask */
  212. #define AR5K_4W_TX_DESC_CTL0_ANT_MODE_XMIT 0x1e000000 /* TX antenna selection */
  213. #define AR5K_4W_TX_DESC_CTL0_ANT_MODE_XMIT_S 25
  214. #define AR5K_4W_TX_DESC_CTL0_INTREQ 0x20000000 /* TX interrupt request */
  215. #define AR5K_4W_TX_DESC_CTL0_ENCRYPT_KEY_VALID 0x40000000 /* destination index valid */
  216. #define AR5K_4W_TX_DESC_CTL0_CTSENA 0x80000000 /* precede frame with CTS */
  217. /* TX control word 1 fields/flags */
  218. #define AR5K_4W_TX_DESC_CTL1_BUF_LEN 0x00000fff /* data buffer length */
  219. #define AR5K_4W_TX_DESC_CTL1_MORE 0x00001000 /* more desc for this frame */
  220. #define AR5K_4W_TX_DESC_CTL1_ENCRYPT_KEY_IDX 0x000fe000 /* destination table index */
  221. #define AR5K_4W_TX_DESC_CTL1_ENCRYPT_KEY_IDX_S 13
  222. #define AR5K_4W_TX_DESC_CTL1_FRAME_TYPE 0x00f00000 /* frame type */
  223. #define AR5K_4W_TX_DESC_CTL1_FRAME_TYPE_S 20
  224. #define AR5K_4W_TX_DESC_CTL1_NOACK 0x01000000 /* no ACK */
  225. #define AR5K_4W_TX_DESC_CTL1_COMP_PROC 0x06000000 /* compression processing */
  226. #define AR5K_4W_TX_DESC_CTL1_COMP_PROC_S 25
  227. #define AR5K_4W_TX_DESC_CTL1_COMP_IV_LEN 0x18000000 /* length of frame IV */
  228. #define AR5K_4W_TX_DESC_CTL1_COMP_IV_LEN_S 27
  229. #define AR5K_4W_TX_DESC_CTL1_COMP_ICV_LEN 0x60000000 /* length of frame ICV */
  230. #define AR5K_4W_TX_DESC_CTL1_COMP_ICV_LEN_S 29
  231. /* TX control word 2 fields/flags */
  232. #define AR5K_4W_TX_DESC_CTL2_RTS_DURATION 0x00007fff /* RTS/CTS duration */
  233. #define AR5K_4W_TX_DESC_CTL2_DURATION_UPD_EN 0x00008000 /* frame duration update */
  234. #define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES0 0x000f0000 /* series 0 max attempts */
  235. #define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES0_S 16
  236. #define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES1 0x00f00000 /* series 1 max attempts */
  237. #define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES1_S 20
  238. #define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES2 0x0f000000 /* series 2 max attempts */
  239. #define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES2_S 24
  240. #define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES3 0xf0000000 /* series 3 max attempts */
  241. #define AR5K_4W_TX_DESC_CTL2_XMIT_TRIES3_S 28
  242. /* TX control word 3 fields/flags */
  243. #define AR5K_4W_TX_DESC_CTL3_XMIT_RATE0 0x0000001f /* series 0 tx rate */
  244. #define AR5K_4W_TX_DESC_CTL3_XMIT_RATE1 0x000003e0 /* series 1 tx rate */
  245. #define AR5K_4W_TX_DESC_CTL3_XMIT_RATE1_S 5
  246. #define AR5K_4W_TX_DESC_CTL3_XMIT_RATE2 0x00007c00 /* series 2 tx rate */
  247. #define AR5K_4W_TX_DESC_CTL3_XMIT_RATE2_S 10
  248. #define AR5K_4W_TX_DESC_CTL3_XMIT_RATE3 0x000f8000 /* series 3 tx rate */
  249. #define AR5K_4W_TX_DESC_CTL3_XMIT_RATE3_S 15
  250. #define AR5K_4W_TX_DESC_CTL3_RTS_CTS_RATE 0x01f00000 /* RTS or CTS rate */
  251. #define AR5K_4W_TX_DESC_CTL3_RTS_CTS_RATE_S 20
  252. /**
  253. * struct ath5k_hw_tx_status - Common TX status descriptor
  254. * @tx_status_0: TX status word 0
  255. * @tx_status_1: TX status word 1
  256. */
  257. struct ath5k_hw_tx_status {
  258. u32 tx_status_0;
  259. u32 tx_status_1;
  260. } __packed __aligned(4);
  261. /* TX status word 0 fields/flags */
  262. #define AR5K_DESC_TX_STATUS0_FRAME_XMIT_OK 0x00000001 /* TX success */
  263. #define AR5K_DESC_TX_STATUS0_EXCESSIVE_RETRIES 0x00000002 /* excessive retries */
  264. #define AR5K_DESC_TX_STATUS0_FIFO_UNDERRUN 0x00000004 /* FIFO underrun */
  265. #define AR5K_DESC_TX_STATUS0_FILTERED 0x00000008 /* TX filter indication */
  266. /* according to the HAL sources the spec has short/long retry counts reversed.
  267. * we have it reversed to the HAL sources as well, for 5210 and 5211.
  268. * For 5212 these fields are defined as RTS_FAIL_COUNT and DATA_FAIL_COUNT,
  269. * but used respectively as SHORT and LONG retry count in the code later. This
  270. * is consistent with the definitions here... TODO: check */
  271. #define AR5K_DESC_TX_STATUS0_SHORT_RETRY_COUNT 0x000000f0 /* short retry count */
  272. #define AR5K_DESC_TX_STATUS0_SHORT_RETRY_COUNT_S 4
  273. #define AR5K_DESC_TX_STATUS0_LONG_RETRY_COUNT 0x00000f00 /* long retry count */
  274. #define AR5K_DESC_TX_STATUS0_LONG_RETRY_COUNT_S 8
  275. #define AR5K_DESC_TX_STATUS0_VIRTCOLL_CT_5211 0x0000f000 /* [5211+] virtual collision count */
  276. #define AR5K_DESC_TX_STATUS0_VIRTCOLL_CT_5212_S 12
  277. #define AR5K_DESC_TX_STATUS0_SEND_TIMESTAMP 0xffff0000 /* TX timestamp */
  278. #define AR5K_DESC_TX_STATUS0_SEND_TIMESTAMP_S 16
  279. /* TX status word 1 fields/flags */
  280. #define AR5K_DESC_TX_STATUS1_DONE 0x00000001 /* descriptor complete */
  281. #define AR5K_DESC_TX_STATUS1_SEQ_NUM 0x00001ffe /* TX sequence number */
  282. #define AR5K_DESC_TX_STATUS1_SEQ_NUM_S 1
  283. #define AR5K_DESC_TX_STATUS1_ACK_SIG_STRENGTH 0x001fe000 /* signal strength of ACK */
  284. #define AR5K_DESC_TX_STATUS1_ACK_SIG_STRENGTH_S 13
  285. #define AR5K_DESC_TX_STATUS1_FINAL_TS_IX_5212 0x00600000 /* [5212] final TX attempt series ix */
  286. #define AR5K_DESC_TX_STATUS1_FINAL_TS_IX_5212_S 21
  287. #define AR5K_DESC_TX_STATUS1_COMP_SUCCESS_5212 0x00800000 /* [5212] compression status */
  288. #define AR5K_DESC_TX_STATUS1_XMIT_ANTENNA_5212 0x01000000 /* [5212] transmit antenna */
  289. /**
  290. * struct ath5k_hw_5210_tx_desc - 5210/5211 hardware TX descriptor
  291. * @tx_ctl: The &struct ath5k_hw_2w_tx_ctl
  292. * @tx_stat: The &struct ath5k_hw_tx_status
  293. */
  294. struct ath5k_hw_5210_tx_desc {
  295. struct ath5k_hw_2w_tx_ctl tx_ctl;
  296. struct ath5k_hw_tx_status tx_stat;
  297. } __packed __aligned(4);
  298. /**
  299. * struct ath5k_hw_5212_tx_desc - 5212 hardware TX descriptor
  300. * @tx_ctl: The &struct ath5k_hw_4w_tx_ctl
  301. * @tx_stat: The &struct ath5k_hw_tx_status
  302. */
  303. struct ath5k_hw_5212_tx_desc {
  304. struct ath5k_hw_4w_tx_ctl tx_ctl;
  305. struct ath5k_hw_tx_status tx_stat;
  306. } __packed __aligned(4);
  307. /**
  308. * struct ath5k_hw_all_rx_desc - Common hardware RX descriptor
  309. * @rx_ctl: The &struct ath5k_hw_rx_ctl
  310. * @rx_stat: The &struct ath5k_hw_rx_status
  311. */
  312. struct ath5k_hw_all_rx_desc {
  313. struct ath5k_hw_rx_ctl rx_ctl;
  314. struct ath5k_hw_rx_status rx_stat;
  315. } __packed __aligned(4);
  316. /**
  317. * struct ath5k_desc - Atheros hardware DMA descriptor
  318. * @ds_link: Physical address of the next descriptor
  319. * @ds_data: Physical address of data buffer (skb)
  320. * @ud: Union containing hw_5xxx_tx_desc structs and hw_all_rx_desc
  321. *
  322. * This is read and written to by the hardware
  323. */
  324. struct ath5k_desc {
  325. u32 ds_link;
  326. u32 ds_data;
  327. union {
  328. struct ath5k_hw_5210_tx_desc ds_tx5210;
  329. struct ath5k_hw_5212_tx_desc ds_tx5212;
  330. struct ath5k_hw_all_rx_desc ds_rx;
  331. } ud;
  332. } __packed __aligned(4);
  333. #define AR5K_RXDESC_INTREQ 0x0020
  334. #define AR5K_TXDESC_CLRDMASK 0x0001
  335. #define AR5K_TXDESC_NOACK 0x0002 /*[5211+]*/
  336. #define AR5K_TXDESC_RTSENA 0x0004
  337. #define AR5K_TXDESC_CTSENA 0x0008
  338. #define AR5K_TXDESC_INTREQ 0x0010
  339. #define AR5K_TXDESC_VEOL 0x0020 /*[5211+]*/