rx_desc.h 41 KB

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