htt_ppdu_stats.h 80 KB

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