rx_desc.h 31 KB

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