rx_desc.h 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278
  1. /*
  2. * Copyright (c) 2005-2011 Atheros Communications Inc.
  3. * Copyright (c) 2011-2017 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. u8 ring4_more_count;
  209. u8 ring5_more_count;
  210. u8 ring6_more_count;
  211. u8 ring7_more_count;
  212. } __packed;
  213. /*
  214. * ring0_more_count
  215. * Indicates the number of more buffers associated with RX DMA
  216. * ring 0. Field is filled in by the RX_DMA.
  217. *
  218. * ring1_more_count
  219. * Indicates the number of more buffers associated with RX DMA
  220. * ring 1. Field is filled in by the RX_DMA.
  221. *
  222. * ring2_more_count
  223. * Indicates the number of more buffers associated with RX DMA
  224. * ring 2. Field is filled in by the RX_DMA.
  225. *
  226. * ring3_more_count
  227. * Indicates the number of more buffers associated with RX DMA
  228. * ring 3. Field is filled in by the RX_DMA.
  229. */
  230. enum htt_rx_mpdu_encrypt_type {
  231. HTT_RX_MPDU_ENCRYPT_WEP40 = 0,
  232. HTT_RX_MPDU_ENCRYPT_WEP104 = 1,
  233. HTT_RX_MPDU_ENCRYPT_TKIP_WITHOUT_MIC = 2,
  234. HTT_RX_MPDU_ENCRYPT_WEP128 = 3,
  235. HTT_RX_MPDU_ENCRYPT_TKIP_WPA = 4,
  236. HTT_RX_MPDU_ENCRYPT_WAPI = 5,
  237. HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2 = 6,
  238. HTT_RX_MPDU_ENCRYPT_NONE = 7,
  239. HTT_RX_MPDU_ENCRYPT_AES_CCM256_WPA2 = 8,
  240. HTT_RX_MPDU_ENCRYPT_AES_GCMP_WPA2 = 9,
  241. HTT_RX_MPDU_ENCRYPT_AES_GCMP256_WPA2 = 10,
  242. };
  243. #define RX_MPDU_START_INFO0_PEER_IDX_MASK 0x000007ff
  244. #define RX_MPDU_START_INFO0_PEER_IDX_LSB 0
  245. #define RX_MPDU_START_INFO0_SEQ_NUM_MASK 0x0fff0000
  246. #define RX_MPDU_START_INFO0_SEQ_NUM_LSB 16
  247. #define RX_MPDU_START_INFO0_ENCRYPT_TYPE_MASK 0xf0000000
  248. #define RX_MPDU_START_INFO0_ENCRYPT_TYPE_LSB 28
  249. #define RX_MPDU_START_INFO0_FROM_DS (1 << 11)
  250. #define RX_MPDU_START_INFO0_TO_DS (1 << 12)
  251. #define RX_MPDU_START_INFO0_ENCRYPTED (1 << 13)
  252. #define RX_MPDU_START_INFO0_RETRY (1 << 14)
  253. #define RX_MPDU_START_INFO0_TXBF_H_INFO (1 << 15)
  254. #define RX_MPDU_START_INFO1_TID_MASK 0xf0000000
  255. #define RX_MPDU_START_INFO1_TID_LSB 28
  256. #define RX_MPDU_START_INFO1_DIRECTED (1 << 16)
  257. struct rx_mpdu_start {
  258. __le32 info0;
  259. union {
  260. struct {
  261. __le32 pn31_0;
  262. __le32 info1; /* %RX_MPDU_START_INFO1_ */
  263. } __packed;
  264. struct {
  265. u8 pn[6];
  266. } __packed;
  267. } __packed;
  268. } __packed;
  269. /*
  270. * peer_idx
  271. * The index of the address search table which associated with
  272. * the peer table entry corresponding to this MPDU. Only valid
  273. * when first_msdu is set.
  274. *
  275. * fr_ds
  276. * Set if the from DS bit is set in the frame control. Only
  277. * valid when first_msdu is set.
  278. *
  279. * to_ds
  280. * Set if the to DS bit is set in the frame control. Only
  281. * valid when first_msdu is set.
  282. *
  283. * encrypted
  284. * Protected bit from the frame control. Only valid when
  285. * first_msdu is set.
  286. *
  287. * retry
  288. * Retry bit from the frame control. Only valid when
  289. * first_msdu is set.
  290. *
  291. * txbf_h_info
  292. * The MPDU data will contain H information. Primarily used
  293. * for debug.
  294. *
  295. * seq_num
  296. * The sequence number from the 802.11 header. Only valid when
  297. * first_msdu is set.
  298. *
  299. * encrypt_type
  300. * Indicates type of decrypt cipher used (as defined in the
  301. * peer table)
  302. * 0: WEP40
  303. * 1: WEP104
  304. * 2: TKIP without MIC
  305. * 3: WEP128
  306. * 4: TKIP (WPA)
  307. * 5: WAPI
  308. * 6: AES-CCM (WPA2)
  309. * 7: No cipher
  310. * Only valid when first_msdu_is set
  311. *
  312. * pn_31_0
  313. * Bits [31:0] of the PN number extracted from the IV field
  314. * WEP: IV = {key_id_octet, pn2, pn1, pn0}. Only pn[23:0] is
  315. * valid.
  316. * TKIP: IV = {pn5, pn4, pn3, pn2, key_id_octet, pn0,
  317. * WEPSeed[1], pn1}. Only pn[47:0] is valid.
  318. * AES-CCM: IV = {pn5, pn4, pn3, pn2, key_id_octet, 0x0, pn1,
  319. * pn0}. Only pn[47:0] is valid.
  320. * WAPI: IV = {key_id_octet, 0x0, pn15, pn14, pn13, pn12, pn11,
  321. * pn10, pn9, pn8, pn7, pn6, pn5, pn4, pn3, pn2, pn1, pn0}.
  322. * The ext_wapi_pn[127:48] in the rx_msdu_misc descriptor and
  323. * pn[47:0] are valid.
  324. * Only valid when first_msdu is set.
  325. *
  326. * pn_47_32
  327. * Bits [47:32] of the PN number. See description for
  328. * pn_31_0. The remaining PN fields are in the rx_msdu_end
  329. * descriptor
  330. *
  331. * pn
  332. * Use this field to access the pn without worrying about
  333. * byte-order and bitmasking/bitshifting.
  334. *
  335. * directed
  336. * See definition in RX attention descriptor
  337. *
  338. * reserved_2
  339. * Reserved: HW should fill with zero. FW should ignore.
  340. *
  341. * tid
  342. * The TID field in the QoS control field
  343. */
  344. #define RX_MPDU_END_INFO0_RESERVED_0_MASK 0x00001fff
  345. #define RX_MPDU_END_INFO0_RESERVED_0_LSB 0
  346. #define RX_MPDU_END_INFO0_POST_DELIM_CNT_MASK 0x0fff0000
  347. #define RX_MPDU_END_INFO0_POST_DELIM_CNT_LSB 16
  348. #define RX_MPDU_END_INFO0_OVERFLOW_ERR (1 << 13)
  349. #define RX_MPDU_END_INFO0_LAST_MPDU (1 << 14)
  350. #define RX_MPDU_END_INFO0_POST_DELIM_ERR (1 << 15)
  351. #define RX_MPDU_END_INFO0_MPDU_LENGTH_ERR (1 << 28)
  352. #define RX_MPDU_END_INFO0_TKIP_MIC_ERR (1 << 29)
  353. #define RX_MPDU_END_INFO0_DECRYPT_ERR (1 << 30)
  354. #define RX_MPDU_END_INFO0_FCS_ERR (1 << 31)
  355. struct rx_mpdu_end {
  356. __le32 info0;
  357. } __packed;
  358. /*
  359. * reserved_0
  360. * Reserved
  361. *
  362. * overflow_err
  363. * PCU Receive FIFO does not have enough space to store the
  364. * full receive packet. Enough space is reserved in the
  365. * receive FIFO for the status is written. This MPDU remaining
  366. * packets in the PPDU will be filtered and no Ack response
  367. * will be transmitted.
  368. *
  369. * last_mpdu
  370. * Indicates that this is the last MPDU of a PPDU.
  371. *
  372. * post_delim_err
  373. * Indicates that a delimiter FCS error occurred after this
  374. * MPDU before the next MPDU. Only valid when last_msdu is
  375. * set.
  376. *
  377. * post_delim_cnt
  378. * Count of the delimiters after this MPDU. This requires the
  379. * last MPDU to be held until all the EOF descriptors have been
  380. * received. This may be inefficient in the future when
  381. * ML-MIMO is used. Only valid when last_mpdu is set.
  382. *
  383. * mpdu_length_err
  384. * See definition in RX attention descriptor
  385. *
  386. * tkip_mic_err
  387. * See definition in RX attention descriptor
  388. *
  389. * decrypt_err
  390. * See definition in RX attention descriptor
  391. *
  392. * fcs_err
  393. * See definition in RX attention descriptor
  394. */
  395. #define RX_MSDU_START_INFO0_MSDU_LENGTH_MASK 0x00003fff
  396. #define RX_MSDU_START_INFO0_MSDU_LENGTH_LSB 0
  397. #define RX_MSDU_START_INFO0_IP_OFFSET_MASK 0x000fc000
  398. #define RX_MSDU_START_INFO0_IP_OFFSET_LSB 14
  399. #define RX_MSDU_START_INFO0_RING_MASK_MASK 0x00f00000
  400. #define RX_MSDU_START_INFO0_RING_MASK_LSB 20
  401. #define RX_MSDU_START_INFO0_TCP_UDP_OFFSET_MASK 0x7f000000
  402. #define RX_MSDU_START_INFO0_TCP_UDP_OFFSET_LSB 24
  403. #define RX_MSDU_START_INFO1_MSDU_NUMBER_MASK 0x000000ff
  404. #define RX_MSDU_START_INFO1_MSDU_NUMBER_LSB 0
  405. #define RX_MSDU_START_INFO1_DECAP_FORMAT_MASK 0x00000300
  406. #define RX_MSDU_START_INFO1_DECAP_FORMAT_LSB 8
  407. #define RX_MSDU_START_INFO1_SA_IDX_MASK 0x07ff0000
  408. #define RX_MSDU_START_INFO1_SA_IDX_LSB 16
  409. #define RX_MSDU_START_INFO1_IPV4_PROTO (1 << 10)
  410. #define RX_MSDU_START_INFO1_IPV6_PROTO (1 << 11)
  411. #define RX_MSDU_START_INFO1_TCP_PROTO (1 << 12)
  412. #define RX_MSDU_START_INFO1_UDP_PROTO (1 << 13)
  413. #define RX_MSDU_START_INFO1_IP_FRAG (1 << 14)
  414. #define RX_MSDU_START_INFO1_TCP_ONLY_ACK (1 << 15)
  415. #define RX_MSDU_START_INFO2_DA_IDX_MASK 0x000007ff
  416. #define RX_MSDU_START_INFO2_DA_IDX_LSB 0
  417. #define RX_MSDU_START_INFO2_IP_PROTO_FIELD_MASK 0x00ff0000
  418. #define RX_MSDU_START_INFO2_IP_PROTO_FIELD_LSB 16
  419. #define RX_MSDU_START_INFO2_DA_BCAST_MCAST BIT(11)
  420. /* The decapped header (rx_hdr_status) contains the following:
  421. * a) 802.11 header
  422. * [padding to 4 bytes]
  423. * b) HW crypto parameter
  424. * - 0 bytes for no security
  425. * - 4 bytes for WEP
  426. * - 8 bytes for TKIP, AES
  427. * [padding to 4 bytes]
  428. * c) A-MSDU subframe header (14 bytes) if appliable
  429. * d) LLC/SNAP (RFC1042, 8 bytes)
  430. *
  431. * In case of A-MSDU only first frame in sequence contains (a) and (b).
  432. */
  433. enum rx_msdu_decap_format {
  434. RX_MSDU_DECAP_RAW = 0,
  435. /* Note: QoS frames are reported as non-QoS. The rx_hdr_status in
  436. * htt_rx_desc contains the original decapped 802.11 header.
  437. */
  438. RX_MSDU_DECAP_NATIVE_WIFI = 1,
  439. /* Payload contains an ethernet header (struct ethhdr). */
  440. RX_MSDU_DECAP_ETHERNET2_DIX = 2,
  441. /* Payload contains two 48-bit addresses and 2-byte length (14 bytes
  442. * total), followed by an RFC1042 header (8 bytes).
  443. */
  444. RX_MSDU_DECAP_8023_SNAP_LLC = 3
  445. };
  446. struct rx_msdu_start_common {
  447. __le32 info0; /* %RX_MSDU_START_INFO0_ */
  448. __le32 flow_id_crc;
  449. __le32 info1; /* %RX_MSDU_START_INFO1_ */
  450. } __packed;
  451. struct rx_msdu_start_qca99x0 {
  452. __le32 info2; /* %RX_MSDU_START_INFO2_ */
  453. } __packed;
  454. struct rx_msdu_start_wcn3990 {
  455. __le32 info2; /* %RX_MSDU_START_INFO2_ */
  456. __le32 info3; /* %RX_MSDU_START_INFO3_ */
  457. } __packed;
  458. struct rx_msdu_start {
  459. struct rx_msdu_start_common common;
  460. union {
  461. struct rx_msdu_start_qca99x0 qca99x0;
  462. struct rx_msdu_start_wcn3990 wcn3990;
  463. } __packed;
  464. } __packed;
  465. /*
  466. * msdu_length
  467. * MSDU length in bytes after decapsulation. This field is
  468. * still valid for MPDU frames without A-MSDU. It still
  469. * represents MSDU length after decapsulation
  470. *
  471. * ip_offset
  472. * Indicates the IP offset in bytes from the start of the
  473. * packet after decapsulation. Only valid if ipv4_proto or
  474. * ipv6_proto is set.
  475. *
  476. * ring_mask
  477. * Indicates the destination RX rings for this MSDU.
  478. *
  479. * tcp_udp_offset
  480. * Indicates the offset in bytes to the start of TCP or UDP
  481. * header from the start of the IP header after decapsulation.
  482. * Only valid if tcp_prot or udp_prot is set. The value 0
  483. * indicates that the offset is longer than 127 bytes.
  484. *
  485. * reserved_0c
  486. * Reserved: HW should fill with zero. FW should ignore.
  487. *
  488. * flow_id_crc
  489. * The flow_id_crc runs CRC32 on the following information:
  490. * IPv4 option: dest_addr[31:0], src_addr [31:0], {24'b0,
  491. * protocol[7:0]}.
  492. * IPv6 option: dest_addr[127:0], src_addr [127:0], {24'b0,
  493. * next_header[7:0]}
  494. * UDP case: sort_port[15:0], dest_port[15:0]
  495. * TCP case: sort_port[15:0], dest_port[15:0],
  496. * {header_length[3:0], 6'b0, flags[5:0], window_size[15:0]},
  497. * {16'b0, urgent_ptr[15:0]}, all options except 32-bit
  498. * timestamp.
  499. *
  500. * msdu_number
  501. * Indicates the MSDU number within a MPDU. This value is
  502. * reset to zero at the start of each MPDU. If the number of
  503. * MSDU exceeds 255 this number will wrap using modulo 256.
  504. *
  505. * decap_format
  506. * Indicates the format after decapsulation:
  507. * 0: RAW: No decapsulation
  508. * 1: Native WiFi
  509. * 2: Ethernet 2 (DIX)
  510. * 3: 802.3 (SNAP/LLC)
  511. *
  512. * ipv4_proto
  513. * Set if L2 layer indicates IPv4 protocol.
  514. *
  515. * ipv6_proto
  516. * Set if L2 layer indicates IPv6 protocol.
  517. *
  518. * tcp_proto
  519. * Set if the ipv4_proto or ipv6_proto are set and the IP
  520. * protocol indicates TCP.
  521. *
  522. * udp_proto
  523. * Set if the ipv4_proto or ipv6_proto are set and the IP
  524. * protocol indicates UDP.
  525. *
  526. * ip_frag
  527. * Indicates that either the IP More frag bit is set or IP frag
  528. * number is non-zero. If set indicates that this is a
  529. * fragmented IP packet.
  530. *
  531. * tcp_only_ack
  532. * Set if only the TCP Ack bit is set in the TCP flags and if
  533. * the TCP payload is 0.
  534. *
  535. * sa_idx
  536. * The offset in the address table which matches the MAC source
  537. * address.
  538. *
  539. * reserved_2b
  540. * Reserved: HW should fill with zero. FW should ignore.
  541. */
  542. #define RX_MSDU_END_INFO0_REPORTED_MPDU_LENGTH_MASK 0x00003fff
  543. #define RX_MSDU_END_INFO0_REPORTED_MPDU_LENGTH_LSB 0
  544. #define RX_MSDU_END_INFO0_FIRST_MSDU (1 << 14)
  545. #define RX_MSDU_END_INFO0_LAST_MSDU (1 << 15)
  546. #define RX_MSDU_END_INFO0_PRE_DELIM_ERR (1 << 30)
  547. #define RX_MSDU_END_INFO0_RESERVED_3B (1 << 31)
  548. struct rx_msdu_end_common {
  549. __le16 ip_hdr_cksum;
  550. __le16 tcp_hdr_cksum;
  551. u8 key_id_octet;
  552. u8 classification_filter;
  553. u8 wapi_pn[10];
  554. __le32 info0;
  555. } __packed;
  556. #define RX_MSDU_END_INFO1_TCP_FLAG_MASK 0x000001ff
  557. #define RX_MSDU_END_INFO1_TCP_FLAG_LSB 0
  558. #define RX_MSDU_END_INFO1_L3_HDR_PAD_MASK 0x00001c00
  559. #define RX_MSDU_END_INFO1_L3_HDR_PAD_LSB 10
  560. #define RX_MSDU_END_INFO1_WINDOW_SIZE_MASK 0xffff0000
  561. #define RX_MSDU_END_INFO1_WINDOW_SIZE_LSB 16
  562. #define RX_MSDU_END_INFO1_IRO_ELIGIBLE BIT(9)
  563. #define RX_MSDU_END_INFO2_DA_OFFSET_MASK 0x0000003f
  564. #define RX_MSDU_END_INFO2_DA_OFFSET_LSB 0
  565. #define RX_MSDU_END_INFO2_SA_OFFSET_MASK 0x00000fc0
  566. #define RX_MSDU_END_INFO2_SA_OFFSET_LSB 6
  567. #define RX_MSDU_END_INFO2_TYPE_OFFSET_MASK 0x0003f000
  568. #define RX_MSDU_END_INFO2_TYPE_OFFSET_LSB 12
  569. struct rx_msdu_end_qca99x0 {
  570. __le32 ipv6_crc;
  571. __le32 tcp_seq_no;
  572. __le32 tcp_ack_no;
  573. __le32 info1;
  574. __le32 info2;
  575. } __packed;
  576. struct rx_msdu_end_wcn3990 {
  577. __le32 ipv6_crc;
  578. __le32 tcp_seq_no;
  579. __le32 tcp_ack_no;
  580. __le32 info1;
  581. __le32 info2;
  582. __le32 rule_indication_0;
  583. __le32 rule_indication_1;
  584. __le32 rule_indication_2;
  585. __le32 rule_indication_3;
  586. } __packed;
  587. struct rx_msdu_end {
  588. struct rx_msdu_end_common common;
  589. union {
  590. struct rx_msdu_end_qca99x0 qca99x0;
  591. struct rx_msdu_end_wcn3990 wcn3990;
  592. } __packed;
  593. } __packed;
  594. /*
  595. *ip_hdr_chksum
  596. * This can include the IP header checksum or the pseudo header
  597. * checksum used by TCP/UDP checksum.
  598. *
  599. *tcp_udp_chksum
  600. * The value of the computed TCP/UDP checksum. A mode bit
  601. * selects whether this checksum is the full checksum or the
  602. * partial checksum which does not include the pseudo header.
  603. *
  604. *key_id_octet
  605. * The key ID octet from the IV. Only valid when first_msdu is
  606. * set.
  607. *
  608. *classification_filter
  609. * Indicates the number classification filter rule
  610. *
  611. *ext_wapi_pn_63_48
  612. * Extension PN (packet number) which is only used by WAPI.
  613. * This corresponds to WAPI PN bits [63:48] (pn6 and pn7). The
  614. * WAPI PN bits [63:0] are in the pn field of the rx_mpdu_start
  615. * descriptor.
  616. *
  617. *ext_wapi_pn_95_64
  618. * Extension PN (packet number) which is only used by WAPI.
  619. * This corresponds to WAPI PN bits [95:64] (pn8, pn9, pn10 and
  620. * pn11).
  621. *
  622. *ext_wapi_pn_127_96
  623. * Extension PN (packet number) which is only used by WAPI.
  624. * This corresponds to WAPI PN bits [127:96] (pn12, pn13, pn14,
  625. * pn15).
  626. *
  627. *reported_mpdu_length
  628. * MPDU length before decapsulation. Only valid when
  629. * first_msdu is set. This field is taken directly from the
  630. * length field of the A-MPDU delimiter or the preamble length
  631. * field for non-A-MPDU frames.
  632. *
  633. *first_msdu
  634. * Indicates the first MSDU of A-MSDU. If both first_msdu and
  635. * last_msdu are set in the MSDU then this is a non-aggregated
  636. * MSDU frame: normal MPDU. Interior MSDU in an A-MSDU shall
  637. * have both first_mpdu and last_mpdu bits set to 0.
  638. *
  639. *last_msdu
  640. * Indicates the last MSDU of the A-MSDU. MPDU end status is
  641. * only valid when last_msdu is set.
  642. *
  643. *reserved_3a
  644. * Reserved: HW should fill with zero. FW should ignore.
  645. *
  646. *pre_delim_err
  647. * Indicates that the first delimiter had a FCS failure. Only
  648. * valid when first_mpdu and first_msdu are set.
  649. *
  650. *reserved_3b
  651. * Reserved: HW should fill with zero. FW should ignore.
  652. */
  653. #define HTT_RX_PPDU_START_PREAMBLE_LEGACY 0x04
  654. #define HTT_RX_PPDU_START_PREAMBLE_HT 0x08
  655. #define HTT_RX_PPDU_START_PREAMBLE_HT_WITH_TXBF 0x09
  656. #define HTT_RX_PPDU_START_PREAMBLE_VHT 0x0C
  657. #define HTT_RX_PPDU_START_PREAMBLE_VHT_WITH_TXBF 0x0D
  658. #define RX_PPDU_START_INFO0_IS_GREENFIELD (1 << 0)
  659. #define RX_PPDU_START_INFO1_L_SIG_RATE_MASK 0x0000000f
  660. #define RX_PPDU_START_INFO1_L_SIG_RATE_LSB 0
  661. #define RX_PPDU_START_INFO1_L_SIG_LENGTH_MASK 0x0001ffe0
  662. #define RX_PPDU_START_INFO1_L_SIG_LENGTH_LSB 5
  663. #define RX_PPDU_START_INFO1_L_SIG_TAIL_MASK 0x00fc0000
  664. #define RX_PPDU_START_INFO1_L_SIG_TAIL_LSB 18
  665. #define RX_PPDU_START_INFO1_PREAMBLE_TYPE_MASK 0xff000000
  666. #define RX_PPDU_START_INFO1_PREAMBLE_TYPE_LSB 24
  667. #define RX_PPDU_START_INFO1_L_SIG_RATE_SELECT (1 << 4)
  668. #define RX_PPDU_START_INFO1_L_SIG_PARITY (1 << 17)
  669. #define RX_PPDU_START_INFO2_HT_SIG_VHT_SIG_A_1_MASK 0x00ffffff
  670. #define RX_PPDU_START_INFO2_HT_SIG_VHT_SIG_A_1_LSB 0
  671. #define RX_PPDU_START_INFO3_HT_SIG_VHT_SIG_A_2_MASK 0x00ffffff
  672. #define RX_PPDU_START_INFO3_HT_SIG_VHT_SIG_A_2_LSB 0
  673. #define RX_PPDU_START_INFO3_TXBF_H_INFO (1 << 24)
  674. #define RX_PPDU_START_INFO4_VHT_SIG_B_MASK 0x1fffffff
  675. #define RX_PPDU_START_INFO4_VHT_SIG_B_LSB 0
  676. #define RX_PPDU_START_INFO5_SERVICE_MASK 0x0000ffff
  677. #define RX_PPDU_START_INFO5_SERVICE_LSB 0
  678. /* No idea what this flag means. It seems to be always set in rate. */
  679. #define RX_PPDU_START_RATE_FLAG BIT(3)
  680. struct rx_ppdu_start {
  681. struct {
  682. u8 pri20_mhz;
  683. u8 ext20_mhz;
  684. u8 ext40_mhz;
  685. u8 ext80_mhz;
  686. } rssi_chains[4];
  687. u8 rssi_comb;
  688. __le16 rsvd0;
  689. u8 info0; /* %RX_PPDU_START_INFO0_ */
  690. __le32 info1; /* %RX_PPDU_START_INFO1_ */
  691. __le32 info2; /* %RX_PPDU_START_INFO2_ */
  692. __le32 info3; /* %RX_PPDU_START_INFO3_ */
  693. __le32 info4; /* %RX_PPDU_START_INFO4_ */
  694. __le32 info5; /* %RX_PPDU_START_INFO5_ */
  695. } __packed;
  696. /*
  697. * rssi_chain0_pri20
  698. * RSSI of RX PPDU on chain 0 of primary 20 MHz bandwidth.
  699. * Value of 0x80 indicates invalid.
  700. *
  701. * rssi_chain0_sec20
  702. * RSSI of RX PPDU on chain 0 of secondary 20 MHz bandwidth.
  703. * Value of 0x80 indicates invalid.
  704. *
  705. * rssi_chain0_sec40
  706. * RSSI of RX PPDU on chain 0 of secondary 40 MHz bandwidth.
  707. * Value of 0x80 indicates invalid.
  708. *
  709. * rssi_chain0_sec80
  710. * RSSI of RX PPDU on chain 0 of secondary 80 MHz bandwidth.
  711. * Value of 0x80 indicates invalid.
  712. *
  713. * rssi_chain1_pri20
  714. * RSSI of RX PPDU on chain 1 of primary 20 MHz bandwidth.
  715. * Value of 0x80 indicates invalid.
  716. *
  717. * rssi_chain1_sec20
  718. * RSSI of RX PPDU on chain 1 of secondary 20 MHz bandwidth.
  719. * Value of 0x80 indicates invalid.
  720. *
  721. * rssi_chain1_sec40
  722. * RSSI of RX PPDU on chain 1 of secondary 40 MHz bandwidth.
  723. * Value of 0x80 indicates invalid.
  724. *
  725. * rssi_chain1_sec80
  726. * RSSI of RX PPDU on chain 1 of secondary 80 MHz bandwidth.
  727. * Value of 0x80 indicates invalid.
  728. *
  729. * rssi_chain2_pri20
  730. * RSSI of RX PPDU on chain 2 of primary 20 MHz bandwidth.
  731. * Value of 0x80 indicates invalid.
  732. *
  733. * rssi_chain2_sec20
  734. * RSSI of RX PPDU on chain 2 of secondary 20 MHz bandwidth.
  735. * Value of 0x80 indicates invalid.
  736. *
  737. * rssi_chain2_sec40
  738. * RSSI of RX PPDU on chain 2 of secondary 40 MHz bandwidth.
  739. * Value of 0x80 indicates invalid.
  740. *
  741. * rssi_chain2_sec80
  742. * RSSI of RX PPDU on chain 2 of secondary 80 MHz bandwidth.
  743. * Value of 0x80 indicates invalid.
  744. *
  745. * rssi_chain3_pri20
  746. * RSSI of RX PPDU on chain 3 of primary 20 MHz bandwidth.
  747. * Value of 0x80 indicates invalid.
  748. *
  749. * rssi_chain3_sec20
  750. * RSSI of RX PPDU on chain 3 of secondary 20 MHz bandwidth.
  751. * Value of 0x80 indicates invalid.
  752. *
  753. * rssi_chain3_sec40
  754. * RSSI of RX PPDU on chain 3 of secondary 40 MHz bandwidth.
  755. * Value of 0x80 indicates invalid.
  756. *
  757. * rssi_chain3_sec80
  758. * RSSI of RX PPDU on chain 3 of secondary 80 MHz bandwidth.
  759. * Value of 0x80 indicates invalid.
  760. *
  761. * rssi_comb
  762. * The combined RSSI of RX PPDU of all active chains and
  763. * bandwidths. Value of 0x80 indicates invalid.
  764. *
  765. * reserved_4a
  766. * Reserved: HW should fill with 0, FW should ignore.
  767. *
  768. * is_greenfield
  769. * Do we really support this?
  770. *
  771. * reserved_4b
  772. * Reserved: HW should fill with 0, FW should ignore.
  773. *
  774. * l_sig_rate
  775. * If l_sig_rate_select is 0:
  776. * 0x8: OFDM 48 Mbps
  777. * 0x9: OFDM 24 Mbps
  778. * 0xA: OFDM 12 Mbps
  779. * 0xB: OFDM 6 Mbps
  780. * 0xC: OFDM 54 Mbps
  781. * 0xD: OFDM 36 Mbps
  782. * 0xE: OFDM 18 Mbps
  783. * 0xF: OFDM 9 Mbps
  784. * If l_sig_rate_select is 1:
  785. * 0x8: CCK 11 Mbps long preamble
  786. * 0x9: CCK 5.5 Mbps long preamble
  787. * 0xA: CCK 2 Mbps long preamble
  788. * 0xB: CCK 1 Mbps long preamble
  789. * 0xC: CCK 11 Mbps short preamble
  790. * 0xD: CCK 5.5 Mbps short preamble
  791. * 0xE: CCK 2 Mbps short preamble
  792. *
  793. * l_sig_rate_select
  794. * Legacy signal rate select. If set then l_sig_rate indicates
  795. * CCK rates. If clear then l_sig_rate indicates OFDM rates.
  796. *
  797. * l_sig_length
  798. * Length of legacy frame in octets.
  799. *
  800. * l_sig_parity
  801. * Odd parity over l_sig_rate and l_sig_length
  802. *
  803. * l_sig_tail
  804. * Tail bits for Viterbi decoder
  805. *
  806. * preamble_type
  807. * Indicates the type of preamble ahead:
  808. * 0x4: Legacy (OFDM/CCK)
  809. * 0x8: HT
  810. * 0x9: HT with TxBF
  811. * 0xC: VHT
  812. * 0xD: VHT with TxBF
  813. * 0x80 - 0xFF: Reserved for special baseband data types such
  814. * as radar and spectral scan.
  815. *
  816. * ht_sig_vht_sig_a_1
  817. * If preamble_type == 0x8 or 0x9
  818. * HT-SIG (first 24 bits)
  819. * If preamble_type == 0xC or 0xD
  820. * VHT-SIG A (first 24 bits)
  821. * Else
  822. * Reserved
  823. *
  824. * reserved_6
  825. * Reserved: HW should fill with 0, FW should ignore.
  826. *
  827. * ht_sig_vht_sig_a_2
  828. * If preamble_type == 0x8 or 0x9
  829. * HT-SIG (last 24 bits)
  830. * If preamble_type == 0xC or 0xD
  831. * VHT-SIG A (last 24 bits)
  832. * Else
  833. * Reserved
  834. *
  835. * txbf_h_info
  836. * Indicates that the packet data carries H information which
  837. * is used for TxBF debug.
  838. *
  839. * reserved_7
  840. * Reserved: HW should fill with 0, FW should ignore.
  841. *
  842. * vht_sig_b
  843. * WiFi 1.0 and WiFi 2.0 will likely have this field to be all
  844. * 0s since the BB does not plan on decoding VHT SIG-B.
  845. *
  846. * reserved_8
  847. * Reserved: HW should fill with 0, FW should ignore.
  848. *
  849. * service
  850. * Service field from BB for OFDM, HT and VHT packets. CCK
  851. * packets will have service field of 0.
  852. *
  853. * reserved_9
  854. * Reserved: HW should fill with 0, FW should ignore.
  855. */
  856. #define RX_PPDU_END_FLAGS_PHY_ERR (1 << 0)
  857. #define RX_PPDU_END_FLAGS_RX_LOCATION (1 << 1)
  858. #define RX_PPDU_END_FLAGS_TXBF_H_INFO (1 << 2)
  859. #define RX_PPDU_END_INFO0_RX_ANTENNA_MASK 0x00ffffff
  860. #define RX_PPDU_END_INFO0_RX_ANTENNA_LSB 0
  861. #define RX_PPDU_END_INFO0_FLAGS_TX_HT_VHT_ACK (1 << 24)
  862. #define RX_PPDU_END_INFO0_BB_CAPTURED_CHANNEL (1 << 25)
  863. #define RX_PPDU_END_INFO1_PEER_IDX_MASK 0x1ffc
  864. #define RX_PPDU_END_INFO1_PEER_IDX_LSB 2
  865. #define RX_PPDU_END_INFO1_BB_DATA BIT(0)
  866. #define RX_PPDU_END_INFO1_PEER_IDX_VALID BIT(1)
  867. #define RX_PPDU_END_INFO1_PPDU_DONE BIT(15)
  868. struct rx_ppdu_end_common {
  869. __le32 evm_p0;
  870. __le32 evm_p1;
  871. __le32 evm_p2;
  872. __le32 evm_p3;
  873. __le32 evm_p4;
  874. __le32 evm_p5;
  875. __le32 evm_p6;
  876. __le32 evm_p7;
  877. __le32 evm_p8;
  878. __le32 evm_p9;
  879. __le32 evm_p10;
  880. __le32 evm_p11;
  881. __le32 evm_p12;
  882. __le32 evm_p13;
  883. __le32 evm_p14;
  884. __le32 evm_p15;
  885. __le32 tsf_timestamp;
  886. __le32 wb_timestamp;
  887. } __packed;
  888. struct rx_ppdu_end_qca988x {
  889. u8 locationing_timestamp;
  890. u8 phy_err_code;
  891. __le16 flags; /* %RX_PPDU_END_FLAGS_ */
  892. __le32 info0; /* %RX_PPDU_END_INFO0_ */
  893. __le16 bb_length;
  894. __le16 info1; /* %RX_PPDU_END_INFO1_ */
  895. } __packed;
  896. #define RX_PPDU_END_RTT_CORRELATION_VALUE_MASK 0x00ffffff
  897. #define RX_PPDU_END_RTT_CORRELATION_VALUE_LSB 0
  898. #define RX_PPDU_END_RTT_UNUSED_MASK 0x7f000000
  899. #define RX_PPDU_END_RTT_UNUSED_LSB 24
  900. #define RX_PPDU_END_RTT_NORMAL_MODE BIT(31)
  901. struct rx_ppdu_end_qca6174 {
  902. u8 locationing_timestamp;
  903. u8 phy_err_code;
  904. __le16 flags; /* %RX_PPDU_END_FLAGS_ */
  905. __le32 info0; /* %RX_PPDU_END_INFO0_ */
  906. __le32 rtt; /* %RX_PPDU_END_RTT_ */
  907. __le16 bb_length;
  908. __le16 info1; /* %RX_PPDU_END_INFO1_ */
  909. } __packed;
  910. #define RX_PKT_END_INFO0_RX_SUCCESS BIT(0)
  911. #define RX_PKT_END_INFO0_ERR_TX_INTERRUPT_RX BIT(3)
  912. #define RX_PKT_END_INFO0_ERR_OFDM_POWER_DROP BIT(4)
  913. #define RX_PKT_END_INFO0_ERR_OFDM_RESTART BIT(5)
  914. #define RX_PKT_END_INFO0_ERR_CCK_POWER_DROP BIT(6)
  915. #define RX_PKT_END_INFO0_ERR_CCK_RESTART BIT(7)
  916. #define RX_LOCATION_INFO_RTT_CORR_VAL_MASK 0x0001ffff
  917. #define RX_LOCATION_INFO_RTT_CORR_VAL_LSB 0
  918. #define RX_LOCATION_INFO_FAC_STATUS_MASK 0x000c0000
  919. #define RX_LOCATION_INFO_FAC_STATUS_LSB 18
  920. #define RX_LOCATION_INFO_PKT_BW_MASK 0x00700000
  921. #define RX_LOCATION_INFO_PKT_BW_LSB 20
  922. #define RX_LOCATION_INFO_RTT_TX_FRAME_PHASE_MASK 0x01800000
  923. #define RX_LOCATION_INFO_RTT_TX_FRAME_PHASE_LSB 23
  924. #define RX_LOCATION_INFO_CIR_STATUS BIT(17)
  925. #define RX_LOCATION_INFO_RTT_MAC_PHY_PHASE BIT(25)
  926. #define RX_LOCATION_INFO_RTT_TX_DATA_START_X BIT(26)
  927. #define RX_LOCATION_INFO_HW_IFFT_MODE BIT(30)
  928. #define RX_LOCATION_INFO_RX_LOCATION_VALID BIT(31)
  929. struct rx_pkt_end {
  930. __le32 info0; /* %RX_PKT_END_INFO0_ */
  931. __le32 phy_timestamp_1;
  932. __le32 phy_timestamp_2;
  933. } __packed;
  934. struct rx_pkt_end_wcn3990 {
  935. __le32 info0; /* %RX_PKT_END_INFO0_ */
  936. __le64 phy_timestamp_1;
  937. __le64 phy_timestamp_2;
  938. } __packed;
  939. #define RX_LOCATION_INFO0_RTT_FAC_LEGACY_MASK 0x00003fff
  940. #define RX_LOCATION_INFO0_RTT_FAC_LEGACY_LSB 0
  941. #define RX_LOCATION_INFO0_RTT_FAC_VHT_MASK 0x1fff8000
  942. #define RX_LOCATION_INFO0_RTT_FAC_VHT_LSB 15
  943. #define RX_LOCATION_INFO0_RTT_STRONGEST_CHAIN_MASK 0xc0000000
  944. #define RX_LOCATION_INFO0_RTT_STRONGEST_CHAIN_LSB 30
  945. #define RX_LOCATION_INFO0_RTT_FAC_LEGACY_STATUS BIT(14)
  946. #define RX_LOCATION_INFO0_RTT_FAC_VHT_STATUS BIT(29)
  947. #define RX_LOCATION_INFO1_RTT_PREAMBLE_TYPE_MASK 0x0000000c
  948. #define RX_LOCATION_INFO1_RTT_PREAMBLE_TYPE_LSB 2
  949. #define RX_LOCATION_INFO1_PKT_BW_MASK 0x00000030
  950. #define RX_LOCATION_INFO1_PKT_BW_LSB 4
  951. #define RX_LOCATION_INFO1_SKIP_P_SKIP_BTCF_MASK 0x0000ff00
  952. #define RX_LOCATION_INFO1_SKIP_P_SKIP_BTCF_LSB 8
  953. #define RX_LOCATION_INFO1_RTT_MSC_RATE_MASK 0x000f0000
  954. #define RX_LOCATION_INFO1_RTT_MSC_RATE_LSB 16
  955. #define RX_LOCATION_INFO1_RTT_PBD_LEG_BW_MASK 0x00300000
  956. #define RX_LOCATION_INFO1_RTT_PBD_LEG_BW_LSB 20
  957. #define RX_LOCATION_INFO1_TIMING_BACKOFF_MASK 0x07c00000
  958. #define RX_LOCATION_INFO1_TIMING_BACKOFF_LSB 22
  959. #define RX_LOCATION_INFO1_RTT_TX_FRAME_PHASE_MASK 0x18000000
  960. #define RX_LOCATION_INFO1_RTT_TX_FRAME_PHASE_LSB 27
  961. #define RX_LOCATION_INFO1_RTT_CFR_STATUS BIT(0)
  962. #define RX_LOCATION_INFO1_RTT_CIR_STATUS BIT(1)
  963. #define RX_LOCATION_INFO1_RTT_GI_TYPE BIT(7)
  964. #define RX_LOCATION_INFO1_RTT_MAC_PHY_PHASE BIT(29)
  965. #define RX_LOCATION_INFO1_RTT_TX_DATA_START_X_PHASE BIT(30)
  966. #define RX_LOCATION_INFO1_RX_LOCATION_VALID BIT(31)
  967. struct rx_location_info {
  968. __le32 rx_location_info0; /* %RX_LOCATION_INFO0_ */
  969. __le32 rx_location_info1; /* %RX_LOCATION_INFO1_ */
  970. } __packed;
  971. struct rx_location_info_wcn3990 {
  972. __le32 rx_location_info0; /* %RX_LOCATION_INFO0_ */
  973. __le32 rx_location_info1; /* %RX_LOCATION_INFO1_ */
  974. __le32 rx_location_info2; /* %RX_LOCATION_INFO2_ */
  975. } __packed;
  976. enum rx_phy_ppdu_end_info0 {
  977. RX_PHY_PPDU_END_INFO0_ERR_RADAR = BIT(2),
  978. RX_PHY_PPDU_END_INFO0_ERR_RX_ABORT = BIT(3),
  979. RX_PHY_PPDU_END_INFO0_ERR_RX_NAP = BIT(4),
  980. RX_PHY_PPDU_END_INFO0_ERR_OFDM_TIMING = BIT(5),
  981. RX_PHY_PPDU_END_INFO0_ERR_OFDM_PARITY = BIT(6),
  982. RX_PHY_PPDU_END_INFO0_ERR_OFDM_RATE = BIT(7),
  983. RX_PHY_PPDU_END_INFO0_ERR_OFDM_LENGTH = BIT(8),
  984. RX_PHY_PPDU_END_INFO0_ERR_OFDM_RESTART = BIT(9),
  985. RX_PHY_PPDU_END_INFO0_ERR_OFDM_SERVICE = BIT(10),
  986. RX_PHY_PPDU_END_INFO0_ERR_OFDM_POWER_DROP = BIT(11),
  987. RX_PHY_PPDU_END_INFO0_ERR_CCK_BLOCKER = BIT(12),
  988. RX_PHY_PPDU_END_INFO0_ERR_CCK_TIMING = BIT(13),
  989. RX_PHY_PPDU_END_INFO0_ERR_CCK_HEADER_CRC = BIT(14),
  990. RX_PHY_PPDU_END_INFO0_ERR_CCK_RATE = BIT(15),
  991. RX_PHY_PPDU_END_INFO0_ERR_CCK_LENGTH = BIT(16),
  992. RX_PHY_PPDU_END_INFO0_ERR_CCK_RESTART = BIT(17),
  993. RX_PHY_PPDU_END_INFO0_ERR_CCK_SERVICE = BIT(18),
  994. RX_PHY_PPDU_END_INFO0_ERR_CCK_POWER_DROP = BIT(19),
  995. RX_PHY_PPDU_END_INFO0_ERR_HT_CRC = BIT(20),
  996. RX_PHY_PPDU_END_INFO0_ERR_HT_LENGTH = BIT(21),
  997. RX_PHY_PPDU_END_INFO0_ERR_HT_RATE = BIT(22),
  998. RX_PHY_PPDU_END_INFO0_ERR_HT_ZLF = BIT(23),
  999. RX_PHY_PPDU_END_INFO0_ERR_FALSE_RADAR_EXT = BIT(24),
  1000. RX_PHY_PPDU_END_INFO0_ERR_GREEN_FIELD = BIT(25),
  1001. RX_PHY_PPDU_END_INFO0_ERR_SPECTRAL_SCAN = BIT(26),
  1002. RX_PHY_PPDU_END_INFO0_ERR_RX_DYN_BW = BIT(27),
  1003. RX_PHY_PPDU_END_INFO0_ERR_LEG_HT_MISMATCH = BIT(28),
  1004. RX_PHY_PPDU_END_INFO0_ERR_VHT_CRC = BIT(29),
  1005. RX_PHY_PPDU_END_INFO0_ERR_VHT_SIGA = BIT(30),
  1006. RX_PHY_PPDU_END_INFO0_ERR_VHT_LSIG = BIT(31),
  1007. };
  1008. enum rx_phy_ppdu_end_info1 {
  1009. RX_PHY_PPDU_END_INFO1_ERR_VHT_NDP = BIT(0),
  1010. RX_PHY_PPDU_END_INFO1_ERR_VHT_NSYM = BIT(1),
  1011. RX_PHY_PPDU_END_INFO1_ERR_VHT_RX_EXT_SYM = BIT(2),
  1012. RX_PHY_PPDU_END_INFO1_ERR_VHT_RX_SKIP_ID0 = BIT(3),
  1013. RX_PHY_PPDU_END_INFO1_ERR_VHT_RX_SKIP_ID1_62 = BIT(4),
  1014. RX_PHY_PPDU_END_INFO1_ERR_VHT_RX_SKIP_ID63 = BIT(5),
  1015. RX_PHY_PPDU_END_INFO1_ERR_OFDM_LDPC_DECODER = BIT(6),
  1016. RX_PHY_PPDU_END_INFO1_ERR_DEFER_NAP = BIT(7),
  1017. RX_PHY_PPDU_END_INFO1_ERR_FDOMAIN_TIMEOUT = BIT(8),
  1018. RX_PHY_PPDU_END_INFO1_ERR_LSIG_REL_CHECK = BIT(9),
  1019. RX_PHY_PPDU_END_INFO1_ERR_BT_COLLISION = BIT(10),
  1020. RX_PHY_PPDU_END_INFO1_ERR_MU_FEEDBACK = BIT(11),
  1021. RX_PHY_PPDU_END_INFO1_ERR_TX_INTERRUPT_RX = BIT(12),
  1022. RX_PHY_PPDU_END_INFO1_ERR_RX_CBF = BIT(13),
  1023. };
  1024. struct rx_phy_ppdu_end {
  1025. __le32 info0; /* %RX_PHY_PPDU_END_INFO0_ */
  1026. __le32 info1; /* %RX_PHY_PPDU_END_INFO1_ */
  1027. } __packed;
  1028. #define RX_PPDU_END_RX_TIMING_OFFSET_MASK 0x00000fff
  1029. #define RX_PPDU_END_RX_TIMING_OFFSET_LSB 0
  1030. #define RX_PPDU_END_RX_INFO_RX_ANTENNA_MASK 0x00ffffff
  1031. #define RX_PPDU_END_RX_INFO_RX_ANTENNA_LSB 0
  1032. #define RX_PPDU_END_RX_INFO_TX_HT_VHT_ACK BIT(24)
  1033. #define RX_PPDU_END_RX_INFO_RX_PKT_END_VALID BIT(25)
  1034. #define RX_PPDU_END_RX_INFO_RX_PHY_PPDU_END_VALID BIT(26)
  1035. #define RX_PPDU_END_RX_INFO_RX_TIMING_OFFSET_VALID BIT(27)
  1036. #define RX_PPDU_END_RX_INFO_BB_CAPTURED_CHANNEL BIT(28)
  1037. #define RX_PPDU_END_RX_INFO_UNSUPPORTED_MU_NC BIT(29)
  1038. #define RX_PPDU_END_RX_INFO_OTP_TXBF_DISABLE BIT(30)
  1039. struct rx_ppdu_end_qca99x0 {
  1040. struct rx_pkt_end rx_pkt_end;
  1041. __le32 rx_location_info; /* %RX_LOCATION_INFO_ */
  1042. struct rx_phy_ppdu_end rx_phy_ppdu_end;
  1043. __le32 rx_timing_offset; /* %RX_PPDU_END_RX_TIMING_OFFSET_ */
  1044. __le32 rx_info; /* %RX_PPDU_END_RX_INFO_ */
  1045. __le16 bb_length;
  1046. __le16 info1; /* %RX_PPDU_END_INFO1_ */
  1047. } __packed;
  1048. struct rx_ppdu_end_qca9984 {
  1049. struct rx_pkt_end rx_pkt_end;
  1050. struct rx_location_info rx_location_info;
  1051. struct rx_phy_ppdu_end rx_phy_ppdu_end;
  1052. __le32 rx_timing_offset; /* %RX_PPDU_END_RX_TIMING_OFFSET_ */
  1053. __le32 rx_info; /* %RX_PPDU_END_RX_INFO_ */
  1054. __le16 bb_length;
  1055. __le16 info1; /* %RX_PPDU_END_INFO1_ */
  1056. } __packed;
  1057. struct rx_ppdu_end_wcn3990 {
  1058. struct rx_pkt_end_wcn3990 rx_pkt_end;
  1059. struct rx_location_info_wcn3990 rx_location_info;
  1060. struct rx_phy_ppdu_end rx_phy_ppdu_end;
  1061. __le32 rx_timing_offset;
  1062. __le32 reserved_info_0;
  1063. __le32 reserved_info_1;
  1064. __le32 rx_antenna_info;
  1065. __le32 rx_coex_info;
  1066. __le32 rx_mpdu_cnt_info;
  1067. __le64 phy_timestamp_tx;
  1068. __le32 rx_bb_length;
  1069. } __packed;
  1070. struct rx_ppdu_end {
  1071. struct rx_ppdu_end_common common;
  1072. union {
  1073. struct rx_ppdu_end_qca988x qca988x;
  1074. struct rx_ppdu_end_qca6174 qca6174;
  1075. struct rx_ppdu_end_qca99x0 qca99x0;
  1076. struct rx_ppdu_end_qca9984 qca9984;
  1077. struct rx_ppdu_end_wcn3990 wcn3990;
  1078. } __packed;
  1079. } __packed;
  1080. /*
  1081. * evm_p0
  1082. * EVM for pilot 0. Contain EVM for streams: 0, 1, 2 and 3.
  1083. *
  1084. * evm_p1
  1085. * EVM for pilot 1. Contain EVM for streams: 0, 1, 2 and 3.
  1086. *
  1087. * evm_p2
  1088. * EVM for pilot 2. Contain EVM for streams: 0, 1, 2 and 3.
  1089. *
  1090. * evm_p3
  1091. * EVM for pilot 3. Contain EVM for streams: 0, 1, 2 and 3.
  1092. *
  1093. * evm_p4
  1094. * EVM for pilot 4. Contain EVM for streams: 0, 1, 2 and 3.
  1095. *
  1096. * evm_p5
  1097. * EVM for pilot 5. Contain EVM for streams: 0, 1, 2 and 3.
  1098. *
  1099. * evm_p6
  1100. * EVM for pilot 6. Contain EVM for streams: 0, 1, 2 and 3.
  1101. *
  1102. * evm_p7
  1103. * EVM for pilot 7. Contain EVM for streams: 0, 1, 2 and 3.
  1104. *
  1105. * evm_p8
  1106. * EVM for pilot 8. Contain EVM for streams: 0, 1, 2 and 3.
  1107. *
  1108. * evm_p9
  1109. * EVM for pilot 9. Contain EVM for streams: 0, 1, 2 and 3.
  1110. *
  1111. * evm_p10
  1112. * EVM for pilot 10. Contain EVM for streams: 0, 1, 2 and 3.
  1113. *
  1114. * evm_p11
  1115. * EVM for pilot 11. Contain EVM for streams: 0, 1, 2 and 3.
  1116. *
  1117. * evm_p12
  1118. * EVM for pilot 12. Contain EVM for streams: 0, 1, 2 and 3.
  1119. *
  1120. * evm_p13
  1121. * EVM for pilot 13. Contain EVM for streams: 0, 1, 2 and 3.
  1122. *
  1123. * evm_p14
  1124. * EVM for pilot 14. Contain EVM for streams: 0, 1, 2 and 3.
  1125. *
  1126. * evm_p15
  1127. * EVM for pilot 15. Contain EVM for streams: 0, 1, 2 and 3.
  1128. *
  1129. * tsf_timestamp
  1130. * Receive TSF timestamp sampled on the rising edge of
  1131. * rx_clear. For PHY errors this may be the current TSF when
  1132. * phy_error is asserted if the rx_clear does not assert before
  1133. * the end of the PHY error.
  1134. *
  1135. * wb_timestamp
  1136. * WLAN/BT timestamp is a 1 usec resolution timestamp which
  1137. * does not get updated based on receive beacon like TSF. The
  1138. * same rules for capturing tsf_timestamp are used to capture
  1139. * the wb_timestamp.
  1140. *
  1141. * locationing_timestamp
  1142. * Timestamp used for locationing. This timestamp is used to
  1143. * indicate fractions of usec. For example if the MAC clock is
  1144. * running at 80 MHz, the timestamp will increment every 12.5
  1145. * nsec. The value starts at 0 and increments to 79 and
  1146. * returns to 0 and repeats. This information is valid for
  1147. * every PPDU. This information can be used in conjunction
  1148. * with wb_timestamp to capture large delta times.
  1149. *
  1150. * phy_err_code
  1151. * See the 1.10.8.1.2 for the list of the PHY error codes.
  1152. *
  1153. * phy_err
  1154. * Indicates a PHY error was detected for this PPDU.
  1155. *
  1156. * rx_location
  1157. * Indicates that location information was requested.
  1158. *
  1159. * txbf_h_info
  1160. * Indicates that the packet data carries H information which
  1161. * is used for TxBF debug.
  1162. *
  1163. * reserved_18
  1164. * Reserved: HW should fill with 0, FW should ignore.
  1165. *
  1166. * rx_antenna
  1167. * Receive antenna value
  1168. *
  1169. * tx_ht_vht_ack
  1170. * Indicates that a HT or VHT Ack/BA frame was transmitted in
  1171. * response to this receive packet.
  1172. *
  1173. * bb_captured_channel
  1174. * Indicates that the BB has captured a channel dump. FW can
  1175. * then read the channel dump memory. This may indicate that
  1176. * the channel was captured either based on PCU setting the
  1177. * capture_channel bit BB descriptor or FW setting the
  1178. * capture_channel mode bit.
  1179. *
  1180. * reserved_19
  1181. * Reserved: HW should fill with 0, FW should ignore.
  1182. *
  1183. * bb_length
  1184. * Indicates the number of bytes of baseband information for
  1185. * PPDUs where the BB descriptor preamble type is 0x80 to 0xFF
  1186. * which indicates that this is not a normal PPDU but rather
  1187. * contains baseband debug information.
  1188. *
  1189. * reserved_20
  1190. * Reserved: HW should fill with 0, FW should ignore.
  1191. *
  1192. * ppdu_done
  1193. * PPDU end status is only valid when ppdu_done bit is set.
  1194. * Every time HW sets this bit in memory FW/SW must clear this
  1195. * bit in memory. FW will initialize all the ppdu_done dword
  1196. * to 0.
  1197. */
  1198. #define FW_RX_DESC_INFO0_DISCARD (1 << 0)
  1199. #define FW_RX_DESC_INFO0_FORWARD (1 << 1)
  1200. #define FW_RX_DESC_INFO0_INSPECT (1 << 5)
  1201. #define FW_RX_DESC_INFO0_EXT_MASK 0xC0
  1202. #define FW_RX_DESC_INFO0_EXT_LSB 6
  1203. struct fw_rx_desc_base {
  1204. u8 info0;
  1205. } __packed;
  1206. #endif /* _RX_DESC_H_ */