rx_desc.h 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990
  1. /*
  2. * Copyright (c) 2005-2011 Atheros Communications Inc.
  3. * Copyright (c) 2011-2013 Qualcomm Atheros, Inc.
  4. *
  5. * Permission to use, copy, modify, and/or 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. #ifndef _RX_DESC_H_
  18. #define _RX_DESC_H_
  19. enum rx_attention_flags {
  20. RX_ATTENTION_FLAGS_FIRST_MPDU = 1 << 0,
  21. RX_ATTENTION_FLAGS_LAST_MPDU = 1 << 1,
  22. RX_ATTENTION_FLAGS_MCAST_BCAST = 1 << 2,
  23. RX_ATTENTION_FLAGS_PEER_IDX_INVALID = 1 << 3,
  24. RX_ATTENTION_FLAGS_PEER_IDX_TIMEOUT = 1 << 4,
  25. RX_ATTENTION_FLAGS_POWER_MGMT = 1 << 5,
  26. RX_ATTENTION_FLAGS_NON_QOS = 1 << 6,
  27. RX_ATTENTION_FLAGS_NULL_DATA = 1 << 7,
  28. RX_ATTENTION_FLAGS_MGMT_TYPE = 1 << 8,
  29. RX_ATTENTION_FLAGS_CTRL_TYPE = 1 << 9,
  30. RX_ATTENTION_FLAGS_MORE_DATA = 1 << 10,
  31. RX_ATTENTION_FLAGS_EOSP = 1 << 11,
  32. RX_ATTENTION_FLAGS_U_APSD_TRIGGER = 1 << 12,
  33. RX_ATTENTION_FLAGS_FRAGMENT = 1 << 13,
  34. RX_ATTENTION_FLAGS_ORDER = 1 << 14,
  35. RX_ATTENTION_FLAGS_CLASSIFICATION = 1 << 15,
  36. RX_ATTENTION_FLAGS_OVERFLOW_ERR = 1 << 16,
  37. RX_ATTENTION_FLAGS_MSDU_LENGTH_ERR = 1 << 17,
  38. RX_ATTENTION_FLAGS_TCP_UDP_CHKSUM_FAIL = 1 << 18,
  39. RX_ATTENTION_FLAGS_IP_CHKSUM_FAIL = 1 << 19,
  40. RX_ATTENTION_FLAGS_SA_IDX_INVALID = 1 << 20,
  41. RX_ATTENTION_FLAGS_DA_IDX_INVALID = 1 << 21,
  42. RX_ATTENTION_FLAGS_SA_IDX_TIMEOUT = 1 << 22,
  43. RX_ATTENTION_FLAGS_DA_IDX_TIMEOUT = 1 << 23,
  44. RX_ATTENTION_FLAGS_ENCRYPT_REQUIRED = 1 << 24,
  45. RX_ATTENTION_FLAGS_DIRECTED = 1 << 25,
  46. RX_ATTENTION_FLAGS_BUFFER_FRAGMENT = 1 << 26,
  47. RX_ATTENTION_FLAGS_MPDU_LENGTH_ERR = 1 << 27,
  48. RX_ATTENTION_FLAGS_TKIP_MIC_ERR = 1 << 28,
  49. RX_ATTENTION_FLAGS_DECRYPT_ERR = 1 << 29,
  50. RX_ATTENTION_FLAGS_FCS_ERR = 1 << 30,
  51. RX_ATTENTION_FLAGS_MSDU_DONE = 1 << 31,
  52. };
  53. struct rx_attention {
  54. __le32 flags; /* %RX_ATTENTION_FLAGS_ */
  55. } __packed;
  56. /*
  57. * first_mpdu
  58. * Indicates the first MSDU of the PPDU. If both first_mpdu
  59. * and last_mpdu are set in the MSDU then this is a not an
  60. * A-MPDU frame but a stand alone MPDU. Interior MPDU in an
  61. * A-MPDU shall have both first_mpdu and last_mpdu bits set to
  62. * 0. The PPDU start status will only be valid when this bit
  63. * is set.
  64. *
  65. * last_mpdu
  66. * Indicates the last MSDU of the last MPDU of the PPDU. The
  67. * PPDU end status will only be valid when this bit is set.
  68. *
  69. * mcast_bcast
  70. * Multicast / broadcast indicator. Only set when the MAC
  71. * address 1 bit 0 is set indicating mcast/bcast and the BSSID
  72. * matches one of the 4 BSSID registers. Only set when
  73. * first_msdu is set.
  74. *
  75. * peer_idx_invalid
  76. * Indicates no matching entries within the the max search
  77. * count. Only set when first_msdu is set.
  78. *
  79. * peer_idx_timeout
  80. * Indicates an unsuccessful search for the peer index due to
  81. * timeout. Only set when first_msdu is set.
  82. *
  83. * power_mgmt
  84. * Power management bit set in the 802.11 header. Only set
  85. * when first_msdu is set.
  86. *
  87. * non_qos
  88. * Set if packet is not a non-QoS data frame. Only set when
  89. * first_msdu is set.
  90. *
  91. * null_data
  92. * Set if frame type indicates either null data or QoS null
  93. * data format. Only set when first_msdu is set.
  94. *
  95. * mgmt_type
  96. * Set if packet is a management packet. Only set when
  97. * first_msdu is set.
  98. *
  99. * ctrl_type
  100. * Set if packet is a control packet. Only set when first_msdu
  101. * is set.
  102. *
  103. * more_data
  104. * Set if more bit in frame control is set. Only set when
  105. * first_msdu is set.
  106. *
  107. * eosp
  108. * Set if the EOSP (end of service period) bit in the QoS
  109. * control field is set. Only set when first_msdu is set.
  110. *
  111. * u_apsd_trigger
  112. * Set if packet is U-APSD trigger. Key table will have bits
  113. * per TID to indicate U-APSD trigger.
  114. *
  115. * fragment
  116. * Indicates that this is an 802.11 fragment frame. This is
  117. * set when either the more_frag bit is set in the frame
  118. * control or the fragment number is not zero. Only set when
  119. * first_msdu is set.
  120. *
  121. * order
  122. * Set if the order bit in the frame control is set. Only set
  123. * when first_msdu is set.
  124. *
  125. * classification
  126. * Indicates that this status has a corresponding MSDU that
  127. * requires FW processing. The OLE will have classification
  128. * ring mask registers which will indicate the ring(s) for
  129. * packets and descriptors which need FW attention.
  130. *
  131. * overflow_err
  132. * PCU Receive FIFO does not have enough space to store the
  133. * full receive packet. Enough space is reserved in the
  134. * receive FIFO for the status is written. This MPDU remaining
  135. * packets in the PPDU will be filtered and no Ack response
  136. * will be transmitted.
  137. *
  138. * msdu_length_err
  139. * Indicates that the MSDU length from the 802.3 encapsulated
  140. * length field extends beyond the MPDU boundary.
  141. *
  142. * tcp_udp_chksum_fail
  143. * Indicates that the computed checksum (tcp_udp_chksum) did
  144. * not match the checksum in the TCP/UDP header.
  145. *
  146. * ip_chksum_fail
  147. * Indicates that the computed checksum did not match the
  148. * checksum in the IP header.
  149. *
  150. * sa_idx_invalid
  151. * Indicates no matching entry was found in the address search
  152. * table for the source MAC address.
  153. *
  154. * da_idx_invalid
  155. * Indicates no matching entry was found in the address search
  156. * table for the destination MAC address.
  157. *
  158. * sa_idx_timeout
  159. * Indicates an unsuccessful search for the source MAC address
  160. * due to the expiring of the search timer.
  161. *
  162. * da_idx_timeout
  163. * Indicates an unsuccessful search for the destination MAC
  164. * address due to the expiring of the search timer.
  165. *
  166. * encrypt_required
  167. * Indicates that this data type frame is not encrypted even if
  168. * the policy for this MPDU requires encryption as indicated in
  169. * the peer table key type.
  170. *
  171. * directed
  172. * MPDU is a directed packet which means that the RA matched
  173. * our STA addresses. In proxySTA it means that the TA matched
  174. * an entry in our address search table with the corresponding
  175. * 'no_ack' bit is the address search entry cleared.
  176. *
  177. * buffer_fragment
  178. * Indicates that at least one of the rx buffers has been
  179. * fragmented. If set the FW should look at the rx_frag_info
  180. * descriptor described below.
  181. *
  182. * mpdu_length_err
  183. * Indicates that the MPDU was pre-maturely terminated
  184. * resulting in a truncated MPDU. Don't trust the MPDU length
  185. * field.
  186. *
  187. * tkip_mic_err
  188. * Indicates that the MPDU Michael integrity check failed
  189. *
  190. * decrypt_err
  191. * Indicates that the MPDU decrypt integrity check failed
  192. *
  193. * fcs_err
  194. * Indicates that the MPDU FCS check failed
  195. *
  196. * msdu_done
  197. * If set indicates that the RX packet data, RX header data, RX
  198. * PPDU start descriptor, RX MPDU start/end descriptor, RX MSDU
  199. * start/end descriptors and RX Attention descriptor are all
  200. * valid. This bit must be in the last octet of the
  201. * descriptor.
  202. */
  203. struct rx_frag_info {
  204. u8 ring0_more_count;
  205. u8 ring1_more_count;
  206. u8 ring2_more_count;
  207. u8 ring3_more_count;
  208. } __packed;
  209. /*
  210. * ring0_more_count
  211. * Indicates the number of more buffers associated with RX DMA
  212. * ring 0. Field is filled in by the RX_DMA.
  213. *
  214. * ring1_more_count
  215. * Indicates the number of more buffers associated with RX DMA
  216. * ring 1. Field is filled in by the RX_DMA.
  217. *
  218. * ring2_more_count
  219. * Indicates the number of more buffers associated with RX DMA
  220. * ring 2. Field is filled in by the RX_DMA.
  221. *
  222. * ring3_more_count
  223. * Indicates the number of more buffers associated with RX DMA
  224. * ring 3. Field is filled in by the RX_DMA.
  225. */
  226. enum htt_rx_mpdu_encrypt_type {
  227. HTT_RX_MPDU_ENCRYPT_WEP40 = 0,
  228. HTT_RX_MPDU_ENCRYPT_WEP104 = 1,
  229. HTT_RX_MPDU_ENCRYPT_TKIP_WITHOUT_MIC = 2,
  230. HTT_RX_MPDU_ENCRYPT_WEP128 = 3,
  231. HTT_RX_MPDU_ENCRYPT_TKIP_WPA = 4,
  232. HTT_RX_MPDU_ENCRYPT_WAPI = 5,
  233. HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2 = 6,
  234. HTT_RX_MPDU_ENCRYPT_NONE = 7,
  235. };
  236. #define RX_MPDU_START_INFO0_PEER_IDX_MASK 0x000007ff
  237. #define RX_MPDU_START_INFO0_PEER_IDX_LSB 0
  238. #define RX_MPDU_START_INFO0_SEQ_NUM_MASK 0x0fff0000
  239. #define RX_MPDU_START_INFO0_SEQ_NUM_LSB 16
  240. #define RX_MPDU_START_INFO0_ENCRYPT_TYPE_MASK 0xf0000000
  241. #define RX_MPDU_START_INFO0_ENCRYPT_TYPE_LSB 28
  242. #define RX_MPDU_START_INFO0_FROM_DS (1 << 11)
  243. #define RX_MPDU_START_INFO0_TO_DS (1 << 12)
  244. #define RX_MPDU_START_INFO0_ENCRYPTED (1 << 13)
  245. #define RX_MPDU_START_INFO0_RETRY (1 << 14)
  246. #define RX_MPDU_START_INFO0_TXBF_H_INFO (1 << 15)
  247. #define RX_MPDU_START_INFO1_TID_MASK 0xf0000000
  248. #define RX_MPDU_START_INFO1_TID_LSB 28
  249. #define RX_MPDU_START_INFO1_DIRECTED (1 << 16)
  250. struct rx_mpdu_start {
  251. __le32 info0;
  252. union {
  253. struct {
  254. __le32 pn31_0;
  255. __le32 info1; /* %RX_MPDU_START_INFO1_ */
  256. } __packed;
  257. struct {
  258. u8 pn[6];
  259. } __packed;
  260. } __packed;
  261. } __packed;
  262. /*
  263. * peer_idx
  264. * The index of the address search table which associated with
  265. * the peer table entry corresponding to this MPDU. Only valid
  266. * when first_msdu is set.
  267. *
  268. * fr_ds
  269. * Set if the from DS bit is set in the frame control. Only
  270. * valid when first_msdu is set.
  271. *
  272. * to_ds
  273. * Set if the to DS bit is set in the frame control. Only
  274. * valid when first_msdu is set.
  275. *
  276. * encrypted
  277. * Protected bit from the frame control. Only valid when
  278. * first_msdu is set.
  279. *
  280. * retry
  281. * Retry bit from the frame control. Only valid when
  282. * first_msdu is set.
  283. *
  284. * txbf_h_info
  285. * The MPDU data will contain H information. Primarily used
  286. * for debug.
  287. *
  288. * seq_num
  289. * The sequence number from the 802.11 header. Only valid when
  290. * first_msdu is set.
  291. *
  292. * encrypt_type
  293. * Indicates type of decrypt cipher used (as defined in the
  294. * peer table)
  295. * 0: WEP40
  296. * 1: WEP104
  297. * 2: TKIP without MIC
  298. * 3: WEP128
  299. * 4: TKIP (WPA)
  300. * 5: WAPI
  301. * 6: AES-CCM (WPA2)
  302. * 7: No cipher
  303. * Only valid when first_msdu_is set
  304. *
  305. * pn_31_0
  306. * Bits [31:0] of the PN number extracted from the IV field
  307. * WEP: IV = {key_id_octet, pn2, pn1, pn0}. Only pn[23:0] is
  308. * valid.
  309. * TKIP: IV = {pn5, pn4, pn3, pn2, key_id_octet, pn0,
  310. * WEPSeed[1], pn1}. Only pn[47:0] is valid.
  311. * AES-CCM: IV = {pn5, pn4, pn3, pn2, key_id_octet, 0x0, pn1,
  312. * pn0}. Only pn[47:0] is valid.
  313. * WAPI: IV = {key_id_octet, 0x0, pn15, pn14, pn13, pn12, pn11,
  314. * pn10, pn9, pn8, pn7, pn6, pn5, pn4, pn3, pn2, pn1, pn0}.
  315. * The ext_wapi_pn[127:48] in the rx_msdu_misc descriptor and
  316. * pn[47:0] are valid.
  317. * Only valid when first_msdu is set.
  318. *
  319. * pn_47_32
  320. * Bits [47:32] of the PN number. See description for
  321. * pn_31_0. The remaining PN fields are in the rx_msdu_end
  322. * descriptor
  323. *
  324. * pn
  325. * Use this field to access the pn without worrying about
  326. * byte-order and bitmasking/bitshifting.
  327. *
  328. * directed
  329. * See definition in RX attention descriptor
  330. *
  331. * reserved_2
  332. * Reserved: HW should fill with zero. FW should ignore.
  333. *
  334. * tid
  335. * The TID field in the QoS control field
  336. */
  337. #define RX_MPDU_END_INFO0_RESERVED_0_MASK 0x00001fff
  338. #define RX_MPDU_END_INFO0_RESERVED_0_LSB 0
  339. #define RX_MPDU_END_INFO0_POST_DELIM_CNT_MASK 0x0fff0000
  340. #define RX_MPDU_END_INFO0_POST_DELIM_CNT_LSB 16
  341. #define RX_MPDU_END_INFO0_OVERFLOW_ERR (1 << 13)
  342. #define RX_MPDU_END_INFO0_LAST_MPDU (1 << 14)
  343. #define RX_MPDU_END_INFO0_POST_DELIM_ERR (1 << 15)
  344. #define RX_MPDU_END_INFO0_MPDU_LENGTH_ERR (1 << 28)
  345. #define RX_MPDU_END_INFO0_TKIP_MIC_ERR (1 << 29)
  346. #define RX_MPDU_END_INFO0_DECRYPT_ERR (1 << 30)
  347. #define RX_MPDU_END_INFO0_FCS_ERR (1 << 31)
  348. struct rx_mpdu_end {
  349. __le32 info0;
  350. } __packed;
  351. /*
  352. * reserved_0
  353. * Reserved
  354. *
  355. * overflow_err
  356. * PCU Receive FIFO does not have enough space to store the
  357. * full receive packet. Enough space is reserved in the
  358. * receive FIFO for the status is written. This MPDU remaining
  359. * packets in the PPDU will be filtered and no Ack response
  360. * will be transmitted.
  361. *
  362. * last_mpdu
  363. * Indicates that this is the last MPDU of a PPDU.
  364. *
  365. * post_delim_err
  366. * Indicates that a delimiter FCS error occurred after this
  367. * MPDU before the next MPDU. Only valid when last_msdu is
  368. * set.
  369. *
  370. * post_delim_cnt
  371. * Count of the delimiters after this MPDU. This requires the
  372. * last MPDU to be held until all the EOF descriptors have been
  373. * received. This may be inefficient in the future when
  374. * ML-MIMO is used. Only valid when last_mpdu is set.
  375. *
  376. * mpdu_length_err
  377. * See definition in RX attention descriptor
  378. *
  379. * tkip_mic_err
  380. * See definition in RX attention descriptor
  381. *
  382. * decrypt_err
  383. * See definition in RX attention descriptor
  384. *
  385. * fcs_err
  386. * See definition in RX attention descriptor
  387. */
  388. #define RX_MSDU_START_INFO0_MSDU_LENGTH_MASK 0x00003fff
  389. #define RX_MSDU_START_INFO0_MSDU_LENGTH_LSB 0
  390. #define RX_MSDU_START_INFO0_IP_OFFSET_MASK 0x000fc000
  391. #define RX_MSDU_START_INFO0_IP_OFFSET_LSB 14
  392. #define RX_MSDU_START_INFO0_RING_MASK_MASK 0x00f00000
  393. #define RX_MSDU_START_INFO0_RING_MASK_LSB 20
  394. #define RX_MSDU_START_INFO0_TCP_UDP_OFFSET_MASK 0x7f000000
  395. #define RX_MSDU_START_INFO0_TCP_UDP_OFFSET_LSB 24
  396. #define RX_MSDU_START_INFO1_MSDU_NUMBER_MASK 0x000000ff
  397. #define RX_MSDU_START_INFO1_MSDU_NUMBER_LSB 0
  398. #define RX_MSDU_START_INFO1_DECAP_FORMAT_MASK 0x00000300
  399. #define RX_MSDU_START_INFO1_DECAP_FORMAT_LSB 8
  400. #define RX_MSDU_START_INFO1_SA_IDX_MASK 0x07ff0000
  401. #define RX_MSDU_START_INFO1_SA_IDX_LSB 16
  402. #define RX_MSDU_START_INFO1_IPV4_PROTO (1 << 10)
  403. #define RX_MSDU_START_INFO1_IPV6_PROTO (1 << 11)
  404. #define RX_MSDU_START_INFO1_TCP_PROTO (1 << 12)
  405. #define RX_MSDU_START_INFO1_UDP_PROTO (1 << 13)
  406. #define RX_MSDU_START_INFO1_IP_FRAG (1 << 14)
  407. #define RX_MSDU_START_INFO1_TCP_ONLY_ACK (1 << 15)
  408. enum rx_msdu_decap_format {
  409. RX_MSDU_DECAP_RAW = 0,
  410. RX_MSDU_DECAP_NATIVE_WIFI = 1,
  411. RX_MSDU_DECAP_ETHERNET2_DIX = 2,
  412. RX_MSDU_DECAP_8023_SNAP_LLC = 3
  413. };
  414. struct rx_msdu_start {
  415. __le32 info0; /* %RX_MSDU_START_INFO0_ */
  416. __le32 flow_id_crc;
  417. __le32 info1; /* %RX_MSDU_START_INFO1_ */
  418. } __packed;
  419. /*
  420. * msdu_length
  421. * MSDU length in bytes after decapsulation. This field is
  422. * still valid for MPDU frames without A-MSDU. It still
  423. * represents MSDU length after decapsulation
  424. *
  425. * ip_offset
  426. * Indicates the IP offset in bytes from the start of the
  427. * packet after decapsulation. Only valid if ipv4_proto or
  428. * ipv6_proto is set.
  429. *
  430. * ring_mask
  431. * Indicates the destination RX rings for this MSDU.
  432. *
  433. * tcp_udp_offset
  434. * Indicates the offset in bytes to the start of TCP or UDP
  435. * header from the start of the IP header after decapsulation.
  436. * Only valid if tcp_prot or udp_prot is set. The value 0
  437. * indicates that the offset is longer than 127 bytes.
  438. *
  439. * reserved_0c
  440. * Reserved: HW should fill with zero. FW should ignore.
  441. *
  442. * flow_id_crc
  443. * The flow_id_crc runs CRC32 on the following information:
  444. * IPv4 option: dest_addr[31:0], src_addr [31:0], {24'b0,
  445. * protocol[7:0]}.
  446. * IPv6 option: dest_addr[127:0], src_addr [127:0], {24'b0,
  447. * next_header[7:0]}
  448. * UDP case: sort_port[15:0], dest_port[15:0]
  449. * TCP case: sort_port[15:0], dest_port[15:0],
  450. * {header_length[3:0], 6'b0, flags[5:0], window_size[15:0]},
  451. * {16'b0, urgent_ptr[15:0]}, all options except 32-bit
  452. * timestamp.
  453. *
  454. * msdu_number
  455. * Indicates the MSDU number within a MPDU. This value is
  456. * reset to zero at the start of each MPDU. If the number of
  457. * MSDU exceeds 255 this number will wrap using modulo 256.
  458. *
  459. * decap_format
  460. * Indicates the format after decapsulation:
  461. * 0: RAW: No decapsulation
  462. * 1: Native WiFi
  463. * 2: Ethernet 2 (DIX)
  464. * 3: 802.3 (SNAP/LLC)
  465. *
  466. * ipv4_proto
  467. * Set if L2 layer indicates IPv4 protocol.
  468. *
  469. * ipv6_proto
  470. * Set if L2 layer indicates IPv6 protocol.
  471. *
  472. * tcp_proto
  473. * Set if the ipv4_proto or ipv6_proto are set and the IP
  474. * protocol indicates TCP.
  475. *
  476. * udp_proto
  477. * Set if the ipv4_proto or ipv6_proto are set and the IP
  478. * protocol indicates UDP.
  479. *
  480. * ip_frag
  481. * Indicates that either the IP More frag bit is set or IP frag
  482. * number is non-zero. If set indicates that this is a
  483. * fragmented IP packet.
  484. *
  485. * tcp_only_ack
  486. * Set if only the TCP Ack bit is set in the TCP flags and if
  487. * the TCP payload is 0.
  488. *
  489. * sa_idx
  490. * The offset in the address table which matches the MAC source
  491. * address.
  492. *
  493. * reserved_2b
  494. * Reserved: HW should fill with zero. FW should ignore.
  495. */
  496. #define RX_MSDU_END_INFO0_REPORTED_MPDU_LENGTH_MASK 0x00003fff
  497. #define RX_MSDU_END_INFO0_REPORTED_MPDU_LENGTH_LSB 0
  498. #define RX_MSDU_END_INFO0_FIRST_MSDU (1 << 14)
  499. #define RX_MSDU_END_INFO0_LAST_MSDU (1 << 15)
  500. #define RX_MSDU_END_INFO0_PRE_DELIM_ERR (1 << 30)
  501. #define RX_MSDU_END_INFO0_RESERVED_3B (1 << 31)
  502. struct rx_msdu_end {
  503. __le16 ip_hdr_cksum;
  504. __le16 tcp_hdr_cksum;
  505. u8 key_id_octet;
  506. u8 classification_filter;
  507. u8 wapi_pn[10];
  508. __le32 info0;
  509. } __packed;
  510. /*
  511. *ip_hdr_chksum
  512. * This can include the IP header checksum or the pseudo header
  513. * checksum used by TCP/UDP checksum.
  514. *
  515. *tcp_udp_chksum
  516. * The value of the computed TCP/UDP checksum. A mode bit
  517. * selects whether this checksum is the full checksum or the
  518. * partial checksum which does not include the pseudo header.
  519. *
  520. *key_id_octet
  521. * The key ID octet from the IV. Only valid when first_msdu is
  522. * set.
  523. *
  524. *classification_filter
  525. * Indicates the number classification filter rule
  526. *
  527. *ext_wapi_pn_63_48
  528. * Extension PN (packet number) which is only used by WAPI.
  529. * This corresponds to WAPI PN bits [63:48] (pn6 and pn7). The
  530. * WAPI PN bits [63:0] are in the pn field of the rx_mpdu_start
  531. * descriptor.
  532. *
  533. *ext_wapi_pn_95_64
  534. * Extension PN (packet number) which is only used by WAPI.
  535. * This corresponds to WAPI PN bits [95:64] (pn8, pn9, pn10 and
  536. * pn11).
  537. *
  538. *ext_wapi_pn_127_96
  539. * Extension PN (packet number) which is only used by WAPI.
  540. * This corresponds to WAPI PN bits [127:96] (pn12, pn13, pn14,
  541. * pn15).
  542. *
  543. *reported_mpdu_length
  544. * MPDU length before decapsulation. Only valid when
  545. * first_msdu is set. This field is taken directly from the
  546. * length field of the A-MPDU delimiter or the preamble length
  547. * field for non-A-MPDU frames.
  548. *
  549. *first_msdu
  550. * Indicates the first MSDU of A-MSDU. If both first_msdu and
  551. * last_msdu are set in the MSDU then this is a non-aggregated
  552. * MSDU frame: normal MPDU. Interior MSDU in an A-MSDU shall
  553. * have both first_mpdu and last_mpdu bits set to 0.
  554. *
  555. *last_msdu
  556. * Indicates the last MSDU of the A-MSDU. MPDU end status is
  557. * only valid when last_msdu is set.
  558. *
  559. *reserved_3a
  560. * Reserved: HW should fill with zero. FW should ignore.
  561. *
  562. *pre_delim_err
  563. * Indicates that the first delimiter had a FCS failure. Only
  564. * valid when first_mpdu and first_msdu are set.
  565. *
  566. *reserved_3b
  567. * Reserved: HW should fill with zero. FW should ignore.
  568. */
  569. #define RX_PPDU_START_SIG_RATE_SELECT_OFDM 0
  570. #define RX_PPDU_START_SIG_RATE_SELECT_CCK 1
  571. #define RX_PPDU_START_SIG_RATE_OFDM_48 0
  572. #define RX_PPDU_START_SIG_RATE_OFDM_24 1
  573. #define RX_PPDU_START_SIG_RATE_OFDM_12 2
  574. #define RX_PPDU_START_SIG_RATE_OFDM_6 3
  575. #define RX_PPDU_START_SIG_RATE_OFDM_54 4
  576. #define RX_PPDU_START_SIG_RATE_OFDM_36 5
  577. #define RX_PPDU_START_SIG_RATE_OFDM_18 6
  578. #define RX_PPDU_START_SIG_RATE_OFDM_9 7
  579. #define RX_PPDU_START_SIG_RATE_CCK_LP_11 0
  580. #define RX_PPDU_START_SIG_RATE_CCK_LP_5_5 1
  581. #define RX_PPDU_START_SIG_RATE_CCK_LP_2 2
  582. #define RX_PPDU_START_SIG_RATE_CCK_LP_1 3
  583. #define RX_PPDU_START_SIG_RATE_CCK_SP_11 4
  584. #define RX_PPDU_START_SIG_RATE_CCK_SP_5_5 5
  585. #define RX_PPDU_START_SIG_RATE_CCK_SP_2 6
  586. #define HTT_RX_PPDU_START_PREAMBLE_LEGACY 0x04
  587. #define HTT_RX_PPDU_START_PREAMBLE_HT 0x08
  588. #define HTT_RX_PPDU_START_PREAMBLE_HT_WITH_TXBF 0x09
  589. #define HTT_RX_PPDU_START_PREAMBLE_VHT 0x0C
  590. #define HTT_RX_PPDU_START_PREAMBLE_VHT_WITH_TXBF 0x0D
  591. #define RX_PPDU_START_INFO0_IS_GREENFIELD (1 << 0)
  592. #define RX_PPDU_START_INFO1_L_SIG_RATE_MASK 0x0000000f
  593. #define RX_PPDU_START_INFO1_L_SIG_RATE_LSB 0
  594. #define RX_PPDU_START_INFO1_L_SIG_LENGTH_MASK 0x0001ffe0
  595. #define RX_PPDU_START_INFO1_L_SIG_LENGTH_LSB 5
  596. #define RX_PPDU_START_INFO1_L_SIG_TAIL_MASK 0x00fc0000
  597. #define RX_PPDU_START_INFO1_L_SIG_TAIL_LSB 18
  598. #define RX_PPDU_START_INFO1_PREAMBLE_TYPE_MASK 0xff000000
  599. #define RX_PPDU_START_INFO1_PREAMBLE_TYPE_LSB 24
  600. #define RX_PPDU_START_INFO1_L_SIG_RATE_SELECT (1 << 4)
  601. #define RX_PPDU_START_INFO1_L_SIG_PARITY (1 << 17)
  602. #define RX_PPDU_START_INFO2_HT_SIG_VHT_SIG_A_1_MASK 0x00ffffff
  603. #define RX_PPDU_START_INFO2_HT_SIG_VHT_SIG_A_1_LSB 0
  604. #define RX_PPDU_START_INFO3_HT_SIG_VHT_SIG_A_2_MASK 0x00ffffff
  605. #define RX_PPDU_START_INFO3_HT_SIG_VHT_SIG_A_2_LSB 0
  606. #define RX_PPDU_START_INFO3_TXBF_H_INFO (1 << 24)
  607. #define RX_PPDU_START_INFO4_VHT_SIG_B_MASK 0x1fffffff
  608. #define RX_PPDU_START_INFO4_VHT_SIG_B_LSB 0
  609. #define RX_PPDU_START_INFO5_SERVICE_MASK 0x0000ffff
  610. #define RX_PPDU_START_INFO5_SERVICE_LSB 0
  611. struct rx_ppdu_start {
  612. struct {
  613. u8 pri20_mhz;
  614. u8 ext20_mhz;
  615. u8 ext40_mhz;
  616. u8 ext80_mhz;
  617. } rssi_chains[4];
  618. u8 rssi_comb;
  619. __le16 rsvd0;
  620. u8 info0; /* %RX_PPDU_START_INFO0_ */
  621. __le32 info1; /* %RX_PPDU_START_INFO1_ */
  622. __le32 info2; /* %RX_PPDU_START_INFO2_ */
  623. __le32 info3; /* %RX_PPDU_START_INFO3_ */
  624. __le32 info4; /* %RX_PPDU_START_INFO4_ */
  625. __le32 info5; /* %RX_PPDU_START_INFO5_ */
  626. } __packed;
  627. /*
  628. * rssi_chain0_pri20
  629. * RSSI of RX PPDU on chain 0 of primary 20 MHz bandwidth.
  630. * Value of 0x80 indicates invalid.
  631. *
  632. * rssi_chain0_sec20
  633. * RSSI of RX PPDU on chain 0 of secondary 20 MHz bandwidth.
  634. * Value of 0x80 indicates invalid.
  635. *
  636. * rssi_chain0_sec40
  637. * RSSI of RX PPDU on chain 0 of secondary 40 MHz bandwidth.
  638. * Value of 0x80 indicates invalid.
  639. *
  640. * rssi_chain0_sec80
  641. * RSSI of RX PPDU on chain 0 of secondary 80 MHz bandwidth.
  642. * Value of 0x80 indicates invalid.
  643. *
  644. * rssi_chain1_pri20
  645. * RSSI of RX PPDU on chain 1 of primary 20 MHz bandwidth.
  646. * Value of 0x80 indicates invalid.
  647. *
  648. * rssi_chain1_sec20
  649. * RSSI of RX PPDU on chain 1 of secondary 20 MHz bandwidth.
  650. * Value of 0x80 indicates invalid.
  651. *
  652. * rssi_chain1_sec40
  653. * RSSI of RX PPDU on chain 1 of secondary 40 MHz bandwidth.
  654. * Value of 0x80 indicates invalid.
  655. *
  656. * rssi_chain1_sec80
  657. * RSSI of RX PPDU on chain 1 of secondary 80 MHz bandwidth.
  658. * Value of 0x80 indicates invalid.
  659. *
  660. * rssi_chain2_pri20
  661. * RSSI of RX PPDU on chain 2 of primary 20 MHz bandwidth.
  662. * Value of 0x80 indicates invalid.
  663. *
  664. * rssi_chain2_sec20
  665. * RSSI of RX PPDU on chain 2 of secondary 20 MHz bandwidth.
  666. * Value of 0x80 indicates invalid.
  667. *
  668. * rssi_chain2_sec40
  669. * RSSI of RX PPDU on chain 2 of secondary 40 MHz bandwidth.
  670. * Value of 0x80 indicates invalid.
  671. *
  672. * rssi_chain2_sec80
  673. * RSSI of RX PPDU on chain 2 of secondary 80 MHz bandwidth.
  674. * Value of 0x80 indicates invalid.
  675. *
  676. * rssi_chain3_pri20
  677. * RSSI of RX PPDU on chain 3 of primary 20 MHz bandwidth.
  678. * Value of 0x80 indicates invalid.
  679. *
  680. * rssi_chain3_sec20
  681. * RSSI of RX PPDU on chain 3 of secondary 20 MHz bandwidth.
  682. * Value of 0x80 indicates invalid.
  683. *
  684. * rssi_chain3_sec40
  685. * RSSI of RX PPDU on chain 3 of secondary 40 MHz bandwidth.
  686. * Value of 0x80 indicates invalid.
  687. *
  688. * rssi_chain3_sec80
  689. * RSSI of RX PPDU on chain 3 of secondary 80 MHz bandwidth.
  690. * Value of 0x80 indicates invalid.
  691. *
  692. * rssi_comb
  693. * The combined RSSI of RX PPDU of all active chains and
  694. * bandwidths. Value of 0x80 indicates invalid.
  695. *
  696. * reserved_4a
  697. * Reserved: HW should fill with 0, FW should ignore.
  698. *
  699. * is_greenfield
  700. * Do we really support this?
  701. *
  702. * reserved_4b
  703. * Reserved: HW should fill with 0, FW should ignore.
  704. *
  705. * l_sig_rate
  706. * If l_sig_rate_select is 0:
  707. * 0x8: OFDM 48 Mbps
  708. * 0x9: OFDM 24 Mbps
  709. * 0xA: OFDM 12 Mbps
  710. * 0xB: OFDM 6 Mbps
  711. * 0xC: OFDM 54 Mbps
  712. * 0xD: OFDM 36 Mbps
  713. * 0xE: OFDM 18 Mbps
  714. * 0xF: OFDM 9 Mbps
  715. * If l_sig_rate_select is 1:
  716. * 0x8: CCK 11 Mbps long preamble
  717. * 0x9: CCK 5.5 Mbps long preamble
  718. * 0xA: CCK 2 Mbps long preamble
  719. * 0xB: CCK 1 Mbps long preamble
  720. * 0xC: CCK 11 Mbps short preamble
  721. * 0xD: CCK 5.5 Mbps short preamble
  722. * 0xE: CCK 2 Mbps short preamble
  723. *
  724. * l_sig_rate_select
  725. * Legacy signal rate select. If set then l_sig_rate indicates
  726. * CCK rates. If clear then l_sig_rate indicates OFDM rates.
  727. *
  728. * l_sig_length
  729. * Length of legacy frame in octets.
  730. *
  731. * l_sig_parity
  732. * Odd parity over l_sig_rate and l_sig_length
  733. *
  734. * l_sig_tail
  735. * Tail bits for Viterbi decoder
  736. *
  737. * preamble_type
  738. * Indicates the type of preamble ahead:
  739. * 0x4: Legacy (OFDM/CCK)
  740. * 0x8: HT
  741. * 0x9: HT with TxBF
  742. * 0xC: VHT
  743. * 0xD: VHT with TxBF
  744. * 0x80 - 0xFF: Reserved for special baseband data types such
  745. * as radar and spectral scan.
  746. *
  747. * ht_sig_vht_sig_a_1
  748. * If preamble_type == 0x8 or 0x9
  749. * HT-SIG (first 24 bits)
  750. * If preamble_type == 0xC or 0xD
  751. * VHT-SIG A (first 24 bits)
  752. * Else
  753. * Reserved
  754. *
  755. * reserved_6
  756. * Reserved: HW should fill with 0, FW should ignore.
  757. *
  758. * ht_sig_vht_sig_a_2
  759. * If preamble_type == 0x8 or 0x9
  760. * HT-SIG (last 24 bits)
  761. * If preamble_type == 0xC or 0xD
  762. * VHT-SIG A (last 24 bits)
  763. * Else
  764. * Reserved
  765. *
  766. * txbf_h_info
  767. * Indicates that the packet data carries H information which
  768. * is used for TxBF debug.
  769. *
  770. * reserved_7
  771. * Reserved: HW should fill with 0, FW should ignore.
  772. *
  773. * vht_sig_b
  774. * WiFi 1.0 and WiFi 2.0 will likely have this field to be all
  775. * 0s since the BB does not plan on decoding VHT SIG-B.
  776. *
  777. * reserved_8
  778. * Reserved: HW should fill with 0, FW should ignore.
  779. *
  780. * service
  781. * Service field from BB for OFDM, HT and VHT packets. CCK
  782. * packets will have service field of 0.
  783. *
  784. * reserved_9
  785. * Reserved: HW should fill with 0, FW should ignore.
  786. */
  787. #define RX_PPDU_END_FLAGS_PHY_ERR (1 << 0)
  788. #define RX_PPDU_END_FLAGS_RX_LOCATION (1 << 1)
  789. #define RX_PPDU_END_FLAGS_TXBF_H_INFO (1 << 2)
  790. #define RX_PPDU_END_INFO0_RX_ANTENNA_MASK 0x00ffffff
  791. #define RX_PPDU_END_INFO0_RX_ANTENNA_LSB 0
  792. #define RX_PPDU_END_INFO0_FLAGS_TX_HT_VHT_ACK (1 << 24)
  793. #define RX_PPDU_END_INFO0_BB_CAPTURED_CHANNEL (1 << 25)
  794. #define RX_PPDU_END_INFO1_PPDU_DONE (1 << 15)
  795. struct rx_ppdu_end {
  796. __le32 evm_p0;
  797. __le32 evm_p1;
  798. __le32 evm_p2;
  799. __le32 evm_p3;
  800. __le32 evm_p4;
  801. __le32 evm_p5;
  802. __le32 evm_p6;
  803. __le32 evm_p7;
  804. __le32 evm_p8;
  805. __le32 evm_p9;
  806. __le32 evm_p10;
  807. __le32 evm_p11;
  808. __le32 evm_p12;
  809. __le32 evm_p13;
  810. __le32 evm_p14;
  811. __le32 evm_p15;
  812. __le32 tsf_timestamp;
  813. __le32 wb_timestamp;
  814. u8 locationing_timestamp;
  815. u8 phy_err_code;
  816. __le16 flags; /* %RX_PPDU_END_FLAGS_ */
  817. __le32 info0; /* %RX_PPDU_END_INFO0_ */
  818. __le16 bb_length;
  819. __le16 info1; /* %RX_PPDU_END_INFO1_ */
  820. } __packed;
  821. /*
  822. * evm_p0
  823. * EVM for pilot 0. Contain EVM for streams: 0, 1, 2 and 3.
  824. *
  825. * evm_p1
  826. * EVM for pilot 1. Contain EVM for streams: 0, 1, 2 and 3.
  827. *
  828. * evm_p2
  829. * EVM for pilot 2. Contain EVM for streams: 0, 1, 2 and 3.
  830. *
  831. * evm_p3
  832. * EVM for pilot 3. Contain EVM for streams: 0, 1, 2 and 3.
  833. *
  834. * evm_p4
  835. * EVM for pilot 4. Contain EVM for streams: 0, 1, 2 and 3.
  836. *
  837. * evm_p5
  838. * EVM for pilot 5. Contain EVM for streams: 0, 1, 2 and 3.
  839. *
  840. * evm_p6
  841. * EVM for pilot 6. Contain EVM for streams: 0, 1, 2 and 3.
  842. *
  843. * evm_p7
  844. * EVM for pilot 7. Contain EVM for streams: 0, 1, 2 and 3.
  845. *
  846. * evm_p8
  847. * EVM for pilot 8. Contain EVM for streams: 0, 1, 2 and 3.
  848. *
  849. * evm_p9
  850. * EVM for pilot 9. Contain EVM for streams: 0, 1, 2 and 3.
  851. *
  852. * evm_p10
  853. * EVM for pilot 10. Contain EVM for streams: 0, 1, 2 and 3.
  854. *
  855. * evm_p11
  856. * EVM for pilot 11. Contain EVM for streams: 0, 1, 2 and 3.
  857. *
  858. * evm_p12
  859. * EVM for pilot 12. Contain EVM for streams: 0, 1, 2 and 3.
  860. *
  861. * evm_p13
  862. * EVM for pilot 13. Contain EVM for streams: 0, 1, 2 and 3.
  863. *
  864. * evm_p14
  865. * EVM for pilot 14. Contain EVM for streams: 0, 1, 2 and 3.
  866. *
  867. * evm_p15
  868. * EVM for pilot 15. Contain EVM for streams: 0, 1, 2 and 3.
  869. *
  870. * tsf_timestamp
  871. * Receive TSF timestamp sampled on the rising edge of
  872. * rx_clear. For PHY errors this may be the current TSF when
  873. * phy_error is asserted if the rx_clear does not assert before
  874. * the end of the PHY error.
  875. *
  876. * wb_timestamp
  877. * WLAN/BT timestamp is a 1 usec resolution timestamp which
  878. * does not get updated based on receive beacon like TSF. The
  879. * same rules for capturing tsf_timestamp are used to capture
  880. * the wb_timestamp.
  881. *
  882. * locationing_timestamp
  883. * Timestamp used for locationing. This timestamp is used to
  884. * indicate fractions of usec. For example if the MAC clock is
  885. * running at 80 MHz, the timestamp will increment every 12.5
  886. * nsec. The value starts at 0 and increments to 79 and
  887. * returns to 0 and repeats. This information is valid for
  888. * every PPDU. This information can be used in conjunction
  889. * with wb_timestamp to capture large delta times.
  890. *
  891. * phy_err_code
  892. * See the 1.10.8.1.2 for the list of the PHY error codes.
  893. *
  894. * phy_err
  895. * Indicates a PHY error was detected for this PPDU.
  896. *
  897. * rx_location
  898. * Indicates that location information was requested.
  899. *
  900. * txbf_h_info
  901. * Indicates that the packet data carries H information which
  902. * is used for TxBF debug.
  903. *
  904. * reserved_18
  905. * Reserved: HW should fill with 0, FW should ignore.
  906. *
  907. * rx_antenna
  908. * Receive antenna value
  909. *
  910. * tx_ht_vht_ack
  911. * Indicates that a HT or VHT Ack/BA frame was transmitted in
  912. * response to this receive packet.
  913. *
  914. * bb_captured_channel
  915. * Indicates that the BB has captured a channel dump. FW can
  916. * then read the channel dump memory. This may indicate that
  917. * the channel was captured either based on PCU setting the
  918. * capture_channel bit BB descriptor or FW setting the
  919. * capture_channel mode bit.
  920. *
  921. * reserved_19
  922. * Reserved: HW should fill with 0, FW should ignore.
  923. *
  924. * bb_length
  925. * Indicates the number of bytes of baseband information for
  926. * PPDUs where the BB descriptor preamble type is 0x80 to 0xFF
  927. * which indicates that this is not a normal PPDU but rather
  928. * contains baseband debug information.
  929. *
  930. * reserved_20
  931. * Reserved: HW should fill with 0, FW should ignore.
  932. *
  933. * ppdu_done
  934. * PPDU end status is only valid when ppdu_done bit is set.
  935. * Every time HW sets this bit in memory FW/SW must clear this
  936. * bit in memory. FW will initialize all the ppdu_done dword
  937. * to 0.
  938. */
  939. #define FW_RX_DESC_INFO0_DISCARD (1 << 0)
  940. #define FW_RX_DESC_INFO0_FORWARD (1 << 1)
  941. #define FW_RX_DESC_INFO0_INSPECT (1 << 5)
  942. #define FW_RX_DESC_INFO0_EXT_MASK 0xC0
  943. #define FW_RX_DESC_INFO0_EXT_LSB 6
  944. struct fw_rx_desc_base {
  945. u8 info0;
  946. } __packed;
  947. #endif /* _RX_DESC_H_ */