htt_ppdu_stats.h 70 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870
  1. /*
  2. * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. /**
  19. * @file htt_ppdu_stats.h
  20. *
  21. * @details the public header file of HTT STATS
  22. */
  23. #ifndef __HTT_PPDU_STATS_H__
  24. #define __HTT_PPDU_STATS_H__
  25. #include <htt.h>
  26. #include <htt_stats.h>
  27. #define HTT_BA_64_BIT_MAP_SIZE_DWORDS 2
  28. #define HTT_BA_256_BIT_MAP_SIZE_DWORDS 8
  29. enum htt_ppdu_stats_tlv_tag {
  30. HTT_PPDU_STATS_COMMON_TLV,
  31. HTT_PPDU_STATS_USR_COMMON_TLV,
  32. HTT_PPDU_STATS_USR_RATE_TLV,
  33. HTT_PPDU_STATS_USR_MPDU_ENQ_BITMAP_64_TLV,
  34. HTT_PPDU_STATS_USR_MPDU_ENQ_BITMAP_256_TLV,
  35. HTT_PPDU_STATS_SCH_CMD_STATUS_TLV,
  36. HTT_PPDU_STATS_USR_COMPLTN_COMMON_TLV,
  37. HTT_PPDU_STATS_USR_COMPLTN_BA_BITMAP_64_TLV,
  38. HTT_PPDU_STATS_USR_COMPLTN_BA_BITMAP_256_TLV,
  39. HTT_PPDU_STATS_USR_COMPLTN_ACK_BA_STATUS_TLV,
  40. HTT_PPDU_STATS_USR_COMPLTN_FLUSH_TLV,
  41. HTT_PPDU_STATS_USR_COMMON_ARRAY_TLV,
  42. HTT_PPDU_STATS_INFO_TLV,
  43. HTT_PPDU_STATS_TX_MGMTCTRL_PAYLOAD_TLV,
  44. /* New TLV's are added above to this line */
  45. HTT_PPDU_STATS_MAX_TAG,
  46. };
  47. typedef enum htt_ppdu_stats_tlv_tag htt_ppdu_stats_tlv_tag_t;
  48. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RATE_M 0x000000ff
  49. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RATE_S 0
  50. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RATE_GET(_var) \
  51. (((_var) & HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RATE_M) >> \
  52. HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RATE_S)
  53. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RATE_SET(_var, _val) \
  54. do { \
  55. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RATE, _val); \
  56. ((_var) |= ((_val) << HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RATE_S)); \
  57. } while (0)
  58. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_IS_AMPDU_M 0x00000100
  59. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_IS_AMPDU_S 8
  60. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_IS_AMPDU_GET(_var) \
  61. (((_var) & HTT_PPDU_STATS_ARRAY_ITEM_TLV_IS_AMPDU_M) >> \
  62. HTT_PPDU_STATS_ARRAY_ITEM_TLV_IS_AMPDU_S)
  63. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_IS_AMPDU_SET(_var, _val) \
  64. do { \
  65. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_ARRAY_ITEM_TLV_IS_AMPDU, _val); \
  66. ((_var) |= ((_val) << HTT_PPDU_STATS_ARRAY_ITEM_TLV_IS_AMPDU_S)); \
  67. } while (0)
  68. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_BA_ACK_FAILED_M 0x00000600
  69. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_BA_ACK_FAILED_S 9
  70. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_BA_ACK_FAILED_GET(_var) \
  71. (((_var) & HTT_PPDU_STATS_ARRAY_ITEM_TLV_BA_ACK_FAILED_M) >> \
  72. HTT_PPDU_STATS_ARRAY_ITEM_TLV_BA_ACK_FAILED_S)
  73. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_BA_ACK_FAILED_SET(_var, _val) \
  74. do { \
  75. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_ARRAY_ITEM_TLV_BA_ACK_FAILED, _val); \
  76. ((_var) |= ((_val) << HTT_PPDU_STATS_ARRAY_ITEM_TLV_BA_ACK_FAILED_S)); \
  77. } while (0)
  78. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_BW_M 0x00003800
  79. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_BW_S 11
  80. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_BW_GET(_var) \
  81. (((_var) & HTT_PPDU_STATS_ARRAY_ITEM_TLV_BW_M) >> \
  82. HTT_PPDU_STATS_ARRAY_ITEM_TLV_BW_S)
  83. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_BW_SET(_var, _val) \
  84. do { \
  85. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_ARRAY_ITEM_TLV_BW, _val); \
  86. ((_var) |= ((_val) << HTT_PPDU_STATS_ARRAY_ITEM_TLV_BW_S)); \
  87. } while (0)
  88. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_SGI_M 0x00004000
  89. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_SGI_S 14
  90. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_SGI_GET(_var) \
  91. (((_var) & HTT_PPDU_STATS_ARRAY_ITEM_TLV_SGI_M) >> \
  92. HTT_PPDU_STATS_ARRAY_ITEM_TLV_SGI_S)
  93. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_SGI_SET(_var, _val) \
  94. do { \
  95. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_ARRAY_ITEM_TLV_SGI, _val); \
  96. ((_var) |= ((_val) << HTT_PPDU_STATS_ARRAY_ITEM_TLV_SGI_S)); \
  97. } while (0)
  98. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_SR_M 0x00008000
  99. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_SR_S 15
  100. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_SR_GET(_var) \
  101. (((_var) & HTT_PPDU_STATS_ARRAY_ITEM_TLV_SR_M) >> \
  102. HTT_PPDU_STATS_ARRAY_ITEM_TLV_SR_S)
  103. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_SR_SET(_var, _val) \
  104. do { \
  105. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_ARRAY_ITEM_TLV_SR, _val); \
  106. ((_var) |= ((_val) << HTT_PPDU_STATS_ARRAY_ITEM_TLV_SR_S)); \
  107. } while (0)
  108. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_PEERID_M 0xffff0000
  109. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_PEERID_S 16
  110. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_PEERID_GET(_var) \
  111. (((_var) & HTT_PPDU_STATS_ARRAY_ITEM_TLV_PEERID_M) >> \
  112. HTT_PPDU_STATS_ARRAY_ITEM_TLV_PEERID_S)
  113. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_PEERID_SET(_var, _val) \
  114. do { \
  115. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_ARRAY_ITEM_TLV_PEERID, _val); \
  116. ((_var) |= ((_val) << HTT_PPDU_STATS_ARRAY_ITEM_TLV_PEERID_S)); \
  117. } while (0)
  118. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_SUCC_MSDUS_M 0x0000ffff
  119. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_SUCC_MSDUS_S 0
  120. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_SUCC_MSDUS_GET(_var) \
  121. (((_var) & HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_SUCC_MSDUS_M) >> \
  122. HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_SUCC_MSDUS_S)
  123. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_SUCC_MSDUS_SET(_var, _val) \
  124. do { \
  125. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_SUCC_MSDUS, _val); \
  126. ((_var) |= ((_val) << HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_SUCC_MSDUS_S)); \
  127. } while (0)
  128. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RETRY_MSDUS_M 0xffff0000
  129. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RETRY_MSDUS_S 16
  130. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RETRY_MSDUS_GET(_var) \
  131. (((_var) & HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RETRY_MSDUS_M) >> \
  132. HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RETRY_MSDUS_S)
  133. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RETRY_MSDUS_SET(_var, _val) \
  134. do { \
  135. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RETRY_MSDUS, _val); \
  136. ((_var) |= ((_val) << HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RETRY_MSDUS_S)); \
  137. } while (0)
  138. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_FAILED_MSDUS_M 0x0000ffff
  139. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_FAILED_MSDUS_S 0
  140. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_FAILED_MSDUS_GET(_var) \
  141. (((_var) & HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_FAILED_MSDUS_M) >> \
  142. HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_FAILED_MSDUS_S)
  143. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_FAILED_MSDUS_SET(_var, _val) \
  144. do { \
  145. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_FAILED_MSDUS, _val); \
  146. ((_var) |= ((_val) << HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_FAILED_MSDUS_S)); \
  147. } while (0)
  148. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_DUR_M 0xffff0000
  149. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_DUR_S 16
  150. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_DUR_GET(_var) \
  151. (((_var) & HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_DUR_M) >> \
  152. HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_DUR_S)
  153. #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_DUR_SET(_var, _val) \
  154. do { \
  155. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_DUR, _val); \
  156. ((_var) |= ((_val) << HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_DUR_S)); \
  157. } while (0)
  158. PREPACK struct htt_tx_ppdu_stats_info {
  159. htt_tlv_hdr_t tlv_hdr;
  160. A_UINT32 tx_success_bytes;
  161. A_UINT32 tx_retry_bytes;
  162. A_UINT32 tx_failed_bytes;
  163. A_UINT32 tx_ratecode: 8,
  164. is_ampdu: 1,
  165. ba_ack_failed: 2,
  166. /* 0: 20 MHz
  167. 1: 40 MHz
  168. 2: 80 MHz
  169. 3: 160 MHz or 80+80 MHz */
  170. bw: 3,
  171. sgi: 1,
  172. skipped_rate_ctrl: 1,
  173. peer_id: 16;
  174. A_UINT32 tx_success_msdus: 16,
  175. tx_retry_msdus: 16;
  176. A_UINT32 tx_failed_msdus: 16,
  177. /* united in us */
  178. tx_duration: 16;
  179. /*
  180. * 1 in bit 0 of valid_bitmap represents that bitmap itself is valid.
  181. * If the bitmap is valid (i.e. bit 0 is set), then check the other bits
  182. * of bitmap to know which fields within htt_tx_ppdu_stats_info are valid.
  183. * If bit 1 is set, tx_success_bytes is valid
  184. * If bit 2 is set, tx_retry_bytes is valid
  185. * ...
  186. * If bit 14 is set, tx_duration is valid
  187. * If bit 15 is set, all of ack_rssi_chain are valid,
  188. * for each validation of chain, need to check value in field
  189. * If bit 16 is set, tx_timestamp is valid
  190. * If bit 16 is set, sa_ant_matrix is valid
  191. * If bit 17 is set, tid is valid
  192. */
  193. A_UINT32 valid_bitmap;
  194. A_UINT32 ext_valid_bitmap; /* reserved for future extension valid bitmap */
  195. /* ack rssi for each chain */
  196. A_UINT32 ack_rssi_chain0: 8, /* Units: dB w.r.t noise floor, RSSI of Ack of all active chains. Value of 0x80 indicates invalid.*/
  197. ack_rssi_chain1: 8, /* same as above */
  198. ack_rssi_chain2: 8, /* same as above */
  199. ack_rssi_chain3: 8; /* same as above */
  200. A_UINT32 ack_rssi_chain4: 8, /* same as above */
  201. ack_rssi_chain5: 8, /* same as above */
  202. ack_rssi_chain6: 8, /* same as above */
  203. ack_rssi_chain7: 8; /* same as above */
  204. A_UINT32 tx_timestamp; /* HW assigned timestamp with microsecond unit */
  205. A_UINT32 sa_ant_matrix: 8, /* This sa_ant_matrix provides a bitmask of the antennas used while frame transmit */
  206. tid: 8,
  207. reserved_1: 16;
  208. } POSTPACK;
  209. typedef struct {
  210. htt_tlv_hdr_t tlv_hdr;
  211. A_UINT32 number_of_ppdu_stats;
  212. /*
  213. * tx_ppdu_stats_info is filled by multiple struct htt_tx_ppdu_stats_info
  214. * elements.
  215. * tx_ppdu_stats_info is variable length, with length =
  216. * number_of_ppdu_stats * sizeof (struct htt_tx_ppdu_stats_info)
  217. */
  218. struct htt_tx_ppdu_stats_info tx_ppdu_stats_info[1/*number_of_ppdu_stats*/];
  219. } htt_ppdu_stats_usr_common_array_tlv_v;
  220. typedef struct {
  221. htt_tlv_hdr_t tlv_hdr;
  222. union {
  223. /* DEPRECATED (target_type)
  224. * The target_type field is not actually present in the HTT messages
  225. * produced by the FW. However, it cannot be removed (yet), due to
  226. * FW code that refers to this field.
  227. * As a workaround, this target_type field is being moved into a
  228. * union with the "hw" field that actually is present in the message.
  229. * This makes the message definitions become consistent with the
  230. * actual message contents, while not breaking the compilation of
  231. * code that refers to the target_type field.
  232. * Overlaying the memory for "target_type" and "hw" does not cause
  233. * problems, because the FW code that refers to target_type first
  234. * writes a value into the target_type field, then writes data into
  235. * the hw field.
  236. * Once all FW references to the target_type field have been removed,
  237. * the target_type field def and the encapsulating anonymous union
  238. * will be removed from this htt_ppdu_stats_sch_cmd_tlv_v struct def.
  239. */
  240. A_UINT32 target_type;
  241. /*
  242. * The hw portion of this struct contains a scheduler_command_status
  243. * struct, whose definition is different for different target HW types.
  244. */
  245. A_UINT32 hw[1];
  246. };
  247. } htt_ppdu_stats_sch_cmd_tlv_v;
  248. #define HTT_PPDU_STATS_COMMON_TLV_SCH_CMDID_M 0x0000ffff
  249. #define HTT_PPDU_STATS_COMMON_TLV_SCH_CMDID_S 0
  250. #define HTT_PPDU_STATS_COMMON_TLV_SCH_CMDID_GET(_var) \
  251. (((_var) & HTT_PPDU_STATS_COMMON_TLV_SCH_CMDID_M) >> \
  252. HTT_PPDU_STATS_COMMON_TLV_SCH_CMDID_S)
  253. #define HTT_PPDU_STATS_COMMON_TLV_SCH_CMDID_SET(_var, _val) \
  254. do { \
  255. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_SCH_CMDID, _val); \
  256. ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_SCH_CMDID_S)); \
  257. } while (0)
  258. #define HTT_PPDU_STATS_COMMON_TLV_RING_ID_M 0x00ff0000
  259. #define HTT_PPDU_STATS_COMMON_TLV_RING_ID_S 16
  260. #define HTT_PPDU_STATS_COMMON_TLV_RING_ID_GET(_var) \
  261. (((_var) & HTT_PPDU_STATS_COMMON_TLV_RING_ID_M) >> \
  262. HTT_PPDU_STATS_COMMON_TLV_RING_ID_S)
  263. #define HTT_PPDU_STATS_COMMON_TLV_RING_ID_SET(_var, _val) \
  264. do { \
  265. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_RING_ID, _val); \
  266. ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_RING_ID_S)); \
  267. } while (0)
  268. #define HTT_PPDU_STATS_COMMON_TLV_NUM_USERS_M 0xff000000
  269. #define HTT_PPDU_STATS_COMMON_TLV_NUM_USERS_S 24
  270. #define HTT_PPDU_STATS_COMMON_TLV_NUM_USERS_GET(_var) \
  271. (((_var) & HTT_PPDU_STATS_COMMON_TLV_NUM_USERS_M) >> \
  272. HTT_PPDU_STATS_COMMON_TLV_NUM_USERS_S)
  273. #define HTT_PPDU_STATS_COMMON_TLV_NUM_USERS_SET(_var, _val) \
  274. do { \
  275. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_NUM_USERS, _val); \
  276. ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_NUM_USERS_S)); \
  277. } while (0)
  278. /* HW queue type */
  279. enum HTT_TX_QUEUE_TYPE {
  280. HTT_TX_QUEUE_INACTIVE,
  281. HTT_TX_QUEUE_DATA,
  282. HTT_TX_QUEUE_BEACON,
  283. HTT_TX_QUEUE_PSPOLL,
  284. HTT_TX_QUEUE_CAB,
  285. HTT_TX_QUEUE_HALPHY,
  286. HTT_TX_QUEUE_QBOOST_RESP,
  287. HTT_TX_QUEUE_NAN_BEACON,
  288. HTT_TX_QUEUE_NAN_MGMT,
  289. HTT_TX_QUEUE_UL_DATA,
  290. HTT_TX_QUEUE_UL_BSR_RESP,
  291. HTT_TX_QUEUE_MGMT,
  292. HTT_TX_QUEUE_MAX,
  293. };
  294. typedef enum HTT_TX_QUEUE_TYPE HTT_TX_QUEUE_TYPE;
  295. /* frame_type */
  296. enum HTT_STATS_FTYPE {
  297. HTT_STATS_FTYPE_SGEN_NDPA = 0,
  298. HTT_STATS_FTYPE_SGEN_NDP,
  299. HTT_STATS_FTYPE_SGEN_BRP,
  300. HTT_STATS_FTYPE_SGEN_BAR,
  301. HTT_STATS_FTYPE_SGEN_RTS,
  302. HTT_STATS_FTYPE_SGEN_CTS,
  303. HTT_STATS_FTYPE_SGEN_CFEND,
  304. HTT_STATS_FTYPE_SGEN_AX_NDPA,
  305. HTT_STATS_FTYPE_SGEN_AX_NDP,
  306. HTT_STATS_FTYPE_SGEN_MU_TRIG,
  307. HTT_STATS_FTYPE_SGEN_MU_BAR,
  308. HTT_STATS_FTYPE_SGEN_MU_BRP,
  309. HTT_STATS_FTYPE_SGEN_MU_RTS,
  310. HTT_STATS_FTYPE_SGEN_MU_BSR,
  311. HTT_STATS_FTYPE_SGEN_UL_BSR,
  312. HTT_STATS_FTYPE_SGEN_UL_BSR_TRIGGER = HTT_STATS_FTYPE_SGEN_UL_BSR, /*alias*/
  313. HTT_STATS_FTYPE_TIDQ_DATA_SU,
  314. HTT_STATS_FTYPE_TIDQ_DATA_MU,
  315. HTT_STATS_FTYPE_SGEN_UL_BSR_RESP,
  316. HTT_STATS_FTYPE_SGEN_QOS_NULL,
  317. HTT_STATS_FTYPE_MAX,
  318. };
  319. typedef enum HTT_STATS_FTYPE HTT_STATS_FTYPE;
  320. /* FRM_TYPE defined in HTT_STATS_FTYPE */
  321. #define HTT_PPDU_STATS_COMMON_TLV_FRM_TYPE_M 0x000000ff
  322. #define HTT_PPDU_STATS_COMMON_TLV_FRM_TYPE_S 0
  323. #define HTT_PPDU_STATS_COMMON_TLV_FRM_TYPE_GET(_var) \
  324. (((_var) & HTT_PPDU_STATS_COMMON_TLV_FRM_TYPE_M) >> \
  325. HTT_PPDU_STATS_COMMON_TLV_FRM_TYPE_S)
  326. #define HTT_PPDU_STATS_COMMON_TLV_FRM_TYPE_SET(_var, _val) \
  327. do { \
  328. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_FRM_TYPE, _val); \
  329. ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_FRM_TYPE_S)); \
  330. } while (0)
  331. /* QTYPE defined in HTT_TX_QUEUE_TYPE */
  332. #define HTT_PPDU_STATS_COMMON_TLV_QTYPE_M 0x0000ff00
  333. #define HTT_PPDU_STATS_COMMON_TLV_QTYPE_S 8
  334. #define HTT_PPDU_STATS_COMMON_TLV_QTYPE_GET(_var) \
  335. (((_var) & HTT_PPDU_STATS_COMMON_TLV_QTYPE_M) >> \
  336. HTT_PPDU_STATS_COMMON_TLV_QTYPE_S)
  337. #define HTT_PPDU_STATS_COMMON_TLV_QTYPE_SET(_var, _val) \
  338. do { \
  339. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_QTYPE, _val); \
  340. ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_QTYPE_S)); \
  341. } while (0)
  342. enum HTT_PPDU_STATS_BW {
  343. HTT_PPDU_STATS_BANDWIDTH_5MHZ = 0,
  344. HTT_PPDU_STATS_BANDWIDTH_10MHZ = 1,
  345. HTT_PPDU_STATS_BANDWIDTH_20MHZ = 2,
  346. HTT_PPDU_STATS_BANDWIDTH_40MHZ = 3,
  347. HTT_PPDU_STATS_BANDWIDTH_80MHZ = 4,
  348. HTT_PPDU_STATS_BANDWIDTH_160MHZ = 5, /* includes 80+80 */
  349. HTT_PPDU_STATS_BANDWIDTH_DYN = 6,
  350. };
  351. typedef enum HTT_PPDU_STATS_BW HTT_PPDU_STATS_BW;
  352. enum HTT_PPDU_STATS_SEQ_TYPE {
  353. HTT_SEQTYPE_UNSPECIFIED = 0,
  354. HTT_SEQTYPE_SU = 1,
  355. HTT_SEQTYPE_AC_MU_MIMO = 2,
  356. HTT_SEQTYPE_AX_MU_MIMO = 3,
  357. HTT_SEQTYPE_MU_OFDMA = 4,
  358. HTT_SEQTYPE_UL_TRIG = 5,
  359. HTT_SEQTYPE_BURST_BCN = 6,
  360. HTT_SEQTYPE_UL_BSR_RESP = 7,
  361. HTT_SEQTYPE_UL_BSR_TRIG = 8,
  362. HTT_SEQTYPE_UL_RESP = 9,
  363. };
  364. typedef enum HTT_PPDU_STATS_SEQ_TYPE HTT_PPDU_STATS_SEQ_TYPE;
  365. #define HTT_PPDU_STATS_COMMON_TLV_PPDU_SEQ_TYPE_M 0x00ff0000
  366. #define HTT_PPDU_STATS_COMMON_TLV_PPDU_SEQ_TYPE_S 16
  367. #define HTT_PPDU_STATS_COMMON_TLV_PPDU_SEQ_TYPE_GET(_var) \
  368. (((_var) & HTT_PPDU_STATS_COMMON_TLV_PPDU_SEQ_TYPE_M) >> \
  369. HTT_PPDU_STATS_COMMON_TLV_PPDU_SEQ_TYPE_S)
  370. #define HTT_PPDU_STATS_COMMON_TLV_PPDU_SEQ_TYPE_SET(_var, _val) \
  371. do { \
  372. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_PPDU_SEQ_TYPE, _val); \
  373. ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_PPDU_SEQ_TYPE_S)); \
  374. } while (0)
  375. #define HTT_PPDU_STATS_COMMON_TLV_BW_M 0x000f0000
  376. #define HTT_PPDU_STATS_COMMON_TLV_BW_S 16
  377. #define HTT_PPDU_STATS_COMMON_TLV_BW_GET(_var) \
  378. (((_var) & HTT_PPDU_STATS_COMMON_TLV_BW_M) >> \
  379. HTT_PPDU_STATS_COMMON_TLV_BW_S)
  380. #define HTT_PPDU_STATS_COMMON_TLV_BW_SET(_var, _val) \
  381. do { \
  382. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_BW, _val); \
  383. ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_BW_S)); \
  384. } while (0)
  385. #define HTT_PPDU_STATS_COMMON_TLV_PHY_MODE_M 0x0000ffff
  386. #define HTT_PPDU_STATS_COMMON_TLV_PHY_MODE_S 0
  387. #define HTT_PPDU_STATS_COMMON_TLV_PHY_MODE_GET(_var) \
  388. (((_var) & HTT_PPDU_STATS_COMMON_TLV_PHY_MODE_M) >> \
  389. HTT_PPDU_STATS_COMMON_TLV_PHY_MODE_S)
  390. #define HTT_PPDU_STATS_COMMON_TLV_PHY_MODE_SET(_var, _val) \
  391. do { \
  392. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_PHY_MODE, _val); \
  393. ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_PHY_MODE_S)); \
  394. } while (0)
  395. #define HTT_PPDU_STATS_COMMON_TLV_CHAN_MHZ_M 0xffff0000
  396. #define HTT_PPDU_STATS_COMMON_TLV_CHAN_MHZ_S 16
  397. #define HTT_PPDU_STATS_COMMON_TLV_CHAN_MHZ_GET(_var) \
  398. (((_var) & HTT_PPDU_STATS_COMMON_TLV_CHAN_MHZ_M) >> \
  399. HTT_PPDU_STATS_COMMON_TLV_CHAN_MHZ_S)
  400. #define HTT_PPDU_STATS_COMMON_TLV_CHAN_MHZ_SET(_var, _val) \
  401. do { \
  402. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_CHAN_MHZ, _val); \
  403. ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_CHAN_MHZ_S)); \
  404. } while (0)
  405. typedef struct {
  406. htt_tlv_hdr_t tlv_hdr;
  407. A_UINT32 ppdu_id;
  408. /* BIT [ 15 : 0] :- sched_cmdid
  409. * BIT [ 23 : 16] :- ring_id
  410. * BIT [ 31 : 24] :- num_users
  411. */
  412. union {
  413. A_UINT32 ring_id__sched_cmdid;
  414. struct {
  415. A_UINT32 sched_cmdid: 16,
  416. ring_id: 8,
  417. num_users: 8;
  418. };
  419. };
  420. /* BIT [ 7 : 0] :- frame_type - HTT_STATS_FTYPE
  421. * BIT [ 15: 8] :- queue_type - HTT_TX_QUEUE_TYPE
  422. * BIT [ 19: 16] :- bw - HTT_PPDU_STATS_BW
  423. * BIT [ 27: 20] :- ppdu_seq_type - HTT_PPDU_STATS_SEQ_TYPE
  424. * BIT [ 31: 28] :- reserved
  425. */
  426. union {
  427. A_UINT32 bw__queue_type__frame_type;
  428. A_UINT32 ppdu_seq_type__bw__queue_type__frame_type;
  429. struct {
  430. A_UINT32 frame_type: 8,
  431. queue_type: 8,
  432. bw: 4,
  433. ppdu_seq_type: 8,
  434. reserved0: 4;
  435. };
  436. };
  437. A_UINT32 chain_mask;
  438. A_UINT32 fes_duration_us; /* frame exchange sequence */
  439. A_UINT32 ppdu_sch_eval_start_tstmp_us;
  440. A_UINT32 ppdu_sch_end_tstmp_us;
  441. A_UINT32 ppdu_start_tstmp_us;
  442. /* BIT [15 : 0] - phy mode (WLAN_PHY_MODE) with which ppdu was transmitted
  443. * BIT [31 : 16] - bandwidth (in MHz) with which ppdu was transmitted
  444. */
  445. union {
  446. A_UINT32 chan_mhz__phy_mode;
  447. struct {
  448. A_UINT32 phy_mode: 16,
  449. chan_mhz: 16;
  450. };
  451. };
  452. /*
  453. * The cca_delta_time_us reports the time the tx PPDU in question
  454. * was waiting in the HW tx queue for the clear channel assessment
  455. * to indicate that the transmission could start.
  456. * If this CCA delta time is zero or small, this indicates that the
  457. * air interface was unused prior to the transmission, and thus it's
  458. * improbable that there was a collision with some other transceiver's
  459. * transmission.
  460. * In contrast, a large CCA delta time means that this transceiver had
  461. * to wait a long time for the air interface to be available; it's
  462. * possible that other transceivers were also waiting for the air
  463. * interface to become available, and if the other waiting transceiver's
  464. * CW backoff aligned with this one, to have a transmit collision.
  465. */
  466. A_UINT32 cca_delta_time_us;
  467. /*
  468. * The rxfrm_delta_time_us reports the time the tx PPDU in question
  469. * was waiting in the HW tx queue while there was an ongoing rx,
  470. * either because the rx was already ongoing at the time the tx PPDU
  471. * was enqueued, or because the rx (i.e. the peer's tx) won the air
  472. * interface contention over the local vdev's tx.
  473. */
  474. A_UINT32 rxfrm_delta_time_us;
  475. /*
  476. * The txfrm_delta_time_us reports the time from when the tx PPDU
  477. * in question was enqueued into the HW tx queue until the time the
  478. * tx completion interrupt for the PPDU occurred.
  479. * Thus, the txfrm_delta_time_us incorporates any time the tx PPDU
  480. * had to wait for the air interface to become available, the PPDU
  481. * duration, the block ack reception, and the tx completion interrupt
  482. * latency.
  483. */
  484. A_UINT32 txfrm_delta_time_us;
  485. } htt_ppdu_stats_common_tlv;
  486. #define HTT_PPDU_STATS_USER_COMMON_TLV_TID_NUM_M 0x000000ff
  487. #define HTT_PPDU_STATS_USER_COMMON_TLV_TID_NUM_S 0
  488. #define HTT_PPDU_STATS_USER_COMMON_TLV_TID_NUM_GET(_var) \
  489. (((_var) & HTT_PPDU_STATS_USER_COMMON_TLV_TID_NUM_M) >> \
  490. HTT_PPDU_STATS_USER_COMMON_TLV_TID_NUM_S)
  491. #define HTT_PPDU_STATS_USER_COMMON_TLV_TID_NUM_SET(_var, _val) \
  492. do { \
  493. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_COMMON_TLV_TID_NUM, _val); \
  494. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_COMMON_TLV_TID_NUM_S)); \
  495. } while (0)
  496. #define HTT_PPDU_STATS_USER_COMMON_TLV_VAP_ID_M 0x0000ff00
  497. #define HTT_PPDU_STATS_USER_COMMON_TLV_VAP_ID_S 8
  498. #define HTT_PPDU_STATS_USER_COMMON_TLV_VAP_ID_GET(_var) \
  499. (((_var) & HTT_PPDU_STATS_USER_COMMON_TLV_VAP_ID_M) >> \
  500. HTT_PPDU_STATS_USER_COMMON_TLV_VAP_ID_S)
  501. #define HTT_PPDU_STATS_USER_COMMON_TLV_VAP_ID_SET(_var, _val) \
  502. do { \
  503. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_COMMON_TLV_VAP_ID, _val); \
  504. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_COMMON_TLV_VAP_ID_S)); \
  505. } while (0)
  506. #define HTT_PPDU_STATS_USER_COMMON_TLV_SW_PEER_ID_M 0xffff0000
  507. #define HTT_PPDU_STATS_USER_COMMON_TLV_SW_PEER_ID_S 16
  508. #define HTT_PPDU_STATS_USER_COMMON_TLV_SW_PEER_ID_GET(_var) \
  509. (((_var) & HTT_PPDU_STATS_USER_COMMON_TLV_SW_PEER_ID_M) >> \
  510. HTT_PPDU_STATS_USER_COMMON_TLV_SW_PEER_ID_S)
  511. #define HTT_PPDU_STATS_USER_COMMON_TLV_SW_PEER_ID_SET(_var, _val) \
  512. do { \
  513. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_COMMON_TLV_SW_PEER_ID, _val); \
  514. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_COMMON_TLV_SW_PEER_ID_S)); \
  515. } while (0)
  516. #define HTT_PPDU_STATS_USER_COMMON_TLV_MCAST_M 0x00000001
  517. #define HTT_PPDU_STATS_USER_COMMON_TLV_MCAST_S 0
  518. #define HTT_PPDU_STATS_USER_COMMON_TLV_MCAST_GET(_var) \
  519. (((_var) & HTT_PPDU_STATS_USER_COMMON_TLV_MCAST_M) >> \
  520. HTT_PPDU_STATS_USER_COMMON_TLV_MCAST_S)
  521. #define HTT_PPDU_STATS_USER_COMMON_TLV_MCAST_SET(_var, _val) \
  522. do { \
  523. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_COMMON_TLV_MCAST, _val); \
  524. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_COMMON_TLV_MCAST_S)); \
  525. } while (0)
  526. #define HTT_PPDU_STATS_USER_COMMON_TLV_MPDUS_TRIED_M 0x000003fe
  527. #define HTT_PPDU_STATS_USER_COMMON_TLV_MPDUS_TRIED_S 1
  528. #define HTT_PPDU_STATS_USER_COMMON_TLV_MPDUS_TRIED_GET(_var) \
  529. (((_var) & HTT_PPDU_STATS_USER_COMMON_TLV_MPDUS_TRIED_M) >> \
  530. HTT_PPDU_STATS_USER_COMMON_TLV_MPDUS_TRIED_S)
  531. #define HTT_PPDU_STATS_USER_COMMON_TLV_MPDUS_TRIED_SET(_var, _val) \
  532. do { \
  533. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_COMMON_TLV_MPDUS_TRIED, _val); \
  534. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_COMMON_TLV_MPDUS_TRIED_S)); \
  535. } while (0)
  536. #define HTT_PPDU_STATS_USER_COMMON_TLV_BW_M 0x00003c00
  537. #define HTT_PPDU_STATS_USER_COMMON_TLV_BW_S 10
  538. #define HTT_PPDU_STATS_USER_COMMON_TLV_BW_GET(_var) \
  539. (((_var) & HTT_PPDU_STATS_USER_COMMON_TLV_BW_M) >> \
  540. HTT_PPDU_STATS_USER_COMMON_TLV_BW_S)
  541. #define HTT_PPDU_STATS_USER_COMMON_TLV_BW_SET(_var, _val) \
  542. do { \
  543. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_COMMON_TLV_BW, _val); \
  544. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_COMMON_TLV_BW_S)); \
  545. } while (0)
  546. #define HTT_PPDU_STATS_USER_COMMON_TLV_DELAYED_BA_M 0x00004000
  547. #define HTT_PPDU_STATS_USER_COMMON_TLV_DELAYED_BA_S 14
  548. #define HTT_PPDU_STATS_USER_COMMON_TLV_DELAYED_BA_GET(_var) \
  549. (((_var) & HTT_PPDU_STATS_USER_COMMON_TLV_DELAYED_BA_M) >> \
  550. HTT_PPDU_STATS_USER_COMMON_TLV_DELAYED_BA_S)
  551. #define HTT_PPDU_STATS_USER_COMMON_TLV_DELAYED_BA_SET(_var, _val) \
  552. do { \
  553. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_COMMON_TLV_DELAYED_BA, _val); \
  554. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_COMMON_TLV_DELAYED_BA_S)); \
  555. } while (0)
  556. #define HTT_PPDU_STATS_USER_COMMON_TLV_FRAME_CTRL_M 0x0000ffff
  557. #define HTT_PPDU_STATS_USER_COMMON_TLV_FRAME_CTRL_S 0
  558. #define HTT_PPDU_STATS_USER_COMMON_TLV_FRAME_CTRL_GET(_var) \
  559. (((_var) & HTT_PPDU_STATS_USER_COMMON_TLV_FRAME_CTRL_M) >> \
  560. HTT_PPDU_STATS_USER_COMMON_TLV_FRAME_CTRL_S)
  561. #define HTT_PPDU_STATS_USER_COMMON_TLV_FRAME_CTRL_SET(_var, _val) \
  562. do { \
  563. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_COMMON_TLV_FRAME_CTRL, _val); \
  564. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_COMMON_TLV_FRAME_CTRL_S)); \
  565. } while (0)
  566. #define HTT_PPDU_STATS_USER_COMMON_TLV_QOS_CTRL_M 0xffff0000
  567. #define HTT_PPDU_STATS_USER_COMMON_TLV_QOS_CTRL_S 16
  568. #define HTT_PPDU_STATS_USER_COMMON_TLV_QOS_CTRL_GET(_var) \
  569. (((_var) & HTT_PPDU_STATS_USER_COMMON_TLV_QOS_CTRL_M) >> \
  570. HTT_PPDU_STATS_USER_COMMON_TLV_QOS_CTRL_S)
  571. #define HTT_PPDU_STATS_USER_COMMON_TLV_QOS_CTRL_SET(_var, _val) \
  572. do { \
  573. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_COMMON_TLV_QOS_CTRL, _val); \
  574. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_COMMON_TLV_QOS_CTRL_S)); \
  575. } while (0)
  576. typedef struct {
  577. htt_tlv_hdr_t tlv_hdr;
  578. /* BIT [ 7 : 0] :- tid_num
  579. * BIT [ 15: 8] :- vap_id
  580. * BIT [ 31: 16] :- sw_peer_id
  581. */
  582. union {
  583. A_UINT32 sw_peer_id__vapid__tid_num;
  584. struct {
  585. A_UINT32 tid_num: 8,
  586. vap_id: 8,
  587. sw_peer_id: 16;
  588. };
  589. };
  590. /* BIT [ 0 : 0] :- mcast
  591. * BIT [ 9 : 1] :- mpdus_tried
  592. * BIT [ 13: 10] :- bw - HTT_PPDU_STATS_BW
  593. * BIT [ 14: 14] : - delayed_ba
  594. * BIT [ 31: 15] :- rsvd
  595. */
  596. union {
  597. A_UINT32 bw__mpdus_tried__mcast;
  598. struct {
  599. A_UINT32 mcast: 1,
  600. mpdus_tried: 9,
  601. bw: 4,
  602. delayed_ba: 1,
  603. reserved0: 17;
  604. };
  605. };
  606. /* BIT [ 15: 0] :- frame_ctrl
  607. * BIT [ 31: 16] :- qos_ctrl
  608. */
  609. union {
  610. A_UINT32 qos_ctrl_frame_ctrl;
  611. struct {
  612. A_UINT32 frame_ctrl: 16,
  613. qos_ctrl: 16;
  614. };
  615. };
  616. /*
  617. * Data fields containing the physical address info of a MSDU buffer
  618. * as well as the owner and a SW cookie info that can be used by the host
  619. * to look up the virtual address of the MSDU buffer.
  620. * These fields are only valid if is_buffer_addr_info_valid is set to 1.
  621. */
  622. A_UINT32 buffer_paddr_31_0 : 32;
  623. A_UINT32 buffer_paddr_39_32 : 8,
  624. return_buffer_manager : 3,
  625. sw_buffer_cookie : 21;
  626. /*
  627. * host_opaque_cookie : Host can send upto 2 bytes of opaque
  628. * cookie in TCL_DATA_CMD and FW will replay this back in
  629. * HTT PPDU stats. Valid only if sent to FW through
  630. * exception mechanism.
  631. *
  632. * is_standalone : This msdu was sent as a single MSDU/MPDU
  633. * PPDU as indicated by host via TCL_DATA_CMD using
  634. * the send_as_standalone bit.
  635. *
  636. * is_buffer_addr_info_valid : This will be set whenever a MSDU is sent as
  637. * a singleton (single-MSDU PPDU) for FW use-cases or as indicated by host
  638. * via send_as_standalone in TCL_DATA_CMD.
  639. */
  640. A_UINT32 host_opaque_cookie: 16,
  641. is_host_opaque_valid: 1,
  642. is_standalone: 1,
  643. is_buffer_addr_info_valid: 1,
  644. reserved1: 13;
  645. } htt_ppdu_stats_user_common_tlv;
  646. #define HTT_PPDU_STATS_USER_RATE_TLV_TID_NUM_M 0x000000ff
  647. #define HTT_PPDU_STATS_USER_RATE_TLV_TID_NUM_S 0
  648. #define HTT_PPDU_STATS_USER_RATE_TLV_TID_NUM_GET(_var) \
  649. (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_TID_NUM_M) >> \
  650. HTT_PPDU_STATS_USER_RATE_TLV_TID_NUM_S)
  651. #define HTT_PPDU_STATS_USER_RATE_TLV_TID_NUM_SET(_var, _val) \
  652. do { \
  653. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_TID_NUM, _val); \
  654. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_TID_NUM_S)); \
  655. } while (0)
  656. #define HTT_PPDU_STATS_USER_RATE_TLV_RESERVED_M 0x0000ff00
  657. #define HTT_PPDU_STATS_USER_RATE_TLV_RESERVED_S 8
  658. #define HTT_PPDU_STATS_USER_RATE_TLV_SW_PEER_ID_M 0xffff0000
  659. #define HTT_PPDU_STATS_USER_RATE_TLV_SW_PEER_ID_S 16
  660. #define HTT_PPDU_STATS_USER_RATE_TLV_SW_PEER_ID_GET(_var) \
  661. (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_SW_PEER_ID_M) >> \
  662. HTT_PPDU_STATS_USER_RATE_TLV_SW_PEER_ID_S)
  663. #define HTT_PPDU_STATS_USER_RATE_TLV_SW_PEER_ID_SET(_var, _val) \
  664. do { \
  665. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_SW_PEER_ID, _val); \
  666. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_SW_PEER_ID_S)); \
  667. } while (0)
  668. #define HTT_PPDU_STATS_USER_RATE_TLV_USER_POS_M 0x0000000f
  669. #define HTT_PPDU_STATS_USER_RATE_TLV_USER_POS_S 0
  670. #define HTT_PPDU_STATS_USER_RATE_TLV_USER_POS_GET(_var) \
  671. (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_USER_POS_M) >> \
  672. HTT_PPDU_STATS_USER_RATE_TLV_USER_POS_S)
  673. #define HTT_PPDU_STATS_USER_RATE_TLV_USER_POS_SET(_var, _val) \
  674. do { \
  675. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_USER_POS, _val); \
  676. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_USER_POS_S)); \
  677. } while (0)
  678. #define HTT_PPDU_STATS_USER_RATE_TLV_MU_GROUPID_M 0x00000ff0
  679. #define HTT_PPDU_STATS_USER_RATE_TLV_MU_GROUPID_S 4
  680. #define HTT_PPDU_STATS_USER_RATE_TLV_MU_GROUPID_GET(_var) \
  681. (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_MU_GROUPID_M) >> \
  682. HTT_PPDU_STATS_USER_RATE_TLV_MU_GROUPID_S)
  683. #define HTT_PPDU_STATS_USER_RATE_TLV_MU_GROUPID_SET(_var, _val) \
  684. do { \
  685. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_MU_GROUPID, _val); \
  686. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_MU_GROUPID_S)); \
  687. } while (0)
  688. #define HTT_PPDU_STATS_USER_RATE_TLV_RU_END_M 0x0000ffff
  689. #define HTT_PPDU_STATS_USER_RATE_TLV_RU_END_S 0
  690. #define HTT_PPDU_STATS_USER_RATE_TLV_RU_END_GET(_var) \
  691. (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_RU_END_M) >> \
  692. HTT_PPDU_STATS_USER_RATE_TLV_RU_END_S)
  693. #define HTT_PPDU_STATS_USER_RATE_TLV_RU_END_SET(_var, _val) \
  694. do { \
  695. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_RU_END, _val); \
  696. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_RU_END_S)); \
  697. } while (0)
  698. #define HTT_PPDU_STATS_USER_RATE_TLV_RU_START_M 0xffff0000
  699. #define HTT_PPDU_STATS_USER_RATE_TLV_RU_START_S 16
  700. #define HTT_PPDU_STATS_USER_RATE_TLV_RU_START_GET(_var) \
  701. (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_RU_START_M) >> \
  702. HTT_PPDU_STATS_USER_RATE_TLV_RU_START_S)
  703. #define HTT_PPDU_STATS_USER_RATE_TLV_RU_START_SET(_var, _val) \
  704. do { \
  705. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_RU_START, _val); \
  706. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_RU_START_S)); \
  707. } while (0)
  708. #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_TYPE_VALID_M 0x00000001
  709. #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_TYPE_VALID_S 0
  710. #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_TYPE_VALID_GET(_var) \
  711. (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_RESP_TYPE_VALID_M) >> \
  712. HTT_PPDU_STATS_USER_RATE_TLV_RESP_TYPE_VALID_S)
  713. #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_TYPE_VALID_SET(_var, _val) \
  714. do { \
  715. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_RESP_TYPE_VALID, _val); \
  716. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_RESP_TYPE_VALID_S)); \
  717. } while (0)
  718. #define HTT_PPDU_STATS_BUF_ADDR_39_32_M 0x000000ff
  719. #define HTT_PPDU_STATS_BUF_ADDR_39_32_S 0
  720. #define HTT_PPDU_STATS_BUF_ADDR_39_32__GET(_var) \
  721. (((_var) & HTT_PPDU_STATS_BUF_ADDR_39_32_M) >> \
  722. HTT_PPDU_STATS_BUF_ADDR_39_32_S)
  723. #define HTT_PPDU_STATS_BUF_ADDR_39_32_SET(_var, _val) \
  724. do { \
  725. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_BUF_ADDR_39_32, _val); \
  726. ((_var) |= ((_val) << HTT_PPDU_STATS_BUF_ADDR_39_32_S)); \
  727. } while (0)
  728. #define HTT_PPDU_STATS_RETURN_BUF_MANAGER_M 0x00000700
  729. #define HTT_PPDU_STATS_RETURN_BUF_MANAGER_S 8
  730. #define HTT_PPDU_STATS_RETURN_BUF_MANAGER_GET(_var) \
  731. (((_var) & HTT_PPDU_STATS_RETURN_BUF_MANAGER_M) >> \
  732. HTT_PPDU_STATS_RETURN_BUF_MANAGER_S)
  733. #define HTT_PPDU_STATS_RETURN_BUF_MANAGER_SET(_var, _val) \
  734. do { \
  735. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_RETURN_BUF_MANAGER, _val); \
  736. ((_var) |= ((_val) << HTT_PPDU_STATS_RETURN_BUF_MANAGER_S)); \
  737. } while (0)
  738. #define HTT_PPDU_STATS_SW_BUFFER_COOKIE_M 0xfffff800
  739. #define HTT_PPDU_STATS_SW_BUFFER_COOKIE_S 11
  740. #define HTT_PPDU_STATS_SW_BUFFER_COOKIE_GET(_var) \
  741. (((_var) & HTT_PPDU_STATS_SW_BUFFER_COOKIE_M) >> \
  742. HTT_PPDU_STATS_SW_BUFFER_COOKIE_S)
  743. #define HTT_PPDU_STATS_SW_BUFFER_COOKIE_SET(_var, _val) \
  744. do { \
  745. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_SW_BUFFER_COOKIE, _val); \
  746. ((_var) |= ((_val) << HTT_PPDU_STATS_SW_BUFFER_COOKIE_S)); \
  747. } while (0)
  748. #define HTT_PPDU_STATS_HOST_OPAQUE_COOKIE_M 0x0000FFFF
  749. #define HTT_PPDU_STATS_HOST_OPAQUE_COOKIE_S 0
  750. #define HTT_PPDU_STATS_HOST_OPAQUE_COOKIE_GET(_var) \
  751. (((_var) & HTT_PPDU_STATS_HOST_OPAQUE_COOKIE_M) >> \
  752. HTT_PPDU_STATS_HOST_OPAQUE_COOKIE_S)
  753. #define HTT_PPDU_STAT_HOST_OPAQUE_COOKIE_SET(_var, _val) \
  754. do { \
  755. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_HOST_OPAQUE_COOKIE, _val); \
  756. ((_var) |= ((_val) << HTT_PPDU_STATS_HOST_OPAQUE_COOKIE_S)); \
  757. } while (0)
  758. #define HTT_PPDU_STATS_IS_OPAQUE_VALID_M 0x00010000
  759. #define HTT_PPDU_STATS_IS_OPAQUE_VALID_S 16
  760. #define HTT_PPDU_STATS_IS_OPAQUE_VALID_GET(_var) \
  761. (((_var) & HTT_PPDU_STATS_IS_OPAQUE_VALID_M) >> \
  762. HTT_PPDU_STATS_IS_OPAQUE_VALID_S)
  763. #define HTT_PPDU_STATS_IS_OPAQUE_VALID_SET(_var, _val) \
  764. do { \
  765. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_IS_OPAQUE_VALID, _val); \
  766. ((_var) |= ((_val) << HTT_PPDU_STATS_IS_OPAQUE_VALID_S)); \
  767. } while (0)
  768. #define HTT_PPDU_STATS_IS_STANDALONE_M 0x00020000
  769. #define HTT_PPDU_STATS_IS_STANDALONE_S 17
  770. #define HTT_PPDU_STATS_IS_STANDALONE_GET(_var) \
  771. (((_var) & HTT_PPDU_STATS_IS_STANDALONE_M) >> \
  772. HTT_PPDU_STATS_IS_OPAQUE_VALID_S)
  773. #define HTT_PPDU_STATS_IS_STANDALONE_SET(_var, _val) \
  774. do { \
  775. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_IS_STANDALONE, _val); \
  776. ((_var) |= ((_val) << HTT_PPDU_STATS_IS_STANDALONE_S)); \
  777. } while (0)
  778. #define HTT_PPDU_STATS_IS_BUFF_INFO_VALID_M 0x000400000
  779. #define HTT_PPDU_STATS_IS_BUFF_INFO_VALID_S 18
  780. #define HTT_PPDU_STATS_IS_BUFF_INFO_VALID_GET(_var) \
  781. (((_var) & HTT_PPDU_STATS_IS_BUFF_INFO_VALID_M) >> \
  782. HTT_PPDU_STATS_IS_BUFF_INFO_VALID_S)
  783. #define HTT_PPDU_STATS_IS_BUFF_INFO_VALID_SET(_var, _val) \
  784. do { \
  785. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_IS_BUFF_INFO_VALID, _val); \
  786. ((_var) |= ((_val) << HTT_PPDU_STATS_IS_BUFF_INFO_VALID_S)); \
  787. } while (0)
  788. enum HTT_PPDU_STATS_PPDU_TYPE {
  789. HTT_PPDU_STATS_PPDU_TYPE_SU,
  790. HTT_PPDU_STATS_PPDU_TYPE_MU_MIMO,
  791. HTT_PPDU_STATS_PPDU_TYPE_MU_OFDMA,
  792. HTT_PPDU_STATS_PPDU_TYPE_MU_MIMO_OFDMA,
  793. HTT_PPDU_STATS_PPDU_TYPE_UL_TRIG,
  794. HTT_PPDU_STATS_PPDU_TYPE_BURST_BCN,
  795. HTT_PPDU_STATS_PPDU_TYPE_UL_BSR_RESP,
  796. HTT_PPDU_STATS_PPDU_TYPE_UL_BSR_TRIG,
  797. HTT_PPDU_STATS_PPDU_TYPE_UL_RESP,
  798. HTT_PPDU_STATS_PPDU_TYPE_UNKNOWN = 0x1F,
  799. };
  800. typedef enum HTT_PPDU_STATS_PPDU_TYPE HTT_PPDU_STATS_PPDU_TYPE;
  801. #define HTT_PPDU_STATS_USER_RATE_TLV_PPDU_TYPE_M 0x0000003E
  802. #define HTT_PPDU_STATS_USER_RATE_TLV_PPDU_TYPE_S 1
  803. #define HTT_PPDU_STATS_USER_RATE_TLV_PPDU_TYPE_GET(_var) \
  804. (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_PPDU_TYPE_M) >> \
  805. HTT_PPDU_STATS_USER_RATE_TLV_PPDU_TYPE_S)
  806. #define HTT_PPDU_STATS_USER_RATE_TLV_PPDU_TYPE_SET(_var, _val) \
  807. do { \
  808. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_PPDU_TYPE, _val); \
  809. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_PPDU_TYPE_S)); \
  810. } while (0)
  811. enum HTT_PPDU_STATS_TXBF_TYPE {
  812. HTT_PPDU_STATS_TXBF_OPEN_LOOP,
  813. HTT_PPDU_STATS_TXBF_IMPLICIT,
  814. HTT_PPDU_STATS_TXBF_EXPLICIT,
  815. HTT_PPDU_STATS_TXBF_MAX,
  816. };
  817. #define HTT_PPDU_STATS_USER_RATE_TLV_LTF_SIZE_M 0x00000003
  818. #define HTT_PPDU_STATS_USER_RATE_TLV_LTF_SIZE_S 0
  819. #define HTT_PPDU_STATS_USER_RATE_TLV_LTF_SIZE_GET(_var) \
  820. (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_LTF_SIZE_M) >> \
  821. HTT_PPDU_STATS_USER_RATE_TLV_LTF_SIZE_S)
  822. #define HTT_PPDU_STATS_USER_RATE_TLV_LTF_SIZE_SET(_var, _val) \
  823. do { \
  824. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_LTF_SIZE, _val); \
  825. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_LTF_SIZE_S)); \
  826. } while (0)
  827. #define HTT_PPDU_STATS_USER_RATE_TLV_STBC_M 0x00000004
  828. #define HTT_PPDU_STATS_USER_RATE_TLV_STBC_S 2
  829. #define HTT_PPDU_STATS_USER_RATE_TLV_STBC_GET(_var) \
  830. (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_STBC_M) >> \
  831. HTT_PPDU_STATS_USER_RATE_TLV_STBC_S)
  832. #define HTT_PPDU_STATS_USER_RATE_TLV_STBC_SET(_var, _val) \
  833. do { \
  834. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_STBC, _val); \
  835. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_STBC_S)); \
  836. } while (0)
  837. #define HTT_PPDU_STATS_USER_RATE_TLV_HE_RE_M 0x00000008
  838. #define HTT_PPDU_STATS_USER_RATE_TLV_HE_RE_S 3
  839. #define HTT_PPDU_STATS_USER_RATE_TLV_HE_RE_GET(_var) \
  840. (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_HE_RE_M) >> \
  841. HTT_PPDU_STATS_USER_RATE_TLV_HE_RE_S)
  842. #define HTT_PPDU_STATS_USER_RATE_TLV_HE_RE_SET(_var, _val) \
  843. do { \
  844. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_HE_RE, _val); \
  845. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_HE_RE_S)); \
  846. } while (0)
  847. #define HTT_PPDU_STATS_USER_RATE_TLV_TXBF_M 0x000000f0
  848. #define HTT_PPDU_STATS_USER_RATE_TLV_TXBF_S 4
  849. #define HTT_PPDU_STATS_USER_RATE_TLV_TXBF_GET(_var) \
  850. (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_TXBF_M) >> \
  851. HTT_PPDU_STATS_USER_RATE_TLV_TXBF_S)
  852. #define HTT_PPDU_STATS_USER_RATE_TLV_TXBF_SET(_var, _val) \
  853. do { \
  854. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_TXBF, _val); \
  855. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_TXBF_S)); \
  856. } while (0)
  857. #define HTT_PPDU_STATS_USER_RATE_TLV_BW_M 0x00000f00
  858. #define HTT_PPDU_STATS_USER_RATE_TLV_BW_S 8
  859. #define HTT_PPDU_STATS_USER_RATE_TLV_BW_GET(_var) \
  860. (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_BW_M) >> \
  861. HTT_PPDU_STATS_USER_RATE_TLV_BW_S)
  862. #define HTT_PPDU_STATS_USER_RATE_TLV_BW_SET(_var, _val) \
  863. do { \
  864. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_BW, _val); \
  865. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_BW_S)); \
  866. } while (0)
  867. #define HTT_PPDU_STATS_USER_RATE_TLV_NSS_M 0x0000f000
  868. #define HTT_PPDU_STATS_USER_RATE_TLV_NSS_S 12
  869. #define HTT_PPDU_STATS_USER_RATE_TLV_NSS_GET(_var) \
  870. (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_NSS_M) >> \
  871. HTT_PPDU_STATS_USER_RATE_TLV_NSS_S)
  872. #define HTT_PPDU_STATS_USER_RATE_TLV_NSS_SET(_var, _val) \
  873. do { \
  874. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_NSS, _val); \
  875. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_NSS_S)); \
  876. } while (0)
  877. #define HTT_PPDU_STATS_USER_RATE_TLV_MCS_M 0x000f0000
  878. #define HTT_PPDU_STATS_USER_RATE_TLV_MCS_S 16
  879. #define HTT_PPDU_STATS_USER_RATE_TLV_MCS_GET(_var) \
  880. (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_MCS_M) >> \
  881. HTT_PPDU_STATS_USER_RATE_TLV_MCS_S)
  882. #define HTT_PPDU_STATS_USER_RATE_TLV_MCS_SET(_var, _val) \
  883. do { \
  884. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_MCS, _val); \
  885. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_MCS_S)); \
  886. } while (0)
  887. /* Refer HTT_STATS_PREAM_TYPE */
  888. #define HTT_PPDU_STATS_USER_RATE_TLV_PREAMBLE_M 0x00f00000
  889. #define HTT_PPDU_STATS_USER_RATE_TLV_PREAMBLE_S 20
  890. #define HTT_PPDU_STATS_USER_RATE_TLV_PREAMBLE_GET(_var) \
  891. (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_PREAMBLE_M) >> \
  892. HTT_PPDU_STATS_USER_RATE_TLV_PREAMBLE_S)
  893. #define HTT_PPDU_STATS_USER_RATE_TLV_PREAMBLE_SET(_var, _val) \
  894. do { \
  895. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_PREAMBLE, _val); \
  896. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_PREAMBLE_S)); \
  897. } while (0)
  898. /* Guard Intervals */
  899. enum HTT_PPDU_STATS_GI {
  900. HTT_PPDU_STATS_GI_800,
  901. HTT_PPDU_STATS_GI_400,
  902. HTT_PPDU_STATS_GI_1600,
  903. HTT_PPDU_STATS_GI_3200,
  904. HTT_PPDU_STATS_GI_CNT,
  905. };
  906. typedef enum HTT_PPDU_STATS_GI HTT_PPDU_STATS_GI;
  907. /* Refer HTT_PPDU_STATS_GI */
  908. #define HTT_PPDU_STATS_USER_RATE_TLV_GI_M 0x0f000000
  909. #define HTT_PPDU_STATS_USER_RATE_TLV_GI_S 24
  910. #define HTT_PPDU_STATS_USER_RATE_TLV_GI_GET(_var) \
  911. (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_GI_M) >> \
  912. HTT_PPDU_STATS_USER_RATE_TLV_GI_S)
  913. #define HTT_PPDU_STATS_USER_RATE_TLV_GI_SET(_var, _val) \
  914. do { \
  915. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_GI, _val); \
  916. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_GI_S)); \
  917. } while (0)
  918. #define HTT_PPDU_STATS_USER_RATE_TLV_DCM_M 0x10000000
  919. #define HTT_PPDU_STATS_USER_RATE_TLV_DCM_S 28
  920. #define HTT_PPDU_STATS_USER_RATE_TLV_DCM_GET(_var) \
  921. (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_DCM_M) >> \
  922. HTT_PPDU_STATS_USER_RATE_TLV_DCM_S)
  923. #define HTT_PPDU_STATS_USER_RATE_TLV_DCM_SET(_var, _val) \
  924. do { \
  925. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_DCM, _val); \
  926. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_DCM_S)); \
  927. } while (0)
  928. #define HTT_PPDU_STATS_USER_RATE_TLV_LDPC_M 0x20000000
  929. #define HTT_PPDU_STATS_USER_RATE_TLV_LDPC_S 29
  930. #define HTT_PPDU_STATS_USER_RATE_TLV_LDPC_GET(_var) \
  931. (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_LDPC_M) >> \
  932. HTT_PPDU_STATS_USER_RATE_TLV_LDPC_S)
  933. #define HTT_PPDU_STATS_USER_RATE_TLV_LDPC_SET(_var, _val) \
  934. do { \
  935. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_LDPC, _val); \
  936. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_LDPC_S)); \
  937. } while (0)
  938. enum HTT_PPDU_STATS_RESP_PPDU_TYPE {
  939. HTT_PPDU_STATS_RESP_PPDU_TYPE_MU_MIMO_UL,
  940. HTT_PPDU_STATS_RESP_PPDU_TYPE_MU_OFDMA_UL,
  941. };
  942. typedef enum HTT_PPDU_STATS_RESP_PPDU_TYPE HTT_PPDU_STATS_RESP_PPDU_TYPE;
  943. #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_PPDU_TYPE_M 0xC0000000
  944. #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_PPDU_TYPE_S 30
  945. #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_PPDU_TYPE_GET(_var) \
  946. (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_RESP_PPDU_TYPE_M) >> \
  947. HTT_PPDU_STATS_USER_RATE_TLV_RESP_PPDU_TYPE_S)
  948. #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_PPDU_TYPE_SET(_var, _val) \
  949. do { \
  950. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_RESP_PPDU_TYPE, _val); \
  951. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_RESP_PPDU_TYPE_S)); \
  952. } while (0)
  953. typedef struct {
  954. htt_tlv_hdr_t tlv_hdr;
  955. /* BIT [ 7 : 0] :- tid_num
  956. * BIT [ 15: 8] :- reserved0
  957. * BIT [ 31: 16] :- sw_peer_id
  958. */
  959. union {
  960. A_UINT32 sw_peer_id__tid_num;
  961. struct {
  962. A_UINT32 tid_num: 8,
  963. reserved0: 8,
  964. sw_peer_id: 16;
  965. };
  966. };
  967. /* BIT [ 3 : 0] :- user_pos
  968. * BIT [ 11: 4] :- mu_group_id
  969. * BIT [ 31: 12] :- reserved1
  970. */
  971. union {
  972. A_UINT32 mu_group_id__user_pos;
  973. struct {
  974. A_UINT32 user_pos: 4,
  975. mu_group_id: 8,
  976. reserved1: 20;
  977. };
  978. };
  979. /* BIT [ 15 : 0] :- ru_end
  980. * BIT [ 31 : 16] :- ru_start
  981. */
  982. union {
  983. A_UINT32 ru_start__ru_end;
  984. struct {
  985. A_UINT32 ru_end: 16,
  986. ru_start: 16;
  987. };
  988. };
  989. /* BIT [ 15 : 0] :- ru_end
  990. * BIT [ 31 : 16] :- ru_start
  991. */
  992. union {
  993. A_UINT32 resp_ru_start__ru_end;
  994. struct {
  995. A_UINT32 resp_ru_end: 16,
  996. resp_ru_start: 16;
  997. };
  998. };
  999. /* BIT [ 0 : 0 ] :- resp_type_valid
  1000. * BIT [ 5 : 1 ] :- ppdu_type - HTT_PPDU_STAT_PPDU_TYPE
  1001. * BIT [ 31: 6 ] :- reserved2
  1002. */
  1003. union {
  1004. A_UINT32 resp_type_vld_ppdu_type;
  1005. struct {
  1006. A_UINT32 resp_type_vld: 1,
  1007. ppdu_type: 5,
  1008. reserved2: 26;
  1009. };
  1010. };
  1011. /* BIT [ 1 : 0 ] :- ltf_size
  1012. * BIT [ 2 : 2 ] :- stbc
  1013. * BIT [ 3 : 3 ] :- he_re (range extension)
  1014. * BIT [ 7 : 4 ] :- txbf
  1015. * BIT [ 11: 8 ] :- bw
  1016. * BIT [ 15: 12] :- nss NSS 1,2, ...8
  1017. * BIT [ 19: 16] :- mcs
  1018. * BIT [ 23: 20] :- preamble
  1019. * BIT [ 27: 24] :- gi - HTT_PPDU_STATS_GI
  1020. * BIT [ 28: 28] :- dcm
  1021. * BIT [ 29: 29] :- ldpc
  1022. * BIT [ 31: 30] :- reserved4
  1023. */
  1024. union {
  1025. A_UINT32 rate_info;
  1026. struct {
  1027. A_UINT32 ltf_size: 2,
  1028. stbc: 1,
  1029. he_re: 1,
  1030. txbf: 4,
  1031. bw: 4,
  1032. nss: 4,
  1033. mcs: 4,
  1034. preamble: 4,
  1035. gi: 4,
  1036. dcm: 1,
  1037. ldpc: 1,
  1038. reserved4: 2;
  1039. };
  1040. };
  1041. /* Note: resp_rate_info is only valid for if resp_type is UL
  1042. * BIT [ 1 : 0 ] :- ltf_size
  1043. * BIT [ 2 : 2 ] :- stbc
  1044. * BIT [ 3 : 3 ] :- he_re (range extension)
  1045. * BIT [ 7 : 4 ] :- reserved3
  1046. * BIT [ 11: 8 ] :- bw
  1047. * BIT [ 15: 12] :- nss NSS 1,2, ...8
  1048. * BIT [ 19: 16] :- mcs
  1049. * BIT [ 23: 20] :- preamble
  1050. * BIT [ 27: 24] :- gi
  1051. * BIT [ 28: 28] :- dcm
  1052. * BIT [ 29: 29] :- ldpc
  1053. * BIT [ 31: 30] :- resp_ppdu_type - HTT_PPDU_STATS_RESP_PPDU_TYPE
  1054. */
  1055. union {
  1056. A_UINT32 resp_rate_info;
  1057. struct {
  1058. A_UINT32 resp_ltf_size: 2,
  1059. resp_stbc: 1,
  1060. resp_he_re: 1,
  1061. reserved3: 4,
  1062. resp_bw: 4,
  1063. resp_nss: 4,
  1064. resp_mcs: 4,
  1065. resp_preamble: 4,
  1066. resp_gi: 4,
  1067. resp_dcm: 1,
  1068. resp_ldpc: 1,
  1069. resp_ppdu_type: 2;
  1070. };
  1071. };
  1072. } htt_ppdu_stats_user_rate_tlv;
  1073. #define HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_TID_NUM_M 0x000000ff
  1074. #define HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_TID_NUM_S 0
  1075. #define HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_TID_NUM_GET(_var) \
  1076. (((_var) & HTT_PPDU_STATS_EMQ_MPDU_BITMAP_TLV_TID_NUM_M) >> \
  1077. HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_TID_NUM_S)
  1078. #define HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_TID_NUM_SET(_var, _val) \
  1079. do { \
  1080. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_TID_NUM, _val); \
  1081. ((_var) |= ((_val) << HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_TID_NUM_S)); \
  1082. } while (0)
  1083. #define HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_RESERVED_M 0x0000ff00
  1084. #define HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_RESERVED_S 8
  1085. #define HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_SW_PEER_ID_M 0xffff0000
  1086. #define HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_SW_PEER_ID_S 16
  1087. #define HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_SW_PEER_ID_GET(_var) \
  1088. (((_var) & HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_SW_PEER_ID_M) >> \
  1089. HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_SW_PEER_ID_S)
  1090. #define HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_SW_PEER_ID_SET(_var, _val) \
  1091. do { \
  1092. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_SW_PEER_ID, _val); \
  1093. ((_var) |= ((_val) << HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_SW_PEER_ID_S)); \
  1094. } while (0)
  1095. typedef struct {
  1096. htt_tlv_hdr_t tlv_hdr;
  1097. /* BIT [ 7 : 0] :- tid_num
  1098. * BIT [ 15: 8] :- reserved0
  1099. * BIT [ 31: 16] :- sw_peer_id
  1100. */
  1101. union {
  1102. A_UINT32 sw_peer_id__tid_num;
  1103. struct {
  1104. A_UINT32 tid_num: 8,
  1105. reserved0: 8,
  1106. sw_peer_id: 16;
  1107. };
  1108. };
  1109. A_UINT32 start_seq;
  1110. A_UINT32 enq_bitmap[HTT_BA_64_BIT_MAP_SIZE_DWORDS];
  1111. } htt_ppdu_stats_enq_mpdu_bitmap_64_tlv;
  1112. typedef struct {
  1113. htt_tlv_hdr_t tlv_hdr;
  1114. /* BIT [ 7 : 0] :- tid_num
  1115. * BIT [ 15: 8] :- reserved0
  1116. * BIT [ 31: 16] :- sw_peer_id
  1117. */
  1118. union {
  1119. A_UINT32 sw_peer_id__tid_num;
  1120. struct {
  1121. A_UINT32 tid_num: 8,
  1122. reserved0: 8,
  1123. sw_peer_id: 16;
  1124. };
  1125. };
  1126. A_UINT32 start_seq;
  1127. A_UINT32 enq_bitmap[HTT_BA_256_BIT_MAP_SIZE_DWORDS];
  1128. } htt_ppdu_stats_enq_mpdu_bitmap_256_tlv;
  1129. /* COMPLETION_STATUS defined in HTT_PPDU_STATS_USER_COMPLETION_STATUS */
  1130. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_COMPLETION_STATUS_M 0x000000ff
  1131. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_COMPLETION_STATUS_S 0
  1132. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_COMPLETION_STATUS_GET(_var) \
  1133. (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_COMPLETION_STATUS_M) >> \
  1134. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_COMPLETION_STATUS_S)
  1135. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_COMPLETION_STATUS_SET(_var, _val) \
  1136. do { \
  1137. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_COMPLETION_STATUS, _val); \
  1138. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_COMPLETION_STATUS_S)); \
  1139. } while (0)
  1140. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TID_NUM_M 0x0000ff00
  1141. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TID_NUM_S 8
  1142. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TID_NUM_GET(_var) \
  1143. (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TID_NUM_M) >> \
  1144. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TID_NUM_S)
  1145. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TID_NUM_SET(_var, _val) \
  1146. do { \
  1147. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TID_NUM, _val); \
  1148. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TID_NUM_S)); \
  1149. } while (0)
  1150. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SW_PEER_ID_M 0xffff0000
  1151. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SW_PEER_ID_S 16
  1152. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SW_PEER_ID_GET(_var) \
  1153. (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SW_PEER_ID_M) >> \
  1154. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SW_PEER_ID_S)
  1155. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SW_PEER_ID_SET(_var, _val) \
  1156. do { \
  1157. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SW_PEER_ID, _val); \
  1158. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SW_PEER_ID_S)); \
  1159. } while (0)
  1160. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_TRIED_M 0x0000ffff
  1161. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_TRIED_S 0
  1162. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_TRIED_GET(_var) \
  1163. (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_TRIED_M) >> \
  1164. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_TRIED_S)
  1165. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_TRIED_SET(_var, _val) \
  1166. do { \
  1167. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_TRIED, _val); \
  1168. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_TRIED_S)); \
  1169. } while (0)
  1170. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_SUCCESS_M 0xffff0000
  1171. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_SUCCESS_S 16
  1172. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_SUCCESS_GET(_var) \
  1173. (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_SUCCESS_M) >> \
  1174. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_SUCCESS_S)
  1175. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_SUCCESS_SET(_var, _val) \
  1176. do { \
  1177. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_SUCCESS, _val); \
  1178. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_SUCCESS_S)); \
  1179. } while (0)
  1180. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_LONG_RETRY_M 0x0000000f
  1181. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_LONG_RETRY_S 0
  1182. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_LONG_RETRY_GET(_var) \
  1183. (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_LONG_RETRY_M) >> \
  1184. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_LONG_RETRY_S)
  1185. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_LONG_RETRY_SET(_var, _val) \
  1186. do { \
  1187. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_LONG_RETRY, _val); \
  1188. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_LONG_RETRY_S)); \
  1189. } while (0)
  1190. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SHORT_RETRY_M 0x000000f0
  1191. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SHORT_RETRY_S 4
  1192. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SHORT_RETRY_GET(_var) \
  1193. (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SHORT_RETRY_M) >> \
  1194. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SHORT_RETRY_S)
  1195. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SHORT_RETRY_SET(_var, _val) \
  1196. do { \
  1197. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SHORT_RETRY, _val); \
  1198. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SHORT_RETRY_S)); \
  1199. } while (0)
  1200. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_AMPDU_M 0x00000100
  1201. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_AMPDU_S 8
  1202. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_AMPDU_GET(_var) \
  1203. (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_AMPDU_M) >> \
  1204. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_AMPDU_S)
  1205. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_AMPDU_SET(_var, _val) \
  1206. do { \
  1207. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_AMPDU, _val); \
  1208. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_AMPDU_S)); \
  1209. } while (0)
  1210. enum HTT_PPDU_STATS_RESP_TYPE {
  1211. HTT_PPDU_STATS_NO_RESPONSE_EXPECTED_E = 0,
  1212. HTT_PPDU_STATS_ACK_EXPECTED_E = 1,
  1213. HTT_PPDU_STATS_BA_BITMAP_EXPECTED_E = 2,
  1214. HTT_PPDU_STATS_UL_MU_BA_EXPECTED_E = 3,
  1215. HTT_PPDU_STATS_UL_MU_BA_AND_DATA_EXPECTED_E = 4,
  1216. HTT_PPDU_STATS_CTS_EXPECTED_E = 5,
  1217. HTT_PPDU_STATS_MU_CBF_EXPECTED_E = 6,
  1218. };
  1219. typedef enum HTT_PPDU_STATS_RESP_TYPE HTT_PPDU_STATS_RESP_TYPE;
  1220. /* Refer HTT_PPDU_STATS_RESP_TYPE */
  1221. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RESP_TYPE_M 0x00001e00
  1222. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RESP_TYPE_S 9
  1223. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RESP_TYPE_GET(_var) \
  1224. (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RESP_TYPE_M) >> \
  1225. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RESP_TYPE_S)
  1226. #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RESP_TYPE_SET(_var, _val) \
  1227. do { \
  1228. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RESP_TYPE, _val); \
  1229. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RESP_TYPE_S)); \
  1230. } while (0)
  1231. enum HTT_PPDU_STATS_USER_COMPLETION_STATUS {
  1232. HTT_PPDU_STATS_USER_STATUS_OK,
  1233. HTT_PPDU_STATS_USER_STATUS_FILTERED,
  1234. HTT_PPDU_STATS_USER_STATUS_RESP_TIMEOUT,
  1235. HTT_PPDU_STATS_USER_STATUS_RESP_MISMATCH,
  1236. HTT_PPDU_STATS_USER_STATUS_ABORT,
  1237. };
  1238. typedef enum HTT_PPDU_STATS_USER_COMPLETION_STATUS HTT_PPDU_STATS_USER_COMPLETION_STATUS;
  1239. typedef struct {
  1240. htt_tlv_hdr_t tlv_hdr;
  1241. /* BIT [ 7 : 0] :- completion_status
  1242. * BIT [ 15: 8] :- tid_num
  1243. * BIT [ 31: 16] :- sw_peer_id
  1244. */
  1245. union {
  1246. A_UINT32 sw_peer_id__tid_num__completion_status;
  1247. struct {
  1248. A_UINT32 completion_status: 8,
  1249. tid_num: 8,
  1250. sw_peer_id: 16;
  1251. };
  1252. };
  1253. /* RSSI value of last ack packet (units = dB above noise floor) */
  1254. A_UINT32 ack_rssi;
  1255. /* BIT [ 15 : 0] :- mpdu_tried
  1256. * BIT [ 31 : 16] :- mpdu_success
  1257. */
  1258. union {
  1259. A_UINT32 mpdu_tried__mpdu_success;
  1260. struct {
  1261. A_UINT32 mpdu_tried: 16,
  1262. mpdu_success: 16;
  1263. };
  1264. };
  1265. /* BIT [ 3 : 0] :- long_retries
  1266. * BIT [ 7 : 4] :- short_retries
  1267. * BIT [ 8 : 8] :- is_ampdu
  1268. * BIT [ 12: 9] :- resp_type
  1269. * BIT [ 31: 13] :- reserved0
  1270. */
  1271. union {
  1272. A_UINT32 resp_type_is_ampdu__short_retry__long_retry;
  1273. struct {
  1274. A_UINT32 long_retries: 4,
  1275. short_retries: 4,
  1276. is_ampdu: 1,
  1277. resp_type: 4,
  1278. reserved0: 19;
  1279. };
  1280. };
  1281. } htt_ppdu_stats_user_cmpltn_common_tlv;
  1282. #define HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_TID_NUM_M 0x000000ff
  1283. #define HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_TID_NUM_S 0
  1284. #define HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_TID_NUM_GET(_var) \
  1285. (((_var) & HTT_PPDU_STATS_EMQ_MPDU_BITMAP_TLV_TID_NUM_M) >> \
  1286. HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_TID_NUM_S)
  1287. #define HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_TID_NUM_SET(_var, _val) \
  1288. do { \
  1289. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_TID_NUM, _val); \
  1290. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_TID_NUM_S)); \
  1291. } while (0)
  1292. #define HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_RESERVED_M 0x0000ff00
  1293. #define HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_RESERVED_S 8
  1294. #define HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_SW_PEER_ID_M 0xffff0000
  1295. #define HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_SW_PEER_ID_S 16
  1296. #define HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_SW_PEER_ID_GET(_var) \
  1297. (((_var) & HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_SW_PEER_ID_M) >> \
  1298. HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_SW_PEER_ID_S)
  1299. #define HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_SW_PEER_ID_SET(_var, _val) \
  1300. do { \
  1301. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_SW_PEER_ID, _val); \
  1302. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_SW_PEER_ID_S)); \
  1303. } while (0)
  1304. typedef struct {
  1305. htt_tlv_hdr_t tlv_hdr;
  1306. /* BIT [ 7 : 0] :- tid_num
  1307. * BIT [ 15: 8] :- reserved0
  1308. * BIT [ 31: 16] :- sw_peer_id
  1309. */
  1310. union {
  1311. A_UINT32 sw_peer_id__tid_num;
  1312. struct {
  1313. A_UINT32 tid_num: 8,
  1314. reserved0: 8,
  1315. sw_peer_id: 16;
  1316. };
  1317. };
  1318. A_UINT32 ba_seq_no;
  1319. A_UINT32 ba_bitmap[HTT_BA_64_BIT_MAP_SIZE_DWORDS];
  1320. } htt_ppdu_stats_user_compltn_ba_bitmap_64_tlv;
  1321. typedef struct {
  1322. htt_tlv_hdr_t tlv_hdr;
  1323. /* BIT [ 7 : 0] :- tid_num
  1324. * BIT [ 15: 8] :- reserved0
  1325. * BIT [ 31: 16] :- sw_peer_id
  1326. */
  1327. union {
  1328. A_UINT32 sw_peer_id__tid_num;
  1329. struct {
  1330. A_UINT32 tid_num: 8,
  1331. reserved0: 8,
  1332. sw_peer_id: 16;
  1333. };
  1334. };
  1335. A_UINT32 ba_seq_no;
  1336. A_UINT32 ba_bitmap[HTT_BA_256_BIT_MAP_SIZE_DWORDS];
  1337. } htt_ppdu_stats_user_compltn_ba_bitmap_256_tlv;
  1338. #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_SW_PEER_ID_M 0x0000ffff
  1339. #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_SW_PEER_ID_S 0
  1340. #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_SW_PEER_ID_GET(_var) \
  1341. (((_var) & HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_SW_PEER_ID_M) >> \
  1342. HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_SW_PEER_ID_S)
  1343. #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_SW_PEER_ID_SET(_var, _val) \
  1344. do { \
  1345. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_SW_PEER_ID, _val); \
  1346. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_SW_PEER_ID_S)); \
  1347. } while (0)
  1348. #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MPDU_M 0x000001ff
  1349. #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MPDU_S 0
  1350. #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MPDU_GET(_var) \
  1351. (((_var) & HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MPDU_M) >> \
  1352. HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MPDU_S)
  1353. #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MPDU_SET(_var, _val) \
  1354. do { \
  1355. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MPDU, _val); \
  1356. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MPDU_S)); \
  1357. } while (0)
  1358. #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MSDU_M 0x01fffe00
  1359. #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MSDU_S 9
  1360. #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MSDU_GET(_var) \
  1361. (((_var) & HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MSDU_M) >> \
  1362. HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MSDU_S)
  1363. #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MSDU_SET(_var, _val) \
  1364. do { \
  1365. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MSDU, _val); \
  1366. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MSDU_S)); \
  1367. } while (0)
  1368. #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_TID_NUM_M 0xfe000000
  1369. #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_TID_NUM_S 25
  1370. #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_TID_NUM_GET(_var) \
  1371. (((_var) & HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_TID_NUM_M) >> \
  1372. HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_TID_NUM_S)
  1373. #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_TID_NUM_SET(_var, _val) \
  1374. do { \
  1375. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_TID_NUM, _val); \
  1376. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_TID_NUM_S)); \
  1377. } while (0)
  1378. #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_CUR_SEQ_M 0x0000ffff
  1379. #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_CUR_SEQ_S 0
  1380. #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_CUR_SEQ_GET(_var) \
  1381. (((_var) & HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_CUR_SEQ_M) >> \
  1382. HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_CUR_SEQ_S)
  1383. #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_CUR_SEQ_SET(_var, _val) \
  1384. do { \
  1385. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_CUR_SEQ, _val); \
  1386. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_CUR_SEQ_S)); \
  1387. } while (0)
  1388. #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_START_SEQ_M 0xffff0000
  1389. #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_START_SEQ_S 16
  1390. #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_START_SEQ_GET(_var) \
  1391. (((_var) & HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_START_SEQ_M) >> \
  1392. HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_START_SEQ_S)
  1393. #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_START_SEQ_SET(_var, _val) \
  1394. do { \
  1395. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_START_SEQ, _val); \
  1396. ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_START_SEQ_S)); \
  1397. } while (0)
  1398. typedef struct {
  1399. htt_tlv_hdr_t tlv_hdr;
  1400. A_UINT32 ppdu_id;
  1401. /* BIT [ 15 : 0] :- sw_peer_id
  1402. * BIT [ 31 : 16] :- reserved0
  1403. */
  1404. union {
  1405. A_UINT32 rsvd_sw_peer_id;
  1406. struct {
  1407. A_UINT32 sw_peer_id: 16,
  1408. reserved0: 16;
  1409. };
  1410. };
  1411. /* BIT [ 8 : 0] :- num_mpdu
  1412. * BIT [ 24 : 9] :- num_msdu
  1413. * BIT [ 31 : 25] :- tid_num
  1414. */
  1415. union {
  1416. A_UINT32 tid_num__num_msdu__num_mpdu;
  1417. struct {
  1418. A_UINT32 num_mpdu: 9,
  1419. num_msdu: 16,
  1420. tid_num: 7;
  1421. };
  1422. };
  1423. /* BIT [ 15 : 0] :- current_seq
  1424. * BIT [ 31 : 16] :- start_seq
  1425. */
  1426. union {
  1427. A_UINT32 start_seq__current_seq;
  1428. struct {
  1429. A_UINT32 current_seq: 16,
  1430. start_seq: 16;
  1431. };
  1432. };
  1433. A_UINT32 success_bytes;
  1434. } htt_ppdu_stats_user_compltn_ack_ba_status_tlv;
  1435. /* FLOW_TYPE defined in HTT_TX_FLOW_TYPE */
  1436. #define HTT_PPDU_STATS_FLUSH_TLV_FLOW_TYPE_M 0x000000ff
  1437. #define HTT_PPDU_STATS_FLUSH_TLV_FLOW_TYPE_S 0
  1438. #define HTT_PPDU_STATS_FLUSH_TLV_FLOW_TYPE_GET(_var) \
  1439. (((_var) & HTT_PPDU_STATS_FLUSH_TLV_FLOW_TYPE_M) >> \
  1440. HTT_PPDU_STATS_FLUSH_TLV_FLOW_TYPE_S)
  1441. #define HTT_PPDU_STATS_FLUSH_TLV_FLOW_TYPE_SET(_var, _val) \
  1442. do { \
  1443. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_FLUSH_TLV_FLOW_TYPE, _val); \
  1444. ((_var) |= ((_val) << HTT_PPDU_STATS_FLUSH_TLV_FLOW_TYPE_S)); \
  1445. } while (0)
  1446. #define HTT_PPDU_STATS_FLUSH_TLV_NUM_MPDU_M 0x0001ff00
  1447. #define HTT_PPDU_STATS_FLUSH_TLV_NUM_MPDU_S 8
  1448. #define HTT_PPDU_STATS_FLUSH_TLV_NUM_MPDU_GET(_var) \
  1449. (((_var) & HTT_PPDU_STATS_FLUSH_TLV_NUM_MPDU_M) >> \
  1450. HTT_PPDU_STATS_FLUSH_TLV_NUM_MPDU_S)
  1451. #define HTT_PPDU_STATS_FLUSH_TLV_NUM_MPDU_SET(_var, _val) \
  1452. do { \
  1453. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_FLUSH_TLV_NUM_MPDU, _val); \
  1454. ((_var) |= ((_val) << HTT_PPDU_STATS_FLUSH_TLV_NUM_MPDU_S)); \
  1455. } while (0)
  1456. #define HTT_PPDU_STATS_FLUSH_TLV_NUM_MSDU_M 0x7ffe0000
  1457. #define HTT_PPDU_STATS_FLUSH_TLV_NUM_MSDU_S 17
  1458. #define HTT_PPDU_STATS_FLUSH_TLV_NUM_MSDU_GET(_var) \
  1459. (((_var) & HTT_PPDU_STATS_FLUSH_TLV_NUM_MSDU_M) >> \
  1460. HTT_PPDU_STATS_FLUSH_TLV_NUM_MSDU_S)
  1461. #define HTT_PPDU_STATS_FLUSH_TLV_NUM_MSDU_SET(_var, _val) \
  1462. do { \
  1463. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_FLUSH_TLV_NUM_MSDU, _val); \
  1464. ((_var) |= ((_val) << HTT_PPDU_STATS_FLUSH_TLV_NUM_MSDU_S)); \
  1465. } while (0)
  1466. #define HTT_PPDU_STATS_FLUSH_TLV_TID_NUM_M 0x000000ff
  1467. #define HTT_PPDU_STATS_FLUSH_TLV_TID_NUM_S 0
  1468. #define HTT_PPDU_STATS_FLUSH_TLV_TID_NUM_GET(_var) \
  1469. (((_var) & HTT_PPDU_STATS_FLUSH_TLV_TID_NUM_M) >> \
  1470. HTT_PPDU_STATS_FLUSH_TLV_TID_NUM_S)
  1471. #define HTT_PPDU_STATS_FLUSH_TLV_TID_NUM_SET(_var, _val) \
  1472. do { \
  1473. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_FLUSH_TLV_TID_NUM, _val); \
  1474. ((_var) |= ((_val) << HTT_PPDU_STATS_FLUSH_TLV_TID_NUM_S)); \
  1475. } while (0)
  1476. #define HTT_PPDU_STATS_FLUSH_TLV_QUEUE_TYPE_M 0x0000ff00
  1477. #define HTT_PPDU_STATS_FLUSH_TLV_QUEUE_TYPE_S 8
  1478. #define HTT_PPDU_STATS_FLUSH_TLV_QUEUE_TYPE_GET(_var) \
  1479. (((_var) & HTT_PPDU_STATS_FLUSH_TLV_QUEUE_TYPE_M) >> \
  1480. HTT_PPDU_STATS_FLUSH_TLV_QUEUE_TYPE_S)
  1481. #define HTT_PPDU_STATS_FLUSH_TLV_QUEUE_TYPE_SET(_var, _val) \
  1482. do { \
  1483. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_FLUSH_TLV_QUEUE_TYPE, _val); \
  1484. ((_var) |= ((_val) << HTT_PPDU_STATS_FLUSH_TLV_QUEUE_TYPE_S)); \
  1485. } while (0)
  1486. #define HTT_PPDU_STATS_FLUSH_TLV_SW_PEER_ID_M 0xffff0000
  1487. #define HTT_PPDU_STATS_FLUSH_TLV_SW_PEER_ID_S 16
  1488. #define HTT_PPDU_STATS_FLUSH_TLV_SW_PEER_ID_GET(_var) \
  1489. (((_var) & HTT_PPDU_STATS_FLUSH_TLV_SW_PEER_ID_M) >> \
  1490. HTT_PPDU_STATS_FLUSH_TLV_SW_PEER_ID_S)
  1491. #define HTT_PPDU_STATS_FLUSH_TLV_SW_PEER_ID_SET(_var, _val) \
  1492. do { \
  1493. HTT_CHECK_SET_VAL(HTT_PPDU_STATS_FLUSH_TLV_SW_PEER_ID, _val); \
  1494. ((_var) |= ((_val) << HTT_PPDU_STATS_FLUSH_TLV_SW_PEER_ID_S)); \
  1495. } while (0)
  1496. enum HTT_TX_FLOW_TYPE {
  1497. HTT_TX_TID_FRAMEQ,
  1498. HTT_TX_TQM_MSDUQ,
  1499. HTT_TQM_MPDUQ,
  1500. };
  1501. enum HTT_FLUSH_STATUS_DROP_REASON {
  1502. HTT_FLUSH_PEER_DELETE,
  1503. HTT_FLUSH_TID_DELETE,
  1504. HTT_FLUSH_TTL_EXCEEDED,
  1505. HTT_FLUSH_EXCESS_RETRIES,
  1506. HTT_FLUSH_REINJECT,
  1507. };
  1508. typedef struct {
  1509. htt_tlv_hdr_t tlv_hdr;
  1510. A_UINT32 drop_reason;
  1511. /* BIT [ 7 : 0] :- flow_type
  1512. * BIT [ 16: 8] :- num_mpdu
  1513. * BIT [ 30: 17] :- num_msdu
  1514. * BIT [ 31: 31] :- reserved0
  1515. */
  1516. union {
  1517. A_UINT32 num_msdu__num_mpdu__flow_type;
  1518. struct {
  1519. A_UINT32 flow_type: 8,
  1520. num_mpdu: 9,
  1521. num_msdu: 14,
  1522. reserved0: 1;
  1523. };
  1524. };
  1525. /* BIT [ 7 : 0] :- tid_num
  1526. * BIT [ 15 : 8] :- queue_type
  1527. * BIT [ 31 : 16] :- sw_peer_id
  1528. */
  1529. union {
  1530. A_UINT32 sw_peer_id__queue_type__tid_num;
  1531. struct {
  1532. A_UINT32 tid_num: 8,
  1533. queue_type: 8,
  1534. sw_peer_id: 16;
  1535. };
  1536. };
  1537. } htt_ppdu_stats_flush_tlv;
  1538. typedef struct {
  1539. htt_tlv_hdr_t tlv_hdr;
  1540. /* Future purpose */
  1541. A_UINT32 reserved1; /* set to 0x0 */
  1542. A_UINT32 reserved2; /* set to 0x0 */
  1543. A_UINT32 reserved3; /* set to 0x0 */
  1544. /* mgmt/ctrl frame payload
  1545. * The size of payload (in bytes) can be derived from the length in
  1546. * tlv parametes, minus the 12 bytes of the above fields.
  1547. */
  1548. A_UINT32 payload[1];
  1549. } htt_ppdu_stats_tx_mgmtctrl_payload_tlv;
  1550. #endif //__HTT_PPDU_STATS_H__