rx_desc.h 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215
  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. #define RX_MSDU_START_INFO2_DA_IDX_MASK 0x000007ff
  409. #define RX_MSDU_START_INFO2_DA_IDX_LSB 0
  410. #define RX_MSDU_START_INFO2_IP_PROTO_FIELD_MASK 0x00ff0000
  411. #define RX_MSDU_START_INFO2_IP_PROTO_FIELD_LSB 16
  412. #define RX_MSDU_START_INFO2_DA_BCAST_MCAST BIT(11)
  413. /* The decapped header (rx_hdr_status) contains the following:
  414. * a) 802.11 header
  415. * [padding to 4 bytes]
  416. * b) HW crypto parameter
  417. * - 0 bytes for no security
  418. * - 4 bytes for WEP
  419. * - 8 bytes for TKIP, AES
  420. * [padding to 4 bytes]
  421. * c) A-MSDU subframe header (14 bytes) if appliable
  422. * d) LLC/SNAP (RFC1042, 8 bytes)
  423. *
  424. * In case of A-MSDU only first frame in sequence contains (a) and (b). */
  425. enum rx_msdu_decap_format {
  426. RX_MSDU_DECAP_RAW = 0,
  427. /* Note: QoS frames are reported as non-QoS. The rx_hdr_status in
  428. * htt_rx_desc contains the original decapped 802.11 header. */
  429. RX_MSDU_DECAP_NATIVE_WIFI = 1,
  430. /* Payload contains an ethernet header (struct ethhdr). */
  431. RX_MSDU_DECAP_ETHERNET2_DIX = 2,
  432. /* Payload contains two 48-bit addresses and 2-byte length (14 bytes
  433. * total), followed by an RFC1042 header (8 bytes). */
  434. RX_MSDU_DECAP_8023_SNAP_LLC = 3
  435. };
  436. struct rx_msdu_start_common {
  437. __le32 info0; /* %RX_MSDU_START_INFO0_ */
  438. __le32 flow_id_crc;
  439. __le32 info1; /* %RX_MSDU_START_INFO1_ */
  440. } __packed;
  441. struct rx_msdu_start_qca99x0 {
  442. __le32 info2; /* %RX_MSDU_START_INFO2_ */
  443. } __packed;
  444. struct rx_msdu_start {
  445. struct rx_msdu_start_common common;
  446. union {
  447. struct rx_msdu_start_qca99x0 qca99x0;
  448. } __packed;
  449. } __packed;
  450. /*
  451. * msdu_length
  452. * MSDU length in bytes after decapsulation. This field is
  453. * still valid for MPDU frames without A-MSDU. It still
  454. * represents MSDU length after decapsulation
  455. *
  456. * ip_offset
  457. * Indicates the IP offset in bytes from the start of the
  458. * packet after decapsulation. Only valid if ipv4_proto or
  459. * ipv6_proto is set.
  460. *
  461. * ring_mask
  462. * Indicates the destination RX rings for this MSDU.
  463. *
  464. * tcp_udp_offset
  465. * Indicates the offset in bytes to the start of TCP or UDP
  466. * header from the start of the IP header after decapsulation.
  467. * Only valid if tcp_prot or udp_prot is set. The value 0
  468. * indicates that the offset is longer than 127 bytes.
  469. *
  470. * reserved_0c
  471. * Reserved: HW should fill with zero. FW should ignore.
  472. *
  473. * flow_id_crc
  474. * The flow_id_crc runs CRC32 on the following information:
  475. * IPv4 option: dest_addr[31:0], src_addr [31:0], {24'b0,
  476. * protocol[7:0]}.
  477. * IPv6 option: dest_addr[127:0], src_addr [127:0], {24'b0,
  478. * next_header[7:0]}
  479. * UDP case: sort_port[15:0], dest_port[15:0]
  480. * TCP case: sort_port[15:0], dest_port[15:0],
  481. * {header_length[3:0], 6'b0, flags[5:0], window_size[15:0]},
  482. * {16'b0, urgent_ptr[15:0]}, all options except 32-bit
  483. * timestamp.
  484. *
  485. * msdu_number
  486. * Indicates the MSDU number within a MPDU. This value is
  487. * reset to zero at the start of each MPDU. If the number of
  488. * MSDU exceeds 255 this number will wrap using modulo 256.
  489. *
  490. * decap_format
  491. * Indicates the format after decapsulation:
  492. * 0: RAW: No decapsulation
  493. * 1: Native WiFi
  494. * 2: Ethernet 2 (DIX)
  495. * 3: 802.3 (SNAP/LLC)
  496. *
  497. * ipv4_proto
  498. * Set if L2 layer indicates IPv4 protocol.
  499. *
  500. * ipv6_proto
  501. * Set if L2 layer indicates IPv6 protocol.
  502. *
  503. * tcp_proto
  504. * Set if the ipv4_proto or ipv6_proto are set and the IP
  505. * protocol indicates TCP.
  506. *
  507. * udp_proto
  508. * Set if the ipv4_proto or ipv6_proto are set and the IP
  509. * protocol indicates UDP.
  510. *
  511. * ip_frag
  512. * Indicates that either the IP More frag bit is set or IP frag
  513. * number is non-zero. If set indicates that this is a
  514. * fragmented IP packet.
  515. *
  516. * tcp_only_ack
  517. * Set if only the TCP Ack bit is set in the TCP flags and if
  518. * the TCP payload is 0.
  519. *
  520. * sa_idx
  521. * The offset in the address table which matches the MAC source
  522. * address.
  523. *
  524. * reserved_2b
  525. * Reserved: HW should fill with zero. FW should ignore.
  526. */
  527. #define RX_MSDU_END_INFO0_REPORTED_MPDU_LENGTH_MASK 0x00003fff
  528. #define RX_MSDU_END_INFO0_REPORTED_MPDU_LENGTH_LSB 0
  529. #define RX_MSDU_END_INFO0_FIRST_MSDU (1 << 14)
  530. #define RX_MSDU_END_INFO0_LAST_MSDU (1 << 15)
  531. #define RX_MSDU_END_INFO0_PRE_DELIM_ERR (1 << 30)
  532. #define RX_MSDU_END_INFO0_RESERVED_3B (1 << 31)
  533. struct rx_msdu_end_common {
  534. __le16 ip_hdr_cksum;
  535. __le16 tcp_hdr_cksum;
  536. u8 key_id_octet;
  537. u8 classification_filter;
  538. u8 wapi_pn[10];
  539. __le32 info0;
  540. } __packed;
  541. #define RX_MSDU_END_INFO1_TCP_FLAG_MASK 0x000001ff
  542. #define RX_MSDU_END_INFO1_TCP_FLAG_LSB 0
  543. #define RX_MSDU_END_INFO1_L3_HDR_PAD_MASK 0x00001c00
  544. #define RX_MSDU_END_INFO1_L3_HDR_PAD_LSB 10
  545. #define RX_MSDU_END_INFO1_WINDOW_SIZE_MASK 0xffff0000
  546. #define RX_MSDU_END_INFO1_WINDOW_SIZE_LSB 16
  547. #define RX_MSDU_END_INFO1_IRO_ELIGIBLE BIT(9)
  548. #define RX_MSDU_END_INFO2_DA_OFFSET_MASK 0x0000003f
  549. #define RX_MSDU_END_INFO2_DA_OFFSET_LSB 0
  550. #define RX_MSDU_END_INFO2_SA_OFFSET_MASK 0x00000fc0
  551. #define RX_MSDU_END_INFO2_SA_OFFSET_LSB 6
  552. #define RX_MSDU_END_INFO2_TYPE_OFFSET_MASK 0x0003f000
  553. #define RX_MSDU_END_INFO2_TYPE_OFFSET_LSB 12
  554. struct rx_msdu_end_qca99x0 {
  555. __le32 ipv6_crc;
  556. __le32 tcp_seq_no;
  557. __le32 tcp_ack_no;
  558. __le32 info1;
  559. __le32 info2;
  560. } __packed;
  561. struct rx_msdu_end {
  562. struct rx_msdu_end_common common;
  563. union {
  564. struct rx_msdu_end_qca99x0 qca99x0;
  565. } __packed;
  566. } __packed;
  567. /*
  568. *ip_hdr_chksum
  569. * This can include the IP header checksum or the pseudo header
  570. * checksum used by TCP/UDP checksum.
  571. *
  572. *tcp_udp_chksum
  573. * The value of the computed TCP/UDP checksum. A mode bit
  574. * selects whether this checksum is the full checksum or the
  575. * partial checksum which does not include the pseudo header.
  576. *
  577. *key_id_octet
  578. * The key ID octet from the IV. Only valid when first_msdu is
  579. * set.
  580. *
  581. *classification_filter
  582. * Indicates the number classification filter rule
  583. *
  584. *ext_wapi_pn_63_48
  585. * Extension PN (packet number) which is only used by WAPI.
  586. * This corresponds to WAPI PN bits [63:48] (pn6 and pn7). The
  587. * WAPI PN bits [63:0] are in the pn field of the rx_mpdu_start
  588. * descriptor.
  589. *
  590. *ext_wapi_pn_95_64
  591. * Extension PN (packet number) which is only used by WAPI.
  592. * This corresponds to WAPI PN bits [95:64] (pn8, pn9, pn10 and
  593. * pn11).
  594. *
  595. *ext_wapi_pn_127_96
  596. * Extension PN (packet number) which is only used by WAPI.
  597. * This corresponds to WAPI PN bits [127:96] (pn12, pn13, pn14,
  598. * pn15).
  599. *
  600. *reported_mpdu_length
  601. * MPDU length before decapsulation. Only valid when
  602. * first_msdu is set. This field is taken directly from the
  603. * length field of the A-MPDU delimiter or the preamble length
  604. * field for non-A-MPDU frames.
  605. *
  606. *first_msdu
  607. * Indicates the first MSDU of A-MSDU. If both first_msdu and
  608. * last_msdu are set in the MSDU then this is a non-aggregated
  609. * MSDU frame: normal MPDU. Interior MSDU in an A-MSDU shall
  610. * have both first_mpdu and last_mpdu bits set to 0.
  611. *
  612. *last_msdu
  613. * Indicates the last MSDU of the A-MSDU. MPDU end status is
  614. * only valid when last_msdu is set.
  615. *
  616. *reserved_3a
  617. * Reserved: HW should fill with zero. FW should ignore.
  618. *
  619. *pre_delim_err
  620. * Indicates that the first delimiter had a FCS failure. Only
  621. * valid when first_mpdu and first_msdu are set.
  622. *
  623. *reserved_3b
  624. * Reserved: HW should fill with zero. FW should ignore.
  625. */
  626. #define RX_PPDU_START_SIG_RATE_SELECT_OFDM 0
  627. #define RX_PPDU_START_SIG_RATE_SELECT_CCK 1
  628. #define RX_PPDU_START_SIG_RATE_OFDM_48 0
  629. #define RX_PPDU_START_SIG_RATE_OFDM_24 1
  630. #define RX_PPDU_START_SIG_RATE_OFDM_12 2
  631. #define RX_PPDU_START_SIG_RATE_OFDM_6 3
  632. #define RX_PPDU_START_SIG_RATE_OFDM_54 4
  633. #define RX_PPDU_START_SIG_RATE_OFDM_36 5
  634. #define RX_PPDU_START_SIG_RATE_OFDM_18 6
  635. #define RX_PPDU_START_SIG_RATE_OFDM_9 7
  636. #define RX_PPDU_START_SIG_RATE_CCK_LP_11 0
  637. #define RX_PPDU_START_SIG_RATE_CCK_LP_5_5 1
  638. #define RX_PPDU_START_SIG_RATE_CCK_LP_2 2
  639. #define RX_PPDU_START_SIG_RATE_CCK_LP_1 3
  640. #define RX_PPDU_START_SIG_RATE_CCK_SP_11 4
  641. #define RX_PPDU_START_SIG_RATE_CCK_SP_5_5 5
  642. #define RX_PPDU_START_SIG_RATE_CCK_SP_2 6
  643. #define HTT_RX_PPDU_START_PREAMBLE_LEGACY 0x04
  644. #define HTT_RX_PPDU_START_PREAMBLE_HT 0x08
  645. #define HTT_RX_PPDU_START_PREAMBLE_HT_WITH_TXBF 0x09
  646. #define HTT_RX_PPDU_START_PREAMBLE_VHT 0x0C
  647. #define HTT_RX_PPDU_START_PREAMBLE_VHT_WITH_TXBF 0x0D
  648. #define RX_PPDU_START_INFO0_IS_GREENFIELD (1 << 0)
  649. #define RX_PPDU_START_INFO1_L_SIG_RATE_MASK 0x0000000f
  650. #define RX_PPDU_START_INFO1_L_SIG_RATE_LSB 0
  651. #define RX_PPDU_START_INFO1_L_SIG_LENGTH_MASK 0x0001ffe0
  652. #define RX_PPDU_START_INFO1_L_SIG_LENGTH_LSB 5
  653. #define RX_PPDU_START_INFO1_L_SIG_TAIL_MASK 0x00fc0000
  654. #define RX_PPDU_START_INFO1_L_SIG_TAIL_LSB 18
  655. #define RX_PPDU_START_INFO1_PREAMBLE_TYPE_MASK 0xff000000
  656. #define RX_PPDU_START_INFO1_PREAMBLE_TYPE_LSB 24
  657. #define RX_PPDU_START_INFO1_L_SIG_RATE_SELECT (1 << 4)
  658. #define RX_PPDU_START_INFO1_L_SIG_PARITY (1 << 17)
  659. #define RX_PPDU_START_INFO2_HT_SIG_VHT_SIG_A_1_MASK 0x00ffffff
  660. #define RX_PPDU_START_INFO2_HT_SIG_VHT_SIG_A_1_LSB 0
  661. #define RX_PPDU_START_INFO3_HT_SIG_VHT_SIG_A_2_MASK 0x00ffffff
  662. #define RX_PPDU_START_INFO3_HT_SIG_VHT_SIG_A_2_LSB 0
  663. #define RX_PPDU_START_INFO3_TXBF_H_INFO (1 << 24)
  664. #define RX_PPDU_START_INFO4_VHT_SIG_B_MASK 0x1fffffff
  665. #define RX_PPDU_START_INFO4_VHT_SIG_B_LSB 0
  666. #define RX_PPDU_START_INFO5_SERVICE_MASK 0x0000ffff
  667. #define RX_PPDU_START_INFO5_SERVICE_LSB 0
  668. /* No idea what this flag means. It seems to be always set in rate. */
  669. #define RX_PPDU_START_RATE_FLAG BIT(3)
  670. enum rx_ppdu_start_rate {
  671. RX_PPDU_START_RATE_OFDM_48M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_OFDM_48M,
  672. RX_PPDU_START_RATE_OFDM_24M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_OFDM_24M,
  673. RX_PPDU_START_RATE_OFDM_12M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_OFDM_12M,
  674. RX_PPDU_START_RATE_OFDM_6M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_OFDM_6M,
  675. RX_PPDU_START_RATE_OFDM_54M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_OFDM_54M,
  676. RX_PPDU_START_RATE_OFDM_36M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_OFDM_36M,
  677. RX_PPDU_START_RATE_OFDM_18M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_OFDM_18M,
  678. RX_PPDU_START_RATE_OFDM_9M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_OFDM_9M,
  679. RX_PPDU_START_RATE_CCK_LP_11M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_CCK_LP_11M,
  680. RX_PPDU_START_RATE_CCK_LP_5_5M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_CCK_LP_5_5M,
  681. RX_PPDU_START_RATE_CCK_LP_2M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_CCK_LP_2M,
  682. RX_PPDU_START_RATE_CCK_LP_1M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_CCK_LP_1M,
  683. RX_PPDU_START_RATE_CCK_SP_11M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_CCK_SP_11M,
  684. RX_PPDU_START_RATE_CCK_SP_5_5M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_CCK_SP_5_5M,
  685. RX_PPDU_START_RATE_CCK_SP_2M = RX_PPDU_START_RATE_FLAG | ATH10K_HW_RATE_CCK_SP_2M,
  686. };
  687. struct rx_ppdu_start {
  688. struct {
  689. u8 pri20_mhz;
  690. u8 ext20_mhz;
  691. u8 ext40_mhz;
  692. u8 ext80_mhz;
  693. } rssi_chains[4];
  694. u8 rssi_comb;
  695. __le16 rsvd0;
  696. u8 info0; /* %RX_PPDU_START_INFO0_ */
  697. __le32 info1; /* %RX_PPDU_START_INFO1_ */
  698. __le32 info2; /* %RX_PPDU_START_INFO2_ */
  699. __le32 info3; /* %RX_PPDU_START_INFO3_ */
  700. __le32 info4; /* %RX_PPDU_START_INFO4_ */
  701. __le32 info5; /* %RX_PPDU_START_INFO5_ */
  702. } __packed;
  703. /*
  704. * rssi_chain0_pri20
  705. * RSSI of RX PPDU on chain 0 of primary 20 MHz bandwidth.
  706. * Value of 0x80 indicates invalid.
  707. *
  708. * rssi_chain0_sec20
  709. * RSSI of RX PPDU on chain 0 of secondary 20 MHz bandwidth.
  710. * Value of 0x80 indicates invalid.
  711. *
  712. * rssi_chain0_sec40
  713. * RSSI of RX PPDU on chain 0 of secondary 40 MHz bandwidth.
  714. * Value of 0x80 indicates invalid.
  715. *
  716. * rssi_chain0_sec80
  717. * RSSI of RX PPDU on chain 0 of secondary 80 MHz bandwidth.
  718. * Value of 0x80 indicates invalid.
  719. *
  720. * rssi_chain1_pri20
  721. * RSSI of RX PPDU on chain 1 of primary 20 MHz bandwidth.
  722. * Value of 0x80 indicates invalid.
  723. *
  724. * rssi_chain1_sec20
  725. * RSSI of RX PPDU on chain 1 of secondary 20 MHz bandwidth.
  726. * Value of 0x80 indicates invalid.
  727. *
  728. * rssi_chain1_sec40
  729. * RSSI of RX PPDU on chain 1 of secondary 40 MHz bandwidth.
  730. * Value of 0x80 indicates invalid.
  731. *
  732. * rssi_chain1_sec80
  733. * RSSI of RX PPDU on chain 1 of secondary 80 MHz bandwidth.
  734. * Value of 0x80 indicates invalid.
  735. *
  736. * rssi_chain2_pri20
  737. * RSSI of RX PPDU on chain 2 of primary 20 MHz bandwidth.
  738. * Value of 0x80 indicates invalid.
  739. *
  740. * rssi_chain2_sec20
  741. * RSSI of RX PPDU on chain 2 of secondary 20 MHz bandwidth.
  742. * Value of 0x80 indicates invalid.
  743. *
  744. * rssi_chain2_sec40
  745. * RSSI of RX PPDU on chain 2 of secondary 40 MHz bandwidth.
  746. * Value of 0x80 indicates invalid.
  747. *
  748. * rssi_chain2_sec80
  749. * RSSI of RX PPDU on chain 2 of secondary 80 MHz bandwidth.
  750. * Value of 0x80 indicates invalid.
  751. *
  752. * rssi_chain3_pri20
  753. * RSSI of RX PPDU on chain 3 of primary 20 MHz bandwidth.
  754. * Value of 0x80 indicates invalid.
  755. *
  756. * rssi_chain3_sec20
  757. * RSSI of RX PPDU on chain 3 of secondary 20 MHz bandwidth.
  758. * Value of 0x80 indicates invalid.
  759. *
  760. * rssi_chain3_sec40
  761. * RSSI of RX PPDU on chain 3 of secondary 40 MHz bandwidth.
  762. * Value of 0x80 indicates invalid.
  763. *
  764. * rssi_chain3_sec80
  765. * RSSI of RX PPDU on chain 3 of secondary 80 MHz bandwidth.
  766. * Value of 0x80 indicates invalid.
  767. *
  768. * rssi_comb
  769. * The combined RSSI of RX PPDU of all active chains and
  770. * bandwidths. Value of 0x80 indicates invalid.
  771. *
  772. * reserved_4a
  773. * Reserved: HW should fill with 0, FW should ignore.
  774. *
  775. * is_greenfield
  776. * Do we really support this?
  777. *
  778. * reserved_4b
  779. * Reserved: HW should fill with 0, FW should ignore.
  780. *
  781. * l_sig_rate
  782. * If l_sig_rate_select is 0:
  783. * 0x8: OFDM 48 Mbps
  784. * 0x9: OFDM 24 Mbps
  785. * 0xA: OFDM 12 Mbps
  786. * 0xB: OFDM 6 Mbps
  787. * 0xC: OFDM 54 Mbps
  788. * 0xD: OFDM 36 Mbps
  789. * 0xE: OFDM 18 Mbps
  790. * 0xF: OFDM 9 Mbps
  791. * If l_sig_rate_select is 1:
  792. * 0x8: CCK 11 Mbps long preamble
  793. * 0x9: CCK 5.5 Mbps long preamble
  794. * 0xA: CCK 2 Mbps long preamble
  795. * 0xB: CCK 1 Mbps long preamble
  796. * 0xC: CCK 11 Mbps short preamble
  797. * 0xD: CCK 5.5 Mbps short preamble
  798. * 0xE: CCK 2 Mbps short preamble
  799. *
  800. * l_sig_rate_select
  801. * Legacy signal rate select. If set then l_sig_rate indicates
  802. * CCK rates. If clear then l_sig_rate indicates OFDM rates.
  803. *
  804. * l_sig_length
  805. * Length of legacy frame in octets.
  806. *
  807. * l_sig_parity
  808. * Odd parity over l_sig_rate and l_sig_length
  809. *
  810. * l_sig_tail
  811. * Tail bits for Viterbi decoder
  812. *
  813. * preamble_type
  814. * Indicates the type of preamble ahead:
  815. * 0x4: Legacy (OFDM/CCK)
  816. * 0x8: HT
  817. * 0x9: HT with TxBF
  818. * 0xC: VHT
  819. * 0xD: VHT with TxBF
  820. * 0x80 - 0xFF: Reserved for special baseband data types such
  821. * as radar and spectral scan.
  822. *
  823. * ht_sig_vht_sig_a_1
  824. * If preamble_type == 0x8 or 0x9
  825. * HT-SIG (first 24 bits)
  826. * If preamble_type == 0xC or 0xD
  827. * VHT-SIG A (first 24 bits)
  828. * Else
  829. * Reserved
  830. *
  831. * reserved_6
  832. * Reserved: HW should fill with 0, FW should ignore.
  833. *
  834. * ht_sig_vht_sig_a_2
  835. * If preamble_type == 0x8 or 0x9
  836. * HT-SIG (last 24 bits)
  837. * If preamble_type == 0xC or 0xD
  838. * VHT-SIG A (last 24 bits)
  839. * Else
  840. * Reserved
  841. *
  842. * txbf_h_info
  843. * Indicates that the packet data carries H information which
  844. * is used for TxBF debug.
  845. *
  846. * reserved_7
  847. * Reserved: HW should fill with 0, FW should ignore.
  848. *
  849. * vht_sig_b
  850. * WiFi 1.0 and WiFi 2.0 will likely have this field to be all
  851. * 0s since the BB does not plan on decoding VHT SIG-B.
  852. *
  853. * reserved_8
  854. * Reserved: HW should fill with 0, FW should ignore.
  855. *
  856. * service
  857. * Service field from BB for OFDM, HT and VHT packets. CCK
  858. * packets will have service field of 0.
  859. *
  860. * reserved_9
  861. * Reserved: HW should fill with 0, FW should ignore.
  862. */
  863. #define RX_PPDU_END_FLAGS_PHY_ERR (1 << 0)
  864. #define RX_PPDU_END_FLAGS_RX_LOCATION (1 << 1)
  865. #define RX_PPDU_END_FLAGS_TXBF_H_INFO (1 << 2)
  866. #define RX_PPDU_END_INFO0_RX_ANTENNA_MASK 0x00ffffff
  867. #define RX_PPDU_END_INFO0_RX_ANTENNA_LSB 0
  868. #define RX_PPDU_END_INFO0_FLAGS_TX_HT_VHT_ACK (1 << 24)
  869. #define RX_PPDU_END_INFO0_BB_CAPTURED_CHANNEL (1 << 25)
  870. #define RX_PPDU_END_INFO1_PEER_IDX_MASK 0x1ffc
  871. #define RX_PPDU_END_INFO1_PEER_IDX_LSB 2
  872. #define RX_PPDU_END_INFO1_BB_DATA BIT(0)
  873. #define RX_PPDU_END_INFO1_PEER_IDX_VALID BIT(1)
  874. #define RX_PPDU_END_INFO1_PPDU_DONE BIT(15)
  875. struct rx_ppdu_end_common {
  876. __le32 evm_p0;
  877. __le32 evm_p1;
  878. __le32 evm_p2;
  879. __le32 evm_p3;
  880. __le32 evm_p4;
  881. __le32 evm_p5;
  882. __le32 evm_p6;
  883. __le32 evm_p7;
  884. __le32 evm_p8;
  885. __le32 evm_p9;
  886. __le32 evm_p10;
  887. __le32 evm_p11;
  888. __le32 evm_p12;
  889. __le32 evm_p13;
  890. __le32 evm_p14;
  891. __le32 evm_p15;
  892. __le32 tsf_timestamp;
  893. __le32 wb_timestamp;
  894. } __packed;
  895. struct rx_ppdu_end_qca988x {
  896. u8 locationing_timestamp;
  897. u8 phy_err_code;
  898. __le16 flags; /* %RX_PPDU_END_FLAGS_ */
  899. __le32 info0; /* %RX_PPDU_END_INFO0_ */
  900. __le16 bb_length;
  901. __le16 info1; /* %RX_PPDU_END_INFO1_ */
  902. } __packed;
  903. #define RX_PPDU_END_RTT_CORRELATION_VALUE_MASK 0x00ffffff
  904. #define RX_PPDU_END_RTT_CORRELATION_VALUE_LSB 0
  905. #define RX_PPDU_END_RTT_UNUSED_MASK 0x7f000000
  906. #define RX_PPDU_END_RTT_UNUSED_LSB 24
  907. #define RX_PPDU_END_RTT_NORMAL_MODE BIT(31)
  908. struct rx_ppdu_end_qca6174 {
  909. u8 locationing_timestamp;
  910. u8 phy_err_code;
  911. __le16 flags; /* %RX_PPDU_END_FLAGS_ */
  912. __le32 info0; /* %RX_PPDU_END_INFO0_ */
  913. __le32 rtt; /* %RX_PPDU_END_RTT_ */
  914. __le16 bb_length;
  915. __le16 info1; /* %RX_PPDU_END_INFO1_ */
  916. } __packed;
  917. #define RX_PKT_END_INFO0_RX_SUCCESS BIT(0)
  918. #define RX_PKT_END_INFO0_ERR_TX_INTERRUPT_RX BIT(3)
  919. #define RX_PKT_END_INFO0_ERR_OFDM_POWER_DROP BIT(4)
  920. #define RX_PKT_END_INFO0_ERR_OFDM_RESTART BIT(5)
  921. #define RX_PKT_END_INFO0_ERR_CCK_POWER_DROP BIT(6)
  922. #define RX_PKT_END_INFO0_ERR_CCK_RESTART BIT(7)
  923. #define RX_LOCATION_INFO_RTT_CORR_VAL_MASK 0x0001ffff
  924. #define RX_LOCATION_INFO_RTT_CORR_VAL_LSB 0
  925. #define RX_LOCATION_INFO_FAC_STATUS_MASK 0x000c0000
  926. #define RX_LOCATION_INFO_FAC_STATUS_LSB 18
  927. #define RX_LOCATION_INFO_PKT_BW_MASK 0x00700000
  928. #define RX_LOCATION_INFO_PKT_BW_LSB 20
  929. #define RX_LOCATION_INFO_RTT_TX_FRAME_PHASE_MASK 0x01800000
  930. #define RX_LOCATION_INFO_RTT_TX_FRAME_PHASE_LSB 23
  931. #define RX_LOCATION_INFO_CIR_STATUS BIT(17)
  932. #define RX_LOCATION_INFO_RTT_MAC_PHY_PHASE BIT(25)
  933. #define RX_LOCATION_INFO_RTT_TX_DATA_START_X BIT(26)
  934. #define RX_LOCATION_INFO_HW_IFFT_MODE BIT(30)
  935. #define RX_LOCATION_INFO_RX_LOCATION_VALID BIT(31)
  936. struct rx_pkt_end {
  937. __le32 info0; /* %RX_PKT_END_INFO0_ */
  938. __le32 phy_timestamp_1;
  939. __le32 phy_timestamp_2;
  940. __le32 rx_location_info; /* %RX_LOCATION_INFO_ */
  941. } __packed;
  942. enum rx_phy_ppdu_end_info0 {
  943. RX_PHY_PPDU_END_INFO0_ERR_RADAR = BIT(2),
  944. RX_PHY_PPDU_END_INFO0_ERR_RX_ABORT = BIT(3),
  945. RX_PHY_PPDU_END_INFO0_ERR_RX_NAP = BIT(4),
  946. RX_PHY_PPDU_END_INFO0_ERR_OFDM_TIMING = BIT(5),
  947. RX_PHY_PPDU_END_INFO0_ERR_OFDM_PARITY = BIT(6),
  948. RX_PHY_PPDU_END_INFO0_ERR_OFDM_RATE = BIT(7),
  949. RX_PHY_PPDU_END_INFO0_ERR_OFDM_LENGTH = BIT(8),
  950. RX_PHY_PPDU_END_INFO0_ERR_OFDM_RESTART = BIT(9),
  951. RX_PHY_PPDU_END_INFO0_ERR_OFDM_SERVICE = BIT(10),
  952. RX_PHY_PPDU_END_INFO0_ERR_OFDM_POWER_DROP = BIT(11),
  953. RX_PHY_PPDU_END_INFO0_ERR_CCK_BLOCKER = BIT(12),
  954. RX_PHY_PPDU_END_INFO0_ERR_CCK_TIMING = BIT(13),
  955. RX_PHY_PPDU_END_INFO0_ERR_CCK_HEADER_CRC = BIT(14),
  956. RX_PHY_PPDU_END_INFO0_ERR_CCK_RATE = BIT(15),
  957. RX_PHY_PPDU_END_INFO0_ERR_CCK_LENGTH = BIT(16),
  958. RX_PHY_PPDU_END_INFO0_ERR_CCK_RESTART = BIT(17),
  959. RX_PHY_PPDU_END_INFO0_ERR_CCK_SERVICE = BIT(18),
  960. RX_PHY_PPDU_END_INFO0_ERR_CCK_POWER_DROP = BIT(19),
  961. RX_PHY_PPDU_END_INFO0_ERR_HT_CRC = BIT(20),
  962. RX_PHY_PPDU_END_INFO0_ERR_HT_LENGTH = BIT(21),
  963. RX_PHY_PPDU_END_INFO0_ERR_HT_RATE = BIT(22),
  964. RX_PHY_PPDU_END_INFO0_ERR_HT_ZLF = BIT(23),
  965. RX_PHY_PPDU_END_INFO0_ERR_FALSE_RADAR_EXT = BIT(24),
  966. RX_PHY_PPDU_END_INFO0_ERR_GREEN_FIELD = BIT(25),
  967. RX_PHY_PPDU_END_INFO0_ERR_SPECTRAL_SCAN = BIT(26),
  968. RX_PHY_PPDU_END_INFO0_ERR_RX_DYN_BW = BIT(27),
  969. RX_PHY_PPDU_END_INFO0_ERR_LEG_HT_MISMATCH = BIT(28),
  970. RX_PHY_PPDU_END_INFO0_ERR_VHT_CRC = BIT(29),
  971. RX_PHY_PPDU_END_INFO0_ERR_VHT_SIGA = BIT(30),
  972. RX_PHY_PPDU_END_INFO0_ERR_VHT_LSIG = BIT(31),
  973. };
  974. enum rx_phy_ppdu_end_info1 {
  975. RX_PHY_PPDU_END_INFO1_ERR_VHT_NDP = BIT(0),
  976. RX_PHY_PPDU_END_INFO1_ERR_VHT_NSYM = BIT(1),
  977. RX_PHY_PPDU_END_INFO1_ERR_VHT_RX_EXT_SYM = BIT(2),
  978. RX_PHY_PPDU_END_INFO1_ERR_VHT_RX_SKIP_ID0 = BIT(3),
  979. RX_PHY_PPDU_END_INFO1_ERR_VHT_RX_SKIP_ID1_62 = BIT(4),
  980. RX_PHY_PPDU_END_INFO1_ERR_VHT_RX_SKIP_ID63 = BIT(5),
  981. RX_PHY_PPDU_END_INFO1_ERR_OFDM_LDPC_DECODER = BIT(6),
  982. RX_PHY_PPDU_END_INFO1_ERR_DEFER_NAP = BIT(7),
  983. RX_PHY_PPDU_END_INFO1_ERR_FDOMAIN_TIMEOUT = BIT(8),
  984. RX_PHY_PPDU_END_INFO1_ERR_LSIG_REL_CHECK = BIT(9),
  985. RX_PHY_PPDU_END_INFO1_ERR_BT_COLLISION = BIT(10),
  986. RX_PHY_PPDU_END_INFO1_ERR_MU_FEEDBACK = BIT(11),
  987. RX_PHY_PPDU_END_INFO1_ERR_TX_INTERRUPT_RX = BIT(12),
  988. RX_PHY_PPDU_END_INFO1_ERR_RX_CBF = BIT(13),
  989. };
  990. struct rx_phy_ppdu_end {
  991. __le32 info0; /* %RX_PHY_PPDU_END_INFO0_ */
  992. __le32 info1; /* %RX_PHY_PPDU_END_INFO1_ */
  993. } __packed;
  994. #define RX_PPDU_END_RX_TIMING_OFFSET_MASK 0x00000fff
  995. #define RX_PPDU_END_RX_TIMING_OFFSET_LSB 0
  996. #define RX_PPDU_END_RX_INFO_RX_ANTENNA_MASK 0x00ffffff
  997. #define RX_PPDU_END_RX_INFO_RX_ANTENNA_LSB 0
  998. #define RX_PPDU_END_RX_INFO_TX_HT_VHT_ACK BIT(24)
  999. #define RX_PPDU_END_RX_INFO_RX_PKT_END_VALID BIT(25)
  1000. #define RX_PPDU_END_RX_INFO_RX_PHY_PPDU_END_VALID BIT(26)
  1001. #define RX_PPDU_END_RX_INFO_RX_TIMING_OFFSET_VALID BIT(27)
  1002. #define RX_PPDU_END_RX_INFO_BB_CAPTURED_CHANNEL BIT(28)
  1003. #define RX_PPDU_END_RX_INFO_UNSUPPORTED_MU_NC BIT(29)
  1004. #define RX_PPDU_END_RX_INFO_OTP_TXBF_DISABLE BIT(30)
  1005. struct rx_ppdu_end_qca99x0 {
  1006. struct rx_pkt_end rx_pkt_end;
  1007. struct rx_phy_ppdu_end rx_phy_ppdu_end;
  1008. __le32 rx_timing_offset; /* %RX_PPDU_END_RX_TIMING_OFFSET_ */
  1009. __le32 rx_info; /* %RX_PPDU_END_RX_INFO_ */
  1010. __le16 bb_length;
  1011. __le16 info1; /* %RX_PPDU_END_INFO1_ */
  1012. } __packed;
  1013. struct rx_ppdu_end {
  1014. struct rx_ppdu_end_common common;
  1015. union {
  1016. struct rx_ppdu_end_qca988x qca988x;
  1017. struct rx_ppdu_end_qca6174 qca6174;
  1018. struct rx_ppdu_end_qca99x0 qca99x0;
  1019. } __packed;
  1020. } __packed;
  1021. /*
  1022. * evm_p0
  1023. * EVM for pilot 0. Contain EVM for streams: 0, 1, 2 and 3.
  1024. *
  1025. * evm_p1
  1026. * EVM for pilot 1. Contain EVM for streams: 0, 1, 2 and 3.
  1027. *
  1028. * evm_p2
  1029. * EVM for pilot 2. Contain EVM for streams: 0, 1, 2 and 3.
  1030. *
  1031. * evm_p3
  1032. * EVM for pilot 3. Contain EVM for streams: 0, 1, 2 and 3.
  1033. *
  1034. * evm_p4
  1035. * EVM for pilot 4. Contain EVM for streams: 0, 1, 2 and 3.
  1036. *
  1037. * evm_p5
  1038. * EVM for pilot 5. Contain EVM for streams: 0, 1, 2 and 3.
  1039. *
  1040. * evm_p6
  1041. * EVM for pilot 6. Contain EVM for streams: 0, 1, 2 and 3.
  1042. *
  1043. * evm_p7
  1044. * EVM for pilot 7. Contain EVM for streams: 0, 1, 2 and 3.
  1045. *
  1046. * evm_p8
  1047. * EVM for pilot 8. Contain EVM for streams: 0, 1, 2 and 3.
  1048. *
  1049. * evm_p9
  1050. * EVM for pilot 9. Contain EVM for streams: 0, 1, 2 and 3.
  1051. *
  1052. * evm_p10
  1053. * EVM for pilot 10. Contain EVM for streams: 0, 1, 2 and 3.
  1054. *
  1055. * evm_p11
  1056. * EVM for pilot 11. Contain EVM for streams: 0, 1, 2 and 3.
  1057. *
  1058. * evm_p12
  1059. * EVM for pilot 12. Contain EVM for streams: 0, 1, 2 and 3.
  1060. *
  1061. * evm_p13
  1062. * EVM for pilot 13. Contain EVM for streams: 0, 1, 2 and 3.
  1063. *
  1064. * evm_p14
  1065. * EVM for pilot 14. Contain EVM for streams: 0, 1, 2 and 3.
  1066. *
  1067. * evm_p15
  1068. * EVM for pilot 15. Contain EVM for streams: 0, 1, 2 and 3.
  1069. *
  1070. * tsf_timestamp
  1071. * Receive TSF timestamp sampled on the rising edge of
  1072. * rx_clear. For PHY errors this may be the current TSF when
  1073. * phy_error is asserted if the rx_clear does not assert before
  1074. * the end of the PHY error.
  1075. *
  1076. * wb_timestamp
  1077. * WLAN/BT timestamp is a 1 usec resolution timestamp which
  1078. * does not get updated based on receive beacon like TSF. The
  1079. * same rules for capturing tsf_timestamp are used to capture
  1080. * the wb_timestamp.
  1081. *
  1082. * locationing_timestamp
  1083. * Timestamp used for locationing. This timestamp is used to
  1084. * indicate fractions of usec. For example if the MAC clock is
  1085. * running at 80 MHz, the timestamp will increment every 12.5
  1086. * nsec. The value starts at 0 and increments to 79 and
  1087. * returns to 0 and repeats. This information is valid for
  1088. * every PPDU. This information can be used in conjunction
  1089. * with wb_timestamp to capture large delta times.
  1090. *
  1091. * phy_err_code
  1092. * See the 1.10.8.1.2 for the list of the PHY error codes.
  1093. *
  1094. * phy_err
  1095. * Indicates a PHY error was detected for this PPDU.
  1096. *
  1097. * rx_location
  1098. * Indicates that location information was requested.
  1099. *
  1100. * txbf_h_info
  1101. * Indicates that the packet data carries H information which
  1102. * is used for TxBF debug.
  1103. *
  1104. * reserved_18
  1105. * Reserved: HW should fill with 0, FW should ignore.
  1106. *
  1107. * rx_antenna
  1108. * Receive antenna value
  1109. *
  1110. * tx_ht_vht_ack
  1111. * Indicates that a HT or VHT Ack/BA frame was transmitted in
  1112. * response to this receive packet.
  1113. *
  1114. * bb_captured_channel
  1115. * Indicates that the BB has captured a channel dump. FW can
  1116. * then read the channel dump memory. This may indicate that
  1117. * the channel was captured either based on PCU setting the
  1118. * capture_channel bit BB descriptor or FW setting the
  1119. * capture_channel mode bit.
  1120. *
  1121. * reserved_19
  1122. * Reserved: HW should fill with 0, FW should ignore.
  1123. *
  1124. * bb_length
  1125. * Indicates the number of bytes of baseband information for
  1126. * PPDUs where the BB descriptor preamble type is 0x80 to 0xFF
  1127. * which indicates that this is not a normal PPDU but rather
  1128. * contains baseband debug information.
  1129. *
  1130. * reserved_20
  1131. * Reserved: HW should fill with 0, FW should ignore.
  1132. *
  1133. * ppdu_done
  1134. * PPDU end status is only valid when ppdu_done bit is set.
  1135. * Every time HW sets this bit in memory FW/SW must clear this
  1136. * bit in memory. FW will initialize all the ppdu_done dword
  1137. * to 0.
  1138. */
  1139. #define FW_RX_DESC_INFO0_DISCARD (1 << 0)
  1140. #define FW_RX_DESC_INFO0_FORWARD (1 << 1)
  1141. #define FW_RX_DESC_INFO0_INSPECT (1 << 5)
  1142. #define FW_RX_DESC_INFO0_EXT_MASK 0xC0
  1143. #define FW_RX_DESC_INFO0_EXT_LSB 6
  1144. struct fw_rx_desc_base {
  1145. u8 info0;
  1146. } __packed;
  1147. #endif /* _RX_DESC_H_ */