wlan_defs.h 58 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557
  1. /*
  2. * Copyright (c) 2013-2016, 2018-2021 The Linux Foundation. All rights reserved.*
  3. *
  4. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  5. *
  6. *
  7. * Permission to use, copy, modify, and/or distribute this software for
  8. * any purpose with or without fee is hereby granted, provided that the
  9. * above copyright notice and this permission notice appear in all
  10. * copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  13. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  14. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  15. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  16. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  17. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  18. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  19. * PERFORMANCE OF THIS SOFTWARE.
  20. */
  21. /*
  22. * This file was originally distributed by Qualcomm Atheros, Inc.
  23. * under proprietary terms before Copyright ownership was assigned
  24. * to the Linux Foundation.
  25. */
  26. #ifndef __WLAN_DEFS_H__
  27. #define __WLAN_DEFS_H__
  28. #include <a_osapi.h> /* A_COMPILE_TIME_ASSERT */
  29. /*
  30. * This file contains WLAN definitions that may be used across both
  31. * Host and Target software.
  32. */
  33. /*
  34. * MAX_SPATIAL_STREAM should be defined in a fwconfig_xxx.h file,
  35. * but for now provide a default value here in case it's not defined
  36. * in the fwconfig_xxx.h file.
  37. */
  38. #ifndef MAX_SPATIAL_STREAM
  39. #define MAX_SPATIAL_STREAM 3
  40. #endif
  41. /*
  42. * NOTE: The CONFIG_160MHZ_SUPPORT is not used consistently - some code
  43. * uses "#ifdef CONFIG_160MHZ_SUPPORT" while other code uses
  44. * "#if CONFIG_160MHZ_SUPPORT".
  45. * This use is being standardized in the recent versions of code to use
  46. * #ifdef, but is being left as is in the legacy code branches.
  47. * To minimize impact to legacy code branches, this file internally
  48. * converts CONFIG_160MHZ_SUPPORT=0 to having CONFIG_160MHZ_SUPPORT
  49. * undefined.
  50. * For builds that explicitly set CONFIG_160MHZ_SUPPORT=0, the bottom of
  51. * this file restores CONFIG_160MHZ_SUPPORT from being undefined to being 0.
  52. */
  53. // OLD:
  54. //#ifndef CONFIG_160MHZ_SUPPORT
  55. //#define CONFIG_160MHZ_SUPPORT 0 /* default: 160 MHz channels not supported */
  56. //#endif
  57. // NEW:
  58. #ifdef CONFIG_160MHZ_SUPPORT
  59. /* CONFIG_160MHZ_SUPPORT is explicitly enabled or explicitly disabled */
  60. #if !CONFIG_160MHZ_SUPPORT
  61. /* CONFIG_160MHZ_SUPPORT is explicitly disabled */
  62. /* Change from CONFIG_160MHZ_SUPPORT=0 to CONFIG_160MHZ_SUPPORT=<undef> */
  63. #undef CONFIG_160MHZ_SUPPORT
  64. /*
  65. * Set a flag to indicate this CONFIG_160MHZ_SUPPORT = 0 --> undef
  66. * change has been done, so we can undo the change at the bottom
  67. * of the file.
  68. */
  69. #define CONFIG_160MHZ_SUPPORT_UNDEF_WAR
  70. #endif
  71. #else
  72. /*
  73. * For backwards compatibility, if CONFIG_160MHZ_SUPPORT is not defined,
  74. * default it to 0, if this is either a host build or a Rome target build.
  75. * This maintains the prior behavior for the host and Rome target builds.
  76. */
  77. #if defined(AR6320) || !defined(ATH_TARGET)
  78. /*
  79. * Set a flag to indicate that at the end of the file,
  80. * CONFIG_160MHZ_SUPPORT should be set to 0.
  81. */
  82. #define CONFIG_160MHZ_SUPPORT_UNDEF_WAR
  83. #endif
  84. #endif
  85. #ifndef SUPPORT_11AX
  86. #define SUPPORT_11AX 0 /* 11ax not supported by default */
  87. #endif
  88. /*
  89. * MAX_SPATIAL_STREAM_ANY -
  90. * what is the largest number of spatial streams that any target supports
  91. */
  92. #define MAX_SPATIAL_STREAM_ANY_V2 4 /* pre-hawkeye */
  93. #define MAX_SPATIAL_STREAM_ANY_V3 8 /* includes hawkeye */
  94. /*
  95. * (temporarily) leave the old MAX_SPATIAL_STREAM_ANY name in place as an alias,
  96. * and in case some old code is using it
  97. */
  98. #define MAX_SPATIAL_STREAM_ANY MAX_SPATIAL_STREAM_ANY_V2 /* DEPRECATED */
  99. /* defines to set Packet extension values whic can be 0 us, 8 usec or 16 usec */
  100. /* NOTE: Below values cannot be changed without breaking WMI Compatibility */
  101. #define MAX_HE_NSS 8
  102. #define MAX_HE_MODULATION 8
  103. #define MAX_HE_RU 4
  104. #define HE_MODULATION_NONE 7
  105. #define HE_PET_0_USEC 0
  106. #define HE_PET_8_USEC 1
  107. #define HE_PET_16_USEC 2
  108. #define DEFAULT_OFDMA_RU26_COUNT 0
  109. typedef enum {
  110. MODE_11A = 0, /* 11a Mode */
  111. MODE_11G = 1, /* 11b/g Mode */
  112. MODE_11B = 2, /* 11b Mode */
  113. MODE_11GONLY = 3, /* 11g only Mode */
  114. MODE_11NA_HT20 = 4, /* 11a HT20 mode */
  115. MODE_11NG_HT20 = 5, /* 11g HT20 mode */
  116. MODE_11NA_HT40 = 6, /* 11a HT40 mode */
  117. MODE_11NG_HT40 = 7, /* 11g HT40 mode */
  118. MODE_11AC_VHT20 = 8,
  119. MODE_11AC_VHT40 = 9,
  120. MODE_11AC_VHT80 = 10,
  121. MODE_11AC_VHT20_2G = 11,
  122. MODE_11AC_VHT40_2G = 12,
  123. MODE_11AC_VHT80_2G = 13,
  124. #ifdef CONFIG_160MHZ_SUPPORT
  125. MODE_11AC_VHT80_80 = 14,
  126. MODE_11AC_VHT160 = 15,
  127. #endif
  128. #if SUPPORT_11AX
  129. MODE_11AX_HE20 = 16,
  130. MODE_11AX_HE40 = 17,
  131. MODE_11AX_HE80 = 18,
  132. MODE_11AX_HE80_80 = 19,
  133. MODE_11AX_HE160 = 20,
  134. MODE_11AX_HE20_2G = 21,
  135. MODE_11AX_HE40_2G = 22,
  136. MODE_11AX_HE80_2G = 23,
  137. #endif
  138. #if defined(SUPPORT_11BE) && SUPPORT_11BE
  139. MODE_11BE_EHT20 = 24,
  140. MODE_11BE_EHT40 = 25,
  141. MODE_11BE_EHT80 = 26,
  142. MODE_11BE_EHT80_80 = 27,
  143. MODE_11BE_EHT160 = 28,
  144. MODE_11BE_EHT160_160 = 29,
  145. MODE_11BE_EHT320 = 30,
  146. MODE_11BE_EHT20_2G = 31, /* For WIN */
  147. MODE_11BE_EHT40_2G = 32, /* For WIN */
  148. #endif
  149. /*
  150. * MODE_UNKNOWN should not be used within the host / target interface.
  151. * Thus, it is permissible for MODE_UNKNOWN to be conditionally-defined,
  152. * taking different values when compiling for different targets.
  153. */
  154. MODE_UNKNOWN,
  155. MODE_UNKNOWN_NO_160MHZ_SUPPORT = 14, /* not needed? */
  156. MODE_UNKNOWN_160MHZ_SUPPORT = MODE_UNKNOWN, /* not needed? */
  157. #ifdef ATHR_WIN_NWF
  158. PHY_MODE_MAX = MODE_UNKNOWN,
  159. PHY_MODE_MAX_NO_160_MHZ_SUPPORT = MODE_UNKNOWN_NO_160MHZ_SUPPORT,
  160. PHY_MODE_MAX_160_MHZ_SUPPORT = MODE_UNKNOWN_160MHZ_SUPPORT,
  161. #else
  162. MODE_MAX = MODE_UNKNOWN,
  163. MODE_MAX_NO_160_MHZ_SUPPORT = MODE_UNKNOWN_NO_160MHZ_SUPPORT,
  164. MODE_MAX_160_MHZ_SUPPORT = MODE_UNKNOWN_160MHZ_SUPPORT,
  165. #endif
  166. } WLAN_PHY_MODE;
  167. #if (!defined(CONFIG_160MHZ_SUPPORT)) && (!defined(SUPPORT_11AX))
  168. A_COMPILE_TIME_ASSERT(
  169. mode_unknown_value_consistency_Check,
  170. MODE_UNKNOWN == MODE_UNKNOWN_NO_160MHZ_SUPPORT);
  171. #else
  172. /*
  173. * If SUPPORT_11AX is defined but CONFIG_160MHZ_SUPPORT is not defined,
  174. * there will be a gap in the mode values, with 14 and 15 being unused.
  175. * But MODE_UNKNOWN_NO_160MHZ_SUPPORT will have an invalid value, since
  176. * mode values 16 through 23 will be used for 11AX modes.
  177. * Thus, MODE_UNKNOWN would still be MODE_UNKNOWN_160MHZ_SUPPORT, for
  178. * cases where 160 MHz is not supported by 11AX is supported.
  179. * (Ideally, MODE_UNKNOWN_160MHZ_SUPPORT and NO_160MHZ_SUPPORT should be
  180. * renamed to cover the 4 permutations of support or no support for
  181. * 11AX and 160 MHZ, but that is impractical, due to backwards
  182. * compatibility concerns.)
  183. */
  184. A_COMPILE_TIME_ASSERT(
  185. mode_unknown_value_consistency_Check,
  186. MODE_UNKNOWN == MODE_UNKNOWN_160MHZ_SUPPORT);
  187. #endif
  188. typedef enum {
  189. VHT_MODE_NONE = 0, /* NON VHT Mode, e.g., HT, DSSS, CCK */
  190. VHT_MODE_20M = 1,
  191. VHT_MODE_40M = 2,
  192. VHT_MODE_80M = 3,
  193. VHT_MODE_160M = 4
  194. } VHT_OPER_MODE;
  195. typedef enum {
  196. WLAN_11A_CAPABILITY = 1,
  197. WLAN_11G_CAPABILITY = 2,
  198. WLAN_11AG_CAPABILITY = 3,
  199. } WLAN_CAPABILITY;
  200. #ifdef CONFIG_160MHZ_SUPPORT
  201. #define IS_MODE_VHT(mode) (((mode) == MODE_11AC_VHT20) || \
  202. ((mode) == MODE_11AC_VHT40) || \
  203. ((mode) == MODE_11AC_VHT80) || \
  204. ((mode) == MODE_11AC_VHT80_80) || \
  205. ((mode) == MODE_11AC_VHT160))
  206. #else
  207. #define IS_MODE_VHT(mode) (((mode) == MODE_11AC_VHT20) || \
  208. ((mode) == MODE_11AC_VHT40) || \
  209. ((mode) == MODE_11AC_VHT80))
  210. #endif
  211. #if SUPPORT_11AX
  212. #define IS_MODE_HE(mode) (((mode) == MODE_11AX_HE20) || \
  213. ((mode) == MODE_11AX_HE40) || \
  214. ((mode) == MODE_11AX_HE80) || \
  215. ((mode) == MODE_11AX_HE80_80) || \
  216. ((mode) == MODE_11AX_HE160) || \
  217. ((mode) == MODE_11AX_HE20_2G) || \
  218. ((mode) == MODE_11AX_HE40_2G) || \
  219. ((mode) == MODE_11AX_HE80_2G))
  220. #define IS_MODE_HE_2G(mode) (((mode) == MODE_11AX_HE20_2G) || \
  221. ((mode) == MODE_11AX_HE40_2G) || \
  222. ((mode) == MODE_11AX_HE80_2G))
  223. #endif /* SUPPORT_11AX */
  224. #if defined(SUPPORT_11BE) && SUPPORT_11BE
  225. #define IS_MODE_EHT(mode) (((mode) == MODE_11BE_EHT20) || \
  226. ((mode) == MODE_11BE_EHT40) || \
  227. ((mode) == MODE_11BE_EHT80) || \
  228. ((mode) == MODE_11BE_EHT80_80) || \
  229. ((mode) == MODE_11BE_EHT160) || \
  230. ((mode) == MODE_11BE_EHT160_160)|| \
  231. ((mode) == MODE_11BE_EHT320) || \
  232. ((mode) == MODE_11BE_EHT20_2G) || \
  233. ((mode) == MODE_11BE_EHT40_2G))
  234. #define IS_MODE_EHT_2G(mode) (((mode) == MODE_11BE_EHT20_2G) || \
  235. ((mode) == MODE_11BE_EHT40_2G))
  236. #endif /* SUPPORT_11BE */
  237. #define IS_MODE_VHT_2G(mode) (((mode) == MODE_11AC_VHT20_2G) || \
  238. ((mode) == MODE_11AC_VHT40_2G) || \
  239. ((mode) == MODE_11AC_VHT80_2G))
  240. #define IS_MODE_11A(mode) (((mode) == MODE_11A) || \
  241. ((mode) == MODE_11NA_HT20) || \
  242. ((mode) == MODE_11NA_HT40) || \
  243. (IS_MODE_VHT(mode)))
  244. #define IS_MODE_11B(mode) ((mode) == MODE_11B)
  245. #define IS_MODE_11G(mode) (((mode) == MODE_11G) || \
  246. ((mode) == MODE_11GONLY) || \
  247. ((mode) == MODE_11NG_HT20) || \
  248. ((mode) == MODE_11NG_HT40) || \
  249. (IS_MODE_VHT_2G(mode)))
  250. #define IS_MODE_11GN(mode) (((mode) == MODE_11NG_HT20) || \
  251. ((mode) == MODE_11NG_HT40))
  252. #define IS_MODE_11GONLY(mode) ((mode) == MODE_11GONLY)
  253. #define IS_MODE_LEGACY(phymode) ((phymode == MODE_11A) || \
  254. (phymode == MODE_11G) || \
  255. (phymode == MODE_11B) || \
  256. (phymode == MODE_11GONLY))
  257. #define IS_MODE_11N(phymode) ((phymode >= MODE_11NA_HT20) && \
  258. (phymode <= MODE_11NG_HT40))
  259. #ifdef CONFIG_160MHZ_SUPPORT
  260. #define IS_MODE_11AC(phymode) ((phymode >= MODE_11AC_VHT20) && \
  261. (phymode <= MODE_11AC_VHT160))
  262. #else
  263. #define IS_MODE_11AC(phymode) ((phymode >= MODE_11AC_VHT20) && \
  264. (phymode <= MODE_11AC_VHT80_2G))
  265. #endif /* CONFIG_160MHZ_SUPPORT */
  266. #if SUPPORT_11AX
  267. #define IS_MODE_80MHZ(phymode) ((phymode == MODE_11AC_VHT80_2G) || \
  268. (phymode == MODE_11AC_VHT80) || \
  269. (phymode == MODE_11AX_HE80) || \
  270. (phymode == MODE_11AX_HE80_2G))
  271. #define IS_MODE_40MHZ(phymode) ((phymode == MODE_11AC_VHT40_2G) || \
  272. (phymode == MODE_11AC_VHT40) || \
  273. (phymode == MODE_11NG_HT40) || \
  274. (phymode == MODE_11NA_HT40) || \
  275. (phymode == MODE_11AX_HE40) || \
  276. (phymode == MODE_11AX_HE40_2G))
  277. #else
  278. #define IS_MODE_80MHZ(phymode) ((phymode == MODE_11AC_VHT80_2G) || \
  279. (phymode == MODE_11AC_VHT80))
  280. #define IS_MODE_40MHZ(phymode) ((phymode == MODE_11AC_VHT40_2G) || \
  281. (phymode == MODE_11AC_VHT40) || \
  282. (phymode == MODE_11NG_HT40) || \
  283. (phymode == MODE_11NA_HT40))
  284. #endif /* SUPPORT_11AX */
  285. enum {
  286. REGDMN_MODE_11A_BIT = 0, /* 11a channels */
  287. REGDMN_MODE_TURBO_BIT = 1, /* 11a turbo-only channels */
  288. REGDMN_MODE_11B_BIT = 2, /* 11b channels */
  289. REGDMN_MODE_PUREG_BIT = 3, /* 11g channels (OFDM only) */
  290. REGDMN_MODE_11G_BIT = 3, /* XXX historical */
  291. /* bit 4 is reserved */
  292. REGDMN_MODE_108G_BIT = 5, /* 11g+Turbo channels */
  293. REGDMN_MODE_108A_BIT = 6, /* 11a+Turbo channels */
  294. /* bit 7 is reserved */
  295. REGDMN_MODE_XR_BIT = 8, /* XR channels */
  296. REGDMN_MODE_11A_HALF_RATE_BIT = 9, /* 11A half rate channels */
  297. REGDMN_MODE_11A_QUARTER_RATE_BIT = 10, /* 11A quarter rate channels */
  298. REGDMN_MODE_11NG_HT20_BIT = 11, /* 11N-G HT20 channels */
  299. REGDMN_MODE_11NA_HT20_BIT = 12, /* 11N-A HT20 channels */
  300. REGDMN_MODE_11NG_HT40PLUS_BIT = 13, /* 11N-G HT40 + channels */
  301. REGDMN_MODE_11NG_HT40MINUS_BIT = 14, /* 11N-G HT40 - channels */
  302. REGDMN_MODE_11NA_HT40PLUS_BIT = 15, /* 11N-A HT40 + channels */
  303. REGDMN_MODE_11NA_HT40MINUS_BIT = 16, /* 11N-A HT40 - channels */
  304. REGDMN_MODE_11AC_VHT20_BIT = 17, /* 5Ghz, VHT20 */
  305. REGDMN_MODE_11AC_VHT40PLUS_BIT = 18, /* 5Ghz, VHT40 + channels */
  306. REGDMN_MODE_11AC_VHT40MINUS_BIT = 19, /* 5Ghz VHT40 - channels */
  307. REGDMN_MODE_11AC_VHT80_BIT = 20, /* 5Ghz, VHT80 channels */
  308. REGDMN_MODE_11AC_VHT20_2G_BIT = 21, /* 2Ghz, VHT20 */
  309. REGDMN_MODE_11AC_VHT40_2G_BIT = 22, /* 2Ghz, VHT40 */
  310. REGDMN_MODE_11AC_VHT80_2G_BIT = 23, /* 2Ghz, VHT80 */
  311. REGDMN_MODE_11AC_VHT160_BIT = 24, /* 5Ghz, VHT160 */
  312. REGDMN_MODE_11AC_VHT40_2GPLUS_BIT = 25, /* 2Ghz, VHT40+ */
  313. REGDMN_MODE_11AC_VHT40_2GMINUS_BIT = 26, /* 2Ghz, VHT40- */
  314. REGDMN_MODE_11AC_VHT80_80_BIT = 27, /* 5GHz, VHT80+80 */
  315. /* bits 28 to 31 are reserved */
  316. REGDMN_MODE_11AXG_HE20_BIT = 32, /* 2Ghz, HE20 */
  317. REGDMN_MODE_11AXA_HE20_BIT = 33, /* 5Ghz, HE20 */
  318. REGDMN_MODE_11AXG_HE40PLUS_BIT = 34, /* 2Ghz, HE40+ */
  319. REGDMN_MODE_11AXG_HE40MINUS_BIT = 35, /* 2Ghz, HE40- */
  320. REGDMN_MODE_11AXA_HE40PLUS_BIT = 36, /* 5Ghz, HE40+ */
  321. REGDMN_MODE_11AXA_HE40MINUS_BIT = 37, /* 5Ghz, HE40- */
  322. REGDMN_MODE_11AXA_HE80_BIT = 38, /* 5Ghz, HE80 */
  323. REGDMN_MODE_11AXA_HE160_BIT = 39, /* 5Ghz, HE160 */
  324. REGDMN_MODE_11AXA_HE80_80_BIT = 40, /* 5Ghz, HE80+80 */
  325. REGDMN_MODE_11BEG_EHT20_BIT = 41, /* 2Ghz, EHT20 */
  326. REGDMN_MODE_11BEA_EHT20_BIT = 42, /* 5Ghz, EHT20 */
  327. REGDMN_MODE_11BEG_EHT40PLUS_BIT = 43, /* 2Ghz, EHT40+ */
  328. REGDMN_MODE_11BEG_EHT40MINUS_BIT = 44, /* 2Ghz, EHT40- */
  329. REGDMN_MODE_11BEA_EHT40PLUS_BIT = 45, /* 5Ghz, EHT40+ */
  330. REGDMN_MODE_11BEA_EHT40MINUS_BIT = 46, /* 5Ghz, EHT40- */
  331. REGDMN_MODE_11BEA_EHT80_BIT = 47, /* 5Ghz, EHT80 */
  332. REGDMN_MODE_11BEA_EHT160_BIT = 48, /* 5Ghz, EHT160 */
  333. REGDMN_MODE_11BEA_EHT320_BIT = 49, /* 5Ghz, EHT320 */
  334. };
  335. enum {
  336. REGDMN_MODE_11A = 1 << REGDMN_MODE_11A_BIT, /* 11a channels */
  337. REGDMN_MODE_TURBO = 1 << REGDMN_MODE_TURBO_BIT, /* 11a turbo-only channels */
  338. REGDMN_MODE_11B = 1 << REGDMN_MODE_11B_BIT, /* 11b channels */
  339. REGDMN_MODE_PUREG = 1 << REGDMN_MODE_PUREG_BIT, /* 11g channels (OFDM only) */
  340. REGDMN_MODE_11G = 1 << REGDMN_MODE_11G_BIT, /* XXX historical */
  341. REGDMN_MODE_108G = 1 << REGDMN_MODE_108G_BIT, /* 11g+Turbo channels */
  342. REGDMN_MODE_108A = 1 << REGDMN_MODE_108A_BIT, /* 11a+Turbo channels */
  343. REGDMN_MODE_XR = 1 << REGDMN_MODE_XR_BIT, /* XR channels */
  344. REGDMN_MODE_11A_HALF_RATE = 1 << REGDMN_MODE_11A_HALF_RATE_BIT, /* 11A half rate channels */
  345. REGDMN_MODE_11A_QUARTER_RATE = 1 << REGDMN_MODE_11A_QUARTER_RATE_BIT, /* 11A quarter rate channels */
  346. REGDMN_MODE_11NG_HT20 = 1 << REGDMN_MODE_11NG_HT20_BIT, /* 11N-G HT20 channels */
  347. REGDMN_MODE_11NA_HT20 = 1 << REGDMN_MODE_11NA_HT20_BIT, /* 11N-A HT20 channels */
  348. REGDMN_MODE_11NG_HT40PLUS = 1 << REGDMN_MODE_11NG_HT40PLUS_BIT, /* 11N-G HT40 + channels */
  349. REGDMN_MODE_11NG_HT40MINUS = 1 << REGDMN_MODE_11NG_HT40MINUS_BIT, /* 11N-G HT40 - channels */
  350. REGDMN_MODE_11NA_HT40PLUS = 1 << REGDMN_MODE_11NA_HT40PLUS_BIT, /* 11N-A HT40 + channels */
  351. REGDMN_MODE_11NA_HT40MINUS = 1 << REGDMN_MODE_11NA_HT40MINUS_BIT, /* 11N-A HT40 - channels */
  352. REGDMN_MODE_11AC_VHT20 = 1 << REGDMN_MODE_11AC_VHT20_BIT, /* 5Ghz, VHT20 */
  353. REGDMN_MODE_11AC_VHT40PLUS = 1 << REGDMN_MODE_11AC_VHT40PLUS_BIT, /* 5Ghz, VHT40 + channels */
  354. REGDMN_MODE_11AC_VHT40MINUS = 1 << REGDMN_MODE_11AC_VHT40MINUS_BIT, /* 5Ghz VHT40 - channels */
  355. REGDMN_MODE_11AC_VHT80 = 1 << REGDMN_MODE_11AC_VHT80_BIT, /* 5Ghz, VHT80 channels */
  356. REGDMN_MODE_11AC_VHT20_2G = 1 << REGDMN_MODE_11AC_VHT20_2G_BIT, /* 2Ghz, VHT20 */
  357. REGDMN_MODE_11AC_VHT40_2G = 1 << REGDMN_MODE_11AC_VHT40_2G_BIT, /* 2Ghz, VHT40 */
  358. REGDMN_MODE_11AC_VHT80_2G = 1 << REGDMN_MODE_11AC_VHT80_2G_BIT, /* 2Ghz, VHT80 */
  359. REGDMN_MODE_11AC_VHT160 = 1 << REGDMN_MODE_11AC_VHT160_BIT, /* 5Ghz, VHT160 */
  360. REGDMN_MODE_11AC_VHT40_2GPLUS = 1 << REGDMN_MODE_11AC_VHT40_2GPLUS_BIT, /* 2Ghz, VHT40+ */
  361. REGDMN_MODE_11AC_VHT40_2GMINUS = 1 << REGDMN_MODE_11AC_VHT40_2GMINUS_BIT, /* 2Ghz, VHT40- */
  362. REGDMN_MODE_11AC_VHT80_80 = 1 << REGDMN_MODE_11AC_VHT80_80_BIT, /* 5GHz, VHT80+80 */
  363. };
  364. enum {
  365. REGDMN_MODE_U32_11AXG_HE20 = 1 << (REGDMN_MODE_11AXG_HE20_BIT - 32),
  366. REGDMN_MODE_U32_11AXA_HE20 = 1 << (REGDMN_MODE_11AXA_HE20_BIT - 32),
  367. REGDMN_MODE_U32_11AXG_HE40PLUS = 1 << (REGDMN_MODE_11AXG_HE40PLUS_BIT - 32),
  368. REGDMN_MODE_U32_11AXG_HE40MINUS = 1 << (REGDMN_MODE_11AXG_HE40MINUS_BIT - 32),
  369. REGDMN_MODE_U32_11AXA_HE40PLUS = 1 << (REGDMN_MODE_11AXA_HE40PLUS_BIT - 32),
  370. REGDMN_MODE_U32_11AXA_HE40MINUS = 1 << (REGDMN_MODE_11AXA_HE40MINUS_BIT - 32),
  371. REGDMN_MODE_U32_11AXA_HE80 = 1 << (REGDMN_MODE_11AXA_HE80_BIT - 32),
  372. REGDMN_MODE_U32_11AXA_HE160 = 1 << (REGDMN_MODE_11AXA_HE160_BIT - 32),
  373. REGDMN_MODE_U32_11AXA_HE80_80 = 1 << (REGDMN_MODE_11AXA_HE80_80_BIT - 32),
  374. REGDMN_MODE_U32_11BEG_EHT20 = 1 << (REGDMN_MODE_11BEG_EHT20_BIT - 32),
  375. REGDMN_MODE_U32_11BEA_EHT20 = 1 << (REGDMN_MODE_11BEA_EHT20_BIT - 32),
  376. REGDMN_MODE_U32_11BEG_EHT40PLUS = 1 << (REGDMN_MODE_11BEG_EHT40PLUS_BIT - 32),
  377. REGDMN_MODE_U32_11BEG_EHT40MINUS = 1 << (REGDMN_MODE_11BEG_EHT40MINUS_BIT - 32),
  378. REGDMN_MODE_U32_11BEA_EHT40PLUS = 1 << (REGDMN_MODE_11BEA_EHT40PLUS_BIT - 32),
  379. REGDMN_MODE_U32_11BEA_EHT40MINUS = 1 << (REGDMN_MODE_11BEA_EHT40MINUS_BIT - 32),
  380. REGDMN_MODE_U32_11BEA_EHT80 = 1 << (REGDMN_MODE_11BEA_EHT80_BIT - 32),
  381. REGDMN_MODE_U32_11BEA_EHT160 = 1 << (REGDMN_MODE_11BEA_EHT160_BIT - 32),
  382. REGDMN_MODE_U32_11BEA_EHT320 = 1 << (REGDMN_MODE_11BEA_EHT320_BIT - 32),
  383. };
  384. #define REGDMN_MODE_ALL (0xFFFFFFFF) /* REGDMN_MODE_ALL is defined out of the enum
  385. * to prevent the ARM compile "warning #66:
  386. * enumeration value is out of int range"
  387. * Anyway, this is a BIT-OR of all possible values.
  388. */
  389. #define REGDMN_CAP1_CHAN_HALF_RATE 0x00000001
  390. #define REGDMN_CAP1_CHAN_QUARTER_RATE 0x00000002
  391. #define REGDMN_CAP1_CHAN_HAL49GHZ 0x00000004
  392. /* regulatory capabilities */
  393. #define REGDMN_EEPROM_EEREGCAP_EN_FCC_MIDBAND 0x0040
  394. #define REGDMN_EEPROM_EEREGCAP_EN_KK_U1_EVEN 0x0080
  395. #define REGDMN_EEPROM_EEREGCAP_EN_KK_U2 0x0100
  396. #define REGDMN_EEPROM_EEREGCAP_EN_KK_MIDBAND 0x0200
  397. #define REGDMN_EEPROM_EEREGCAP_EN_KK_U1_ODD 0x0400
  398. #define REGDMN_EEPROM_EEREGCAP_EN_KK_NEW_11A 0x0800
  399. typedef struct {
  400. A_UINT32 tlv_header; /* TLV tag and len; tag equals WMI_TLVTAG_STRUC_HAL_REG_CAPABILITIES */
  401. A_UINT32 eeprom_rd; /* regdomain value specified in EEPROM */
  402. A_UINT32 eeprom_rd_ext; /* regdomain */
  403. A_UINT32 regcap1; /* CAP1 capabilities bit map. */
  404. A_UINT32 regcap2; /* REGDMN EEPROM CAP. */
  405. A_UINT32 wireless_modes; /* REGDMN MODE */
  406. A_UINT32 low_2ghz_chan;
  407. A_UINT32 high_2ghz_chan;
  408. A_UINT32 low_5ghz_chan;
  409. A_UINT32 high_5ghz_chan;
  410. A_UINT32 wireless_modes_ext; /* REGDMN MODE ext */
  411. } HAL_REG_CAPABILITIES;
  412. #ifdef NUM_SPATIAL_STREAM
  413. /*
  414. * The rate control definitions below are only used in the target.
  415. * (Host-based rate control is no longer applicable.)
  416. * Maintain the defs in wlanfw_cmn for the sake of existing Rome / Helium
  417. * targets, but for Lithium targets remove them from wlanfw_cmn and define
  418. * them in a target-only location instead.
  419. * SUPPORT_11AX is essentially used as a condition to identify Lithium targets.
  420. * Some host drivers would also have SUPPORT_11AX defined, and thus would lose
  421. * the definition of RATE_CODE, RC_TX_DONE_PARAMS, and related macros, but
  422. * that's okay because the host should have no references to these
  423. * target-only data structures.
  424. */
  425. #if !((NUM_SPATIAL_STREAM > 4) || SUPPORT_11AX) /* following N/A for Lithium */
  426. /*
  427. * Used to update rate-control logic with the status of the tx-completion.
  428. * In host-based implementation of the rate-control feature, this struture is used to
  429. * create the payload for HTT message/s from target to host.
  430. */
  431. #ifndef CONFIG_MOVE_RC_STRUCT_TO_MACCORE
  432. #if (NUM_SPATIAL_STREAM > 3)
  433. #define A_RATEMASK A_UINT64
  434. #else
  435. #define A_RATEMASK A_UINT32
  436. #endif
  437. #endif /* CONFIG_MOVE_RC_STRUCT_TO_MACCORE */
  438. typedef A_UINT8 A_RATE;
  439. typedef A_UINT8 A_RATECODE;
  440. #define A_RATEMASK_NUM_OCTET (sizeof (A_RATEMASK))
  441. #define A_RATEMASK_NUM_BITS ((sizeof (A_RATEMASK)) << 3)
  442. typedef struct {
  443. A_RATECODE rateCode;
  444. A_UINT8 flags;
  445. } RATE_CODE;
  446. typedef struct {
  447. RATE_CODE ptx_rc; /* rate code, bw, chain mask sgi */
  448. A_UINT8 reserved[2];
  449. A_UINT32 flags; /* Encodes information such as excessive
  450. retransmission, aggregate, some info
  451. from .11 frame control,
  452. STBC, LDPC, (SGI and Tx Chain Mask
  453. are encoded in ptx_rc->flags field),
  454. AMPDU truncation (BT/time based etc.),
  455. RTS/CTS attempt */
  456. A_UINT32 num_enqued; /* # of MPDUs (for non-AMPDU 1) for this rate */
  457. A_UINT32 num_retries; /* Total # of transmission attempt for this rate */
  458. A_UINT32 num_failed; /* # of failed MPDUs in A-MPDU, 0 otherwise */
  459. A_UINT32 ack_rssi; /* ACK RSSI: b'7..b'0 avg RSSI across all chain */
  460. A_UINT32 time_stamp ; /* ACK timestamp (helps determine age) */
  461. A_UINT32 is_probe; /* Valid if probing. Else, 0 */
  462. A_UINT32 ba_win_size; /* b'7..b0, block Ack Window size, b'31..b8 Resvd */
  463. A_UINT32 failed_ba_bmap_0_31; /* failed BA bitmap 0..31 */
  464. A_UINT32 failed_ba_bmap_32_63; /* failed BA bitmap 32..63 */
  465. A_UINT32 bmap_tried_0_31; /* enqued bitmap 0..31 */
  466. A_UINT32 bmap_tried_32_63; /* enqued bitmap 32..63 */
  467. } RC_TX_DONE_PARAMS;
  468. #define RC_SET_TX_DONE_INFO(_dst, _rc, _f, _nq, _nr, _nf, _rssi, _ts) \
  469. do { \
  470. (_dst).ptx_rc.rateCode = (_rc).rateCode; \
  471. (_dst).ptx_rc.flags = (_rc).flags; \
  472. (_dst).flags = (_f); \
  473. (_dst).num_enqued = (_nq); \
  474. (_dst).num_retries = (_nr); \
  475. (_dst).num_failed = (_nf); \
  476. (_dst).ack_rssi = (_rssi); \
  477. (_dst).time_stamp = (_ts); \
  478. } while (0)
  479. #define RC_SET_TXBF_DONE_INFO(_dst, _f) \
  480. do { \
  481. (_dst).flags |= (_f); \
  482. } while (0)
  483. /*
  484. * NOTE: NUM_SCHED_ENTRIES is not used in the host/target interface, but for
  485. * historical reasons has been defined in the host/target interface files.
  486. * The NUM_SCHED_ENTRIES definition is being moved into a target-only
  487. * header file for newer (Lithium) targets, but is being left here for
  488. * non-Lithium cases, to avoid having to rework legacy targets to move
  489. * the NUM_SCHED_ENTRIES definition into a target-only header file.
  490. * Moving the NUM_SCHED_ENTRIES definition into a non-Lithium conditional
  491. * block should have no impact on the host, since the host does not use
  492. * NUM_SCHED_ENTRIES.
  493. */
  494. #define NUM_SCHED_ENTRIES 2
  495. #endif /* !((NUM_SPATIAL_STREAM > 4) || SUPPORT_11AX) */ /* above N/A for Lithium */
  496. #endif /* NUM_SPATIAL_STREAM */
  497. /* NOTE: NUM_DYN_BW cannot be changed without breaking WMI Compatibility */
  498. #define NUM_DYN_BW_MAX 4
  499. /* Some products only use 20/40/80; some use 20/40/80/160 */
  500. #ifndef NUM_DYN_BW
  501. #define NUM_DYN_BW 3 /* default: support up through 80 MHz */
  502. #endif
  503. #define NUM_DYN_BW_MASK 0x3
  504. #define PROD_SCHED_BW_ENTRIES (NUM_SCHED_ENTRIES * NUM_DYN_BW)
  505. #if NUM_DYN_BW > 5
  506. /* Extend rate table module first */
  507. #error "Extend rate table module first"
  508. #endif
  509. #define MAX_IBSS_PEERS 32
  510. #ifdef NUM_SPATIAL_STREAM
  511. /*
  512. * RC_TX_RATE_SCHEDULE and RC_TX_RATE_INFO defs are used only in the target.
  513. * (Host-based rate control is no longer applicable.)
  514. * Maintain the defs in wlanfw_cmn for the sake of existing Rome / Helium
  515. * targets, but for Lithium targets remove them from wlanfw_cmn and define
  516. * them in a target-only location instead.
  517. * SUPPORT_11AX is essentially used as a condition to identify Lithium targets.
  518. * Some host drivers would also have SUPPORT_11AX defined, and thus would lose
  519. * the definition of RC_TX_RATE_SCHEDULE and RC_TX_RATE_INFO, but that's okay
  520. * because the host should have no references to these target-only data
  521. * structures.
  522. */
  523. #ifndef CONFIG_MOVE_RC_STRUCT_TO_MACCORE
  524. #if !((NUM_SPATIAL_STREAM > 4) || SUPPORT_11AX)
  525. #if defined(CONFIG_AR900B_SUPPORT) || defined(AR900B)
  526. typedef struct{
  527. A_UINT32 psdu_len[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  528. A_UINT16 flags[NUM_SCHED_ENTRIES][NUM_DYN_BW];
  529. A_RATE rix[NUM_SCHED_ENTRIES][NUM_DYN_BW];
  530. A_UINT8 tpc[NUM_SCHED_ENTRIES][NUM_DYN_BW];
  531. A_UINT32 antmask[NUM_SCHED_ENTRIES];
  532. A_UINT8 num_mpdus[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  533. A_UINT16 txbf_cv_len;
  534. A_UINT32 txbf_cv_ptr;
  535. A_UINT16 txbf_flags;
  536. A_UINT16 txbf_cv_size;
  537. A_UINT8 txbf_nc_idx;
  538. A_UINT8 tries[NUM_SCHED_ENTRIES];
  539. A_UINT8 bw_mask[NUM_SCHED_ENTRIES];
  540. A_UINT8 max_bw[NUM_SCHED_ENTRIES];
  541. A_UINT8 num_sched_entries;
  542. A_UINT8 paprd_mask;
  543. A_RATE rts_rix;
  544. A_UINT8 sh_pream;
  545. A_UINT8 min_spacing_1_4_us;
  546. A_UINT8 fixed_delims;
  547. A_UINT8 bw_in_service;
  548. A_RATE probe_rix;
  549. A_UINT8 num_valid_rates;
  550. A_UINT8 rtscts_tpc;
  551. A_UINT8 dd_profile;
  552. } RC_TX_RATE_SCHEDULE;
  553. #else
  554. typedef struct{
  555. A_UINT32 psdu_len[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  556. A_UINT16 flags[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  557. A_RATE rix[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  558. A_UINT8 tpc[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  559. A_UINT8 num_mpdus[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  560. A_UINT32 antmask[NUM_SCHED_ENTRIES];
  561. A_UINT32 txbf_cv_ptr;
  562. A_UINT16 txbf_cv_len;
  563. A_UINT8 tries[NUM_SCHED_ENTRIES];
  564. A_UINT8 num_valid_rates;
  565. A_UINT8 paprd_mask;
  566. A_RATE rts_rix;
  567. A_UINT8 sh_pream;
  568. A_UINT8 min_spacing_1_4_us;
  569. A_UINT8 fixed_delims;
  570. A_UINT8 bw_in_service;
  571. A_RATE probe_rix;
  572. } RC_TX_RATE_SCHEDULE;
  573. #endif
  574. typedef struct{
  575. A_UINT16 flags[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  576. A_RATE rix[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  577. #ifdef DYN_TPC_ENABLE
  578. A_UINT8 tpc[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  579. #endif
  580. #ifdef SECTORED_ANTENNA
  581. A_UINT32 antmask[NUM_SCHED_ENTRIES];
  582. #endif
  583. A_UINT8 tries[NUM_SCHED_ENTRIES];
  584. A_UINT8 num_valid_rates;
  585. A_RATE rts_rix;
  586. A_UINT8 sh_pream;
  587. A_UINT8 bw_in_service;
  588. A_RATE probe_rix;
  589. A_UINT8 dd_profile;
  590. } RC_TX_RATE_INFO;
  591. #endif /* !((NUM_SPATIAL_STREAM > 4) || SUPPORT_11AX) */
  592. #endif /* CONFIG_MOVE_RC_STRUCT_TO_MACCORE */
  593. #endif
  594. /*
  595. * Temporarily continue to provide the WHAL_RC_INIT_RC_MASKS def in wlan_defs.h
  596. * for older targets.
  597. * The WHAL_RX_INIT_RC_MASKS macro def needs to be moved into ratectrl_11ac.h
  598. * for all targets, but until this is complete, the WHAL_RC_INIT_RC_MASKS def
  599. * will be maintained here in its old location.
  600. */
  601. #ifndef CONFIG_160MHZ_SUPPORT
  602. #define WHAL_RC_INIT_RC_MASKS(_rm) do { \
  603. _rm[WHAL_RC_MASK_IDX_NON_HT] = A_RATEMASK_OFDM_CCK; \
  604. _rm[WHAL_RC_MASK_IDX_HT_20] = A_RATEMASK_HT_20; \
  605. _rm[WHAL_RC_MASK_IDX_HT_40] = A_RATEMASK_HT_40; \
  606. _rm[WHAL_RC_MASK_IDX_VHT_20] = A_RATEMASK_VHT_20; \
  607. _rm[WHAL_RC_MASK_IDX_VHT_40] = A_RATEMASK_VHT_40; \
  608. _rm[WHAL_RC_MASK_IDX_VHT_80] = A_RATEMASK_VHT_80; \
  609. } while (0)
  610. #endif
  611. /**
  612. * strucutre describing host memory chunk.
  613. */
  614. typedef struct {
  615. A_UINT32 tlv_header; /* TLV tag and len; tag equals WMITLV_TAG_STRUC_wlan_host_memory_chunk */
  616. /** id of the request that is passed up in service ready */
  617. A_UINT32 req_id;
  618. /** the physical address the memory chunk */
  619. A_UINT32 ptr;
  620. /** size of the chunk */
  621. A_UINT32 size;
  622. /** ptr_high
  623. * most significant bits of physical address of the memory chunk
  624. * Only applicable for addressing more than 32 bit.
  625. * This will only be non-zero if the target has set
  626. * WMI_SERVICE_SUPPORT_EXTEND_ADDRESS flag.
  627. */
  628. A_UINT32 ptr_high;
  629. } wlan_host_memory_chunk;
  630. #define NUM_UNITS_IS_NUM_VDEVS 0x1
  631. #define NUM_UNITS_IS_NUM_PEERS 0x2
  632. #define NUM_UNITS_IS_NUM_ACTIVE_PEERS 0x4
  633. /* request host to allocate memory contiguously */
  634. #define REQ_TO_HOST_FOR_CONT_MEMORY 0x8
  635. /**
  636. * structure used by FW for requesting host memory
  637. */
  638. typedef struct {
  639. A_UINT32 tlv_header; /* TLV tag and len; tag equals WMI_TLVTAG_STRUC_wlan_host_mem_req */
  640. /** ID of the request */
  641. A_UINT32 req_id;
  642. /** size of the of each unit */
  643. A_UINT32 unit_size;
  644. /**
  645. * flags to indicate that
  646. * the number units is dependent
  647. * on number of resources(num vdevs num peers .. etc)
  648. */
  649. A_UINT32 num_unit_info;
  650. /*
  651. * actual number of units to allocate . if flags in the num_unit_info
  652. * indicate that number of units is tied to number of a particular
  653. * resource to allocate then num_units filed is set to 0 and host
  654. * will derive the number units from number of the resources it is
  655. * requesting.
  656. */
  657. A_UINT32 num_units;
  658. } wlan_host_mem_req;
  659. typedef enum {
  660. IGNORE_DTIM = 0x01,
  661. NORMAL_DTIM = 0x02,
  662. STICK_DTIM = 0x03,
  663. AUTO_DTIM = 0x04,
  664. } BEACON_DTIM_POLICY;
  665. /* During test it is observed that 6 * 400 = 2400 can
  666. * be alloced in addition to CFG_TGT_NUM_MSDU_DESC.
  667. * If there is any change memory requirement, this number
  668. * needs to be revisited. */
  669. #define TOTAL_VOW_ALLOCABLE 2400
  670. #define VOW_DESC_GRAB_MAX 800
  671. #define VOW_GET_NUM_VI_STA(vow_config) (((vow_config) & 0xffff0000) >> 16)
  672. #define VOW_GET_DESC_PER_VI_STA(vow_config) ((vow_config) & 0x0000ffff)
  673. /***TODO!!! Get these values dynamically in WMI_READY event and use it to calculate the mem req*/
  674. /* size in bytes required for msdu descriptor. If it changes, this should be updated. LARGE_AP
  675. * case is not considered. LARGE_AP is disabled when VoW is enabled.*/
  676. #define MSDU_DESC_SIZE 20
  677. /* size in bytes required to support a peer in target.
  678. * This obtained by considering Two tids per peer.
  679. * peer structure = 168 bytes
  680. * tid = 96 bytes (per sta 2 means we need 192 bytes)
  681. * peer_cb = 16 * 2
  682. * key = 52 * 2
  683. * AST = 12 * 2
  684. * rate, reorder.. = 384
  685. * smart antenna = 50
  686. */
  687. #define MEMORY_REQ_FOR_PEER 800
  688. /*
  689. * NB: it is important to keep all the fields in the structure dword long
  690. * so that it is easy to handle the statistics in BE host.
  691. */
  692. /*
  693. * wlan_dbg_tx_stats_v1, _v2:
  694. * differing versions of the wlan_dbg_tx_stats struct used by different
  695. * targets
  696. */
  697. struct wlan_dbg_tx_stats_v1 {
  698. /* Num HTT cookies queued to dispatch list */
  699. A_INT32 comp_queued;
  700. /* Num HTT cookies dispatched */
  701. A_INT32 comp_delivered;
  702. /* Num MSDU queued to WAL */
  703. A_INT32 msdu_enqued;
  704. /* Num MPDU queue to WAL */
  705. A_INT32 mpdu_enqued;
  706. /* Num MSDUs dropped by WMM limit */
  707. A_INT32 wmm_drop;
  708. /* Num Local frames queued */
  709. A_INT32 local_enqued;
  710. /* Num Local frames done */
  711. A_INT32 local_freed;
  712. /* Num queued to HW */
  713. A_INT32 hw_queued;
  714. /* Num PPDU reaped from HW */
  715. A_INT32 hw_reaped;
  716. /* Num underruns */
  717. A_INT32 underrun;
  718. /* Num PPDUs cleaned up in TX abort */
  719. A_INT32 tx_abort;
  720. /* Num MPDUs requed by SW */
  721. A_INT32 mpdus_requed;
  722. /* excessive retries */
  723. A_UINT32 tx_ko;
  724. /* data hw rate code */
  725. A_UINT32 data_rc;
  726. /* Scheduler self triggers */
  727. A_UINT32 self_triggers;
  728. /* frames dropped due to excessive sw retries */
  729. A_UINT32 sw_retry_failure;
  730. /* illegal rate phy errors */
  731. A_UINT32 illgl_rate_phy_err;
  732. /* wal pdev continous xretry */
  733. A_UINT32 pdev_cont_xretry;
  734. /* wal pdev continous xretry */
  735. A_UINT32 pdev_tx_timeout;
  736. /* wal pdev resets */
  737. A_UINT32 pdev_resets;
  738. /* frames dropped due to non-availability of stateless TIDs */
  739. A_UINT32 stateless_tid_alloc_failure;
  740. /* PhY/BB underrun */
  741. A_UINT32 phy_underrun;
  742. /* MPDU is more than txop limit */
  743. A_UINT32 txop_ovf;
  744. };
  745. struct wlan_dbg_tx_stats_v2 {
  746. /* Num HTT cookies queued to dispatch list */
  747. A_INT32 comp_queued;
  748. /* Num HTT cookies dispatched */
  749. A_INT32 comp_delivered;
  750. /* Num MSDU queued to WAL */
  751. A_INT32 msdu_enqued;
  752. /* Num MPDU queue to WAL */
  753. A_INT32 mpdu_enqued;
  754. /* Num MSDUs dropped by WMM limit */
  755. A_INT32 wmm_drop;
  756. /* Num Local frames queued */
  757. A_INT32 local_enqued;
  758. /* Num Local frames done */
  759. A_INT32 local_freed;
  760. /* Num queued to HW */
  761. A_INT32 hw_queued;
  762. /* Num PPDU reaped from HW */
  763. A_INT32 hw_reaped;
  764. /* Num underruns */
  765. A_INT32 underrun;
  766. /* HW Paused. */
  767. A_UINT32 hw_paused;
  768. /* Num PPDUs cleaned up in TX abort */
  769. A_INT32 tx_abort;
  770. /* Num MPDUs requed by SW */
  771. A_INT32 mpdus_requed;
  772. /* excessive retries */
  773. A_UINT32 tx_ko;
  774. A_UINT32 tx_xretry;
  775. /* data hw rate code */
  776. A_UINT32 data_rc;
  777. /* Scheduler self triggers */
  778. A_UINT32 self_triggers;
  779. /* frames dropped due to excessive sw retries */
  780. A_UINT32 sw_retry_failure;
  781. /* illegal rate phy errors */
  782. A_UINT32 illgl_rate_phy_err;
  783. /* wal pdev continous xretry */
  784. A_UINT32 pdev_cont_xretry;
  785. /* wal pdev continous xretry */
  786. A_UINT32 pdev_tx_timeout;
  787. /* wal pdev resets */
  788. A_UINT32 pdev_resets;
  789. /* frames dropped due to non-availability of stateless TIDs */
  790. A_UINT32 stateless_tid_alloc_failure;
  791. /* PhY/BB underrun */
  792. A_UINT32 phy_underrun;
  793. /* MPDU is more than txop limit */
  794. A_UINT32 txop_ovf;
  795. /* Number of Sequences posted */
  796. A_UINT32 seq_posted;
  797. /* Number of Sequences failed queueing */
  798. A_UINT32 seq_failed_queueing;
  799. /* Number of Sequences completed */
  800. A_UINT32 seq_completed;
  801. /* Number of Sequences restarted */
  802. A_UINT32 seq_restarted;
  803. /* Number of MU Sequences posted */
  804. A_UINT32 mu_seq_posted;
  805. /* Num MPDUs flushed by SW, HWPAUSED, SW TXABORT (Reset,channel change) */
  806. A_INT32 mpdus_sw_flush;
  807. /* Num MPDUs filtered by HW, all filter condition (TTL expired) */
  808. A_INT32 mpdus_hw_filter;
  809. /* Num MPDUs truncated by PDG (TXOP, TBTT, PPDU_duration based on rate, dyn_bw) */
  810. A_INT32 mpdus_truncated;
  811. /* Num MPDUs that was tried but didn't receive ACK or BA */
  812. A_INT32 mpdus_ack_failed;
  813. /* Num MPDUs that was dropped du to expiry. */
  814. A_INT32 mpdus_expired;
  815. };
  816. #if defined(AR900B)
  817. #define wlan_dbg_tx_stats wlan_dbg_tx_stats_v2
  818. #else
  819. #define wlan_dbg_tx_stats wlan_dbg_tx_stats_v1
  820. #endif
  821. /*
  822. * wlan_dbg_rx_stats_v1, _v2:
  823. * differing versions of the wlan_dbg_rx_stats struct used by different
  824. * targets
  825. */
  826. struct wlan_dbg_rx_stats_v1 {
  827. /* Cnts any change in ring routing mid-ppdu */
  828. A_INT32 mid_ppdu_route_change;
  829. /* Total number of statuses processed */
  830. A_INT32 status_rcvd;
  831. /* Extra frags on rings 0-3 */
  832. A_INT32 r0_frags;
  833. A_INT32 r1_frags;
  834. A_INT32 r2_frags;
  835. A_INT32 r3_frags;
  836. /* MSDUs / MPDUs delivered to HTT */
  837. A_INT32 htt_msdus;
  838. A_INT32 htt_mpdus;
  839. /* MSDUs / MPDUs delivered to local stack */
  840. A_INT32 loc_msdus;
  841. A_INT32 loc_mpdus;
  842. /* AMSDUs that have more MSDUs than the status ring size */
  843. A_INT32 oversize_amsdu;
  844. /* Number of PHY errors */
  845. A_INT32 phy_errs;
  846. /* Number of PHY errors drops */
  847. A_INT32 phy_err_drop;
  848. /* Number of mpdu errors - FCS, MIC, ENC etc. */
  849. A_INT32 mpdu_errs;
  850. };
  851. struct wlan_dbg_rx_stats_v2 {
  852. /* Cnts any change in ring routing mid-ppdu */
  853. A_INT32 mid_ppdu_route_change;
  854. /* Total number of statuses processed */
  855. A_INT32 status_rcvd;
  856. /* Extra frags on rings 0-3 */
  857. A_INT32 r0_frags;
  858. A_INT32 r1_frags;
  859. A_INT32 r2_frags;
  860. A_INT32 r3_frags;
  861. /* MSDUs / MPDUs delivered to HTT */
  862. A_INT32 htt_msdus;
  863. A_INT32 htt_mpdus;
  864. /* MSDUs / MPDUs delivered to local stack */
  865. A_INT32 loc_msdus;
  866. A_INT32 loc_mpdus;
  867. /* AMSDUs that have more MSDUs than the status ring size */
  868. A_INT32 oversize_amsdu;
  869. /* Number of PHY errors */
  870. A_INT32 phy_errs;
  871. /* Number of PHY errors drops */
  872. A_INT32 phy_err_drop;
  873. /* Number of mpdu errors - FCS, MIC, ENC etc. */
  874. A_INT32 mpdu_errs;
  875. /* Number of rx overflow errors. */
  876. A_INT32 rx_ovfl_errs;
  877. };
  878. #if defined(AR900B)
  879. #define wlan_dbg_rx_stats wlan_dbg_rx_stats_v2
  880. #else
  881. #define wlan_dbg_rx_stats wlan_dbg_rx_stats_v1
  882. #endif
  883. struct wlan_dbg_mem_stats {
  884. A_UINT32 iram_free_size;
  885. A_UINT32 dram_free_size;
  886. };
  887. struct wlan_dbg_peer_stats {
  888. A_INT32 dummy; /* REMOVE THIS ONCE REAL PEER STAT COUNTERS ARE ADDED */
  889. };
  890. /*
  891. * wlan_dbg_rx_rate_info_v1a_t, _v1b_t:
  892. * differing versions of the wlan_dbg_rx_rate_info struct used by different
  893. * targets
  894. */
  895. typedef struct {
  896. A_UINT32 mcs[10];
  897. A_UINT32 sgi[10];
  898. A_UINT32 nss[4];
  899. A_UINT32 nsts;
  900. A_UINT32 stbc[10];
  901. A_UINT32 bw[3];
  902. A_UINT32 pream[6];
  903. A_UINT32 ldpc;
  904. A_UINT32 txbf;
  905. A_UINT32 mgmt_rssi;
  906. A_UINT32 data_rssi;
  907. A_UINT32 rssi_chain0;
  908. A_UINT32 rssi_chain1;
  909. A_UINT32 rssi_chain2;
  910. } wlan_dbg_rx_rate_info_v1a_t;
  911. typedef struct {
  912. A_UINT32 mcs[10];
  913. A_UINT32 sgi[10];
  914. A_UINT32 nss[4];
  915. A_UINT32 nsts;
  916. A_UINT32 stbc[10];
  917. A_UINT32 bw[3];
  918. A_UINT32 pream[6];
  919. A_UINT32 ldpc;
  920. A_UINT32 txbf;
  921. A_UINT32 mgmt_rssi;
  922. A_UINT32 data_rssi;
  923. A_UINT32 rssi_chain0;
  924. A_UINT32 rssi_chain1;
  925. A_UINT32 rssi_chain2;
  926. /*
  927. * TEMPORARY: leave rssi_chain3 in place for AR900B builds until code using
  928. * rssi_chain3 has been converted to use wlan_dbg_rx_rate_info_v2_t.
  929. */
  930. A_UINT32 rssi_chain3;
  931. } wlan_dbg_rx_rate_info_v1b_t;
  932. #if defined(AR900B)
  933. #define wlan_dbg_rx_rate_info_t wlan_dbg_rx_rate_info_v1b_t
  934. #else
  935. #define wlan_dbg_rx_rate_info_t wlan_dbg_rx_rate_info_v1a_t
  936. #endif
  937. typedef struct {
  938. A_UINT32 mcs[10];
  939. A_UINT32 sgi[10];
  940. /*
  941. * TEMPORARY: leave nss conditionally defined, until all code that
  942. * requires nss[4] is converted to use wlan_dbg_tx_rate_info_v2_t.
  943. * At that time, this nss array will be made length = 3 unconditionally.
  944. */
  945. #if defined(CONFIG_AR900B_SUPPORT) || defined(AR900B)
  946. A_UINT32 nss[4];
  947. #else
  948. A_UINT32 nss[3];
  949. #endif
  950. A_UINT32 stbc[10];
  951. A_UINT32 bw[3];
  952. A_UINT32 pream[4];
  953. A_UINT32 ldpc;
  954. A_UINT32 rts_cnt;
  955. A_UINT32 ack_rssi;
  956. } wlan_dbg_tx_rate_info_t ;
  957. #define WLAN_MAX_MCS 10
  958. typedef struct {
  959. A_UINT32 mcs[WLAN_MAX_MCS];
  960. A_UINT32 sgi[WLAN_MAX_MCS];
  961. A_UINT32 nss[MAX_SPATIAL_STREAM_ANY_V2];
  962. A_UINT32 nsts;
  963. A_UINT32 stbc[WLAN_MAX_MCS];
  964. A_UINT32 bw[NUM_DYN_BW_MAX];
  965. A_UINT32 pream[6];
  966. A_UINT32 ldpc;
  967. A_UINT32 txbf;
  968. A_UINT32 mgmt_rssi;
  969. A_UINT32 data_rssi;
  970. A_UINT32 rssi_chain0;
  971. A_UINT32 rssi_chain1;
  972. A_UINT32 rssi_chain2;
  973. A_UINT32 rssi_chain3;
  974. A_UINT32 reserved[8];
  975. } wlan_dbg_rx_rate_info_v2_t;
  976. typedef struct {
  977. A_UINT32 mcs[WLAN_MAX_MCS];
  978. A_UINT32 sgi[WLAN_MAX_MCS];
  979. A_UINT32 nss[MAX_SPATIAL_STREAM_ANY_V2];
  980. A_UINT32 stbc[WLAN_MAX_MCS];
  981. A_UINT32 bw[NUM_DYN_BW_MAX];
  982. A_UINT32 pream[4];
  983. A_UINT32 ldpc;
  984. A_UINT32 rts_cnt;
  985. A_UINT32 ack_rssi;
  986. A_UINT32 reserved[8];
  987. } wlan_dbg_tx_rate_info_v2_t;
  988. typedef struct {
  989. A_UINT32 mcs[WLAN_MAX_MCS];
  990. A_UINT32 sgi[WLAN_MAX_MCS];
  991. A_UINT32 nss[MAX_SPATIAL_STREAM_ANY_V3];
  992. A_UINT32 nsts;
  993. A_UINT32 stbc[WLAN_MAX_MCS];
  994. A_UINT32 bw[NUM_DYN_BW_MAX];
  995. A_UINT32 pream[6];
  996. A_UINT32 ldpc;
  997. A_UINT32 txbf;
  998. A_UINT32 mgmt_rssi;
  999. A_UINT32 data_rssi;
  1000. A_UINT32 rssi_chain0;
  1001. A_UINT32 rssi_chain1;
  1002. A_UINT32 rssi_chain2;
  1003. A_UINT32 rssi_chain3;
  1004. A_UINT32 reserved[8];
  1005. } wlan_dbg_rx_rate_info_v3_t;
  1006. typedef struct {
  1007. A_UINT32 mcs[WLAN_MAX_MCS];
  1008. A_UINT32 sgi[WLAN_MAX_MCS];
  1009. A_UINT32 nss[MAX_SPATIAL_STREAM_ANY_V3];
  1010. A_UINT32 stbc[WLAN_MAX_MCS];
  1011. A_UINT32 bw[NUM_DYN_BW_MAX];
  1012. A_UINT32 pream[4];
  1013. A_UINT32 ldpc;
  1014. A_UINT32 rts_cnt;
  1015. A_UINT32 ack_rssi;
  1016. A_UINT32 reserved[8];
  1017. } wlan_dbg_tx_rate_info_v3_t;
  1018. #define WHAL_DBG_PHY_ERR_MAXCNT 18
  1019. #define WHAL_DBG_SIFS_STATUS_MAXCNT 8
  1020. #define WHAL_DBG_SIFS_ERR_MAXCNT 8
  1021. #define WHAL_DBG_CMD_RESULT_MAXCNT 11
  1022. #define WHAL_DBG_CMD_STALL_ERR_MAXCNT 4
  1023. #define WHAL_DBG_FLUSH_REASON_MAXCNT 40
  1024. typedef enum {
  1025. WIFI_URRN_STATS_FIRST_PKT,
  1026. WIFI_URRN_STATS_BETWEEN_MPDU,
  1027. WIFI_URRN_STATS_WITHIN_MPDU,
  1028. WHAL_MAX_URRN_STATS
  1029. } wifi_urrn_type_t;
  1030. typedef struct wlan_dbg_txbf_snd_stats {
  1031. A_UINT32 cbf_20[4];
  1032. A_UINT32 cbf_40[4];
  1033. A_UINT32 cbf_80[4];
  1034. A_UINT32 sounding[9];
  1035. A_UINT32 cbf_160[4];
  1036. } wlan_dbg_txbf_snd_stats_t;
  1037. typedef struct wlan_dbg_wifi2_error_stats {
  1038. A_UINT32 urrn_stats[WHAL_MAX_URRN_STATS];
  1039. A_UINT32 flush_errs[WHAL_DBG_FLUSH_REASON_MAXCNT];
  1040. A_UINT32 schd_stall_errs[WHAL_DBG_CMD_STALL_ERR_MAXCNT];
  1041. A_UINT32 schd_cmd_result[WHAL_DBG_CMD_RESULT_MAXCNT];
  1042. A_UINT32 sifs_status[WHAL_DBG_SIFS_STATUS_MAXCNT];
  1043. A_UINT8 phy_errs[WHAL_DBG_PHY_ERR_MAXCNT];
  1044. A_UINT32 rx_rate_inval;
  1045. } wlan_dbg_wifi2_error_stats_t;
  1046. typedef struct wlan_dbg_wifi2_error2_stats {
  1047. A_UINT32 schd_errs[WHAL_DBG_CMD_STALL_ERR_MAXCNT];
  1048. A_UINT32 sifs_errs[WHAL_DBG_SIFS_ERR_MAXCNT];
  1049. } wlan_dbg_wifi2_error2_stats_t;
  1050. #define WLAN_DBG_STATS_SIZE_TXBF_VHT 10
  1051. #define WLAN_DBG_STATS_SIZE_TXBF_HT 8
  1052. #define WLAN_DBG_STATS_SIZE_TXBF_OFDM 8
  1053. #define WLAN_DBG_STATS_SIZE_TXBF_CCK 7
  1054. typedef struct wlan_dbg_txbf_data_stats {
  1055. A_UINT32 tx_txbf_vht[WLAN_DBG_STATS_SIZE_TXBF_VHT];
  1056. A_UINT32 rx_txbf_vht[WLAN_DBG_STATS_SIZE_TXBF_VHT];
  1057. A_UINT32 tx_txbf_ht[WLAN_DBG_STATS_SIZE_TXBF_HT];
  1058. A_UINT32 tx_txbf_ofdm[WLAN_DBG_STATS_SIZE_TXBF_OFDM];
  1059. A_UINT32 tx_txbf_cck[WLAN_DBG_STATS_SIZE_TXBF_CCK];
  1060. } wlan_dbg_txbf_data_stats_t;
  1061. struct wlan_dbg_tx_mu_stats {
  1062. A_UINT32 mu_sch_nusers_2;
  1063. A_UINT32 mu_sch_nusers_3;
  1064. A_UINT32 mu_mpdus_queued_usr[4];
  1065. A_UINT32 mu_mpdus_tried_usr[4];
  1066. A_UINT32 mu_mpdus_failed_usr[4];
  1067. A_UINT32 mu_mpdus_requeued_usr[4];
  1068. A_UINT32 mu_err_no_ba_usr[4];
  1069. A_UINT32 mu_mpdu_underrun_usr[4];
  1070. A_UINT32 mu_ampdu_underrun_usr[4];
  1071. };
  1072. struct wlan_dbg_tx_selfgen_stats {
  1073. A_UINT32 su_ndpa;
  1074. A_UINT32 su_ndp;
  1075. A_UINT32 mu_ndpa;
  1076. A_UINT32 mu_ndp;
  1077. A_UINT32 mu_brpoll_1;
  1078. A_UINT32 mu_brpoll_2;
  1079. A_UINT32 mu_bar_1;
  1080. A_UINT32 mu_bar_2;
  1081. A_UINT32 cts_burst;
  1082. A_UINT32 su_ndp_err;
  1083. A_UINT32 su_ndpa_err;
  1084. A_UINT32 mu_ndp_err;
  1085. A_UINT32 mu_brp1_err;
  1086. A_UINT32 mu_brp2_err;
  1087. };
  1088. typedef struct wlan_dbg_sifs_resp_stats {
  1089. A_UINT32 ps_poll_trigger; /* num ps-poll trigger frames */
  1090. A_UINT32 uapsd_trigger; /* num uapsd trigger frames */
  1091. A_UINT32 qb_data_trigger[2]; /* num data trigger frames; idx 0: explicit and idx 1: implicit */
  1092. A_UINT32 qb_bar_trigger[2]; /* num bar trigger frames; idx 0: explicit and idx 1: implicit */
  1093. A_UINT32 sifs_resp_data; /* num ppdus transmitted at SIFS interval */
  1094. A_UINT32 sifs_resp_err; /* num ppdus failed to meet SIFS resp timing */
  1095. } wlan_dgb_sifs_resp_stats_t;
  1096. /** wlan_dbg_wifi2_error_stats_t is not grouped with the
  1097. * following structure as it is allocated differently and only
  1098. * belongs to whal
  1099. */
  1100. typedef struct wlan_dbg_stats_wifi2 {
  1101. wlan_dbg_txbf_snd_stats_t txbf_snd_info;
  1102. wlan_dbg_txbf_data_stats_t txbf_data_info;
  1103. struct wlan_dbg_tx_selfgen_stats tx_selfgen;
  1104. struct wlan_dbg_tx_mu_stats tx_mu;
  1105. wlan_dgb_sifs_resp_stats_t sifs_resp_info;
  1106. } wlan_dbg_wifi2_stats_t;
  1107. /*
  1108. * wlan_dbg_rx_rate_info_v1a, _v1b:
  1109. * differing versions of the wlan_dbg_rx_rate_info struct used by different
  1110. * targets
  1111. */
  1112. typedef struct {
  1113. wlan_dbg_rx_rate_info_v1a_t rx_phy_info;
  1114. wlan_dbg_tx_rate_info_t tx_rate_info;
  1115. } wlan_dbg_rate_info_v1a_t;
  1116. typedef struct {
  1117. wlan_dbg_rx_rate_info_v1b_t rx_phy_info;
  1118. wlan_dbg_tx_rate_info_t tx_rate_info;
  1119. } wlan_dbg_rate_info_v1b_t;
  1120. #if defined(AR900B)
  1121. #define wlan_dbg_rate_info_t wlan_dbg_rate_info_v1b_t
  1122. #else
  1123. #define wlan_dbg_rate_info_t wlan_dbg_rate_info_v1a_t
  1124. #endif
  1125. typedef struct {
  1126. wlan_dbg_rx_rate_info_v2_t rx_phy_info;
  1127. wlan_dbg_tx_rate_info_v2_t tx_rate_info;
  1128. } wlan_dbg_rate_info_v2_t;
  1129. /*
  1130. * wlan_dbg_stats_v1, _v2:
  1131. * differing versions of the wlan_dbg_stats struct used by different
  1132. * targets
  1133. */
  1134. struct wlan_dbg_stats_v1 {
  1135. struct wlan_dbg_tx_stats_v1 tx;
  1136. struct wlan_dbg_rx_stats_v1 rx;
  1137. struct wlan_dbg_peer_stats peer;
  1138. };
  1139. struct wlan_dbg_stats_v2 {
  1140. struct wlan_dbg_tx_stats_v2 tx;
  1141. struct wlan_dbg_rx_stats_v2 rx;
  1142. struct wlan_dbg_mem_stats mem;
  1143. struct wlan_dbg_peer_stats peer;
  1144. };
  1145. #if defined(AR900B)
  1146. #define wlan_dbg_stats wlan_dbg_stats_v2
  1147. #else
  1148. #define wlan_dbg_stats wlan_dbg_stats_v1
  1149. #endif
  1150. #define DBG_STATS_MAX_HWQ_NUM 10
  1151. #define DBG_STATS_MAX_TID_NUM 20
  1152. #define DBG_STATS_MAX_CONG_NUM 16
  1153. struct wlan_dbg_txq_stats {
  1154. A_UINT16 num_pkts_queued[DBG_STATS_MAX_HWQ_NUM];
  1155. A_UINT16 tid_hw_qdepth[DBG_STATS_MAX_TID_NUM]; /* WAL_MAX_TID is 20 */
  1156. A_UINT16 tid_sw_qdepth[DBG_STATS_MAX_TID_NUM]; /* WAL_MAX_TID is 20 */
  1157. };
  1158. struct wlan_dbg_tidq_stats {
  1159. A_UINT32 wlan_dbg_tid_txq_status;
  1160. struct wlan_dbg_txq_stats txq_st;
  1161. };
  1162. typedef enum {
  1163. WLAN_DBG_DATA_STALL_NONE = 0,
  1164. WLAN_DBG_DATA_STALL_VDEV_PAUSE, /* 1 */
  1165. WLAN_DBG_DATA_STALL_HWSCHED_CMD_FILTER, /* 2 */
  1166. WLAN_DBG_DATA_STALL_HWSCHED_CMD_FLUSH, /* 3 */
  1167. WLAN_DBG_DATA_STALL_RX_REFILL_FAILED, /* 4 */
  1168. WLAN_DBG_DATA_STALL_RX_FCS_LEN_ERROR, /* 5 */
  1169. WLAN_DBG_DATA_STALL_MAC_WDOG_ERRORS, /* 6 */ /* Mac watch dog */
  1170. WLAN_DBG_DATA_STALL_PHY_BB_WDOG_ERROR, /* 7 */ /* PHY watch dog */
  1171. WLAN_DBG_DATA_STALL_POST_TIM_NO_TXRX_ERROR, /* 8 */
  1172. WLAN_DBG_DATA_STALL_MAX,
  1173. } wlan_dbg_data_stall_type_e;
  1174. typedef enum {
  1175. WLAN_DBG_DATA_STALL_RECOVERY_NONE = 0,
  1176. WLAN_DBG_DATA_STALL_RECOVERY_CONNECT_DISCONNECT,
  1177. WLAN_DBG_DATA_STALL_RECOVERY_CONNECT_MAC_PHY_RESET,
  1178. WLAN_DBG_DATA_STALL_RECOVERY_CONNECT_PDR,
  1179. WLAN_DBG_DATA_STALL_RECOVERY_CONNECT_SSR,
  1180. } wlan_dbg_data_stall_recovery_type_e;
  1181. /*
  1182. * NOTE: If necessary, restore the explicit disabling of CONFIG_160MHZ_SUPPORT
  1183. * See the corresponding comment + pre-processor block at the top of the file.
  1184. */
  1185. #ifdef CONFIG_160MHZ_SUPPORT_UNDEF_WAR
  1186. #define CONFIG_160MHZ_SUPPORT 0
  1187. #undef CONFIG_160MHZ_SUPPORT_UNDEF_WAR
  1188. #endif
  1189. /** MGMT RX REO Changes */
  1190. /* Macros for having versioning info for compatibility check between host and firmware */
  1191. #define MLO_SHMEM_MAJOR_VERSION 1
  1192. #define MLO_SHMEM_MINOR_VERSION 1
  1193. /** Helper Macros for tlv header of the given tlv buffer */
  1194. /* Size of the TLV Header which is the Tag and Length fields */
  1195. #define MLO_SHMEM_TLV_HDR_SIZE (1 * sizeof(A_UINT32))
  1196. /* TLV Helper macro to get the TLV Header given the pointer to the TLV buffer. */
  1197. #define MLO_SHMEMTLV_GET_HDR(tlv_buf) (((A_UINT32 *) (tlv_buf))[0])
  1198. /* TLV Helper macro to set the TLV Header given the pointer to the TLV buffer. */
  1199. #define MLO_SHMEMTLV_SET_HDR(tlv_buf, tag, len) \
  1200. (((A_UINT32 *)(tlv_buf))[0]) = ((tag << 16) | (len & 0x0000FFFF))
  1201. /* TLV Helper macro to get the TLV Tag given the TLV header. */
  1202. #define MLO_SHMEMTLV_GET_TLVTAG(tlv_header) ((A_UINT32)((tlv_header) >> 16))
  1203. /*
  1204. * TLV Helper macro to get the TLV Buffer Length (minus TLV header size)
  1205. * given the TLV header.
  1206. */
  1207. #define MLO_SHMEMTLV_GET_TLVLEN(tlv_header) \
  1208. ((A_UINT32)((tlv_header) & 0x0000FFFF))
  1209. /*
  1210. * TLV Helper macro to get the TLV length from TLV structure size
  1211. * by removing TLV header size.
  1212. */
  1213. #define MLO_SHMEMTLV_GET_STRUCT_TLVLEN(tlv_struct) \
  1214. ((A_UINT32)(sizeof(tlv_struct)-MLO_SHMEM_TLV_HDR_SIZE))
  1215. /**
  1216. * Helper Macros for getting and setting the required number of bits
  1217. * from the TLV params.
  1218. */
  1219. #define MLO_SHMEM_GET_BITS(_val,_index,_num_bits) \
  1220. (((_val) >> (_index)) & ((1 << (_num_bits)) - 1))
  1221. #define MLO_SHMEM_SET_BITS(_var,_index,_num_bits,_val) \
  1222. do { \
  1223. (_var) &= ~(((1 << (_num_bits)) - 1) << (_index)); \
  1224. (_var) |= (((_val) & ((1 << (_num_bits)) - 1)) << (_index)); \
  1225. } while (0)
  1226. /** Definition of the GLB_H_SHMEM arena tlv structures */
  1227. typedef enum {
  1228. MLO_SHMEM_TLV_STRUCT_MGMT_RX_REO_SNAPSHOT,
  1229. MLO_SHMEM_TLV_STRUCT_MLO_GLB_RX_REO_PER_LINK_SNAPSHOT_INFO,
  1230. MLO_SHMEM_TLV_STRUCT_MLO_GLB_RX_REO_SNAPSHOT_INFO,
  1231. MLO_SHMEM_TLV_STRUCT_MLO_GLB_LINK,
  1232. MLO_SHMEM_TLV_STRUCT_MLO_GLB_LINK_INFO,
  1233. MLO_SHMEM_TLV_STRUCT_MLO_GLB_H_SHMEM,
  1234. } MLO_SHMEM_TLV_TAG_ID;
  1235. /** Helper macro for params GET/SET of mgmt_rx_reo_snapshot */
  1236. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_VALID_GET(mgmt_rx_reo_snapshot_low) MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot_low, 0, 1)
  1237. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_VALID_SET(mgmt_rx_reo_snapshot_low, value) MLO_SHMEM_SET_BITS(mgmt_rx_reo_snapshot_low, 0, 1, value)
  1238. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_MGMT_PKT_CTR_GET(mgmt_rx_reo_snapshot_low) MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot_low, 1, 16)
  1239. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_MGMT_PKT_CTR_SET(mgmt_rx_reo_snapshot_low, value) MLO_SHMEM_SET_BITS(mgmt_rx_reo_snapshot_low, 1, 16, value)
  1240. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_GLOBAL_TIMESTAMP_GET(mgmt_rx_reo_snapshot) \
  1241. (MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot->mgmt_rx_reo_snapshot_high, 0, 17) << 15) | \
  1242. MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot->mgmt_rx_reo_snapshot_low, 17, 15)
  1243. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_GLOBAL_TIMESTAMP_SET(mgmt_rx_reo_snapshot, value) \
  1244. do { \
  1245. MLO_SHMEM_SET_BITS(mgmt_rx_reo_snapshot->mgmt_rx_reo_snapshot_high, 0, 17, ((value) >> 15)); \
  1246. MLO_SHMEM_SET_BITS(mgmt_rx_reo_snapshot->mgmt_rx_reo_snapshot_low, 17, 15, ((value) & 0x7fff)); \
  1247. } while (0)
  1248. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_MGMT_PKT_CTR_REDUNDANT_GET(mgmt_rx_reo_snapshot_high) MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot_high, 17, 15)
  1249. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_MGMT_PKT_CTR_REDUNDANT_SET(mgmt_rx_reo_snapshot_high, value) MLO_SHMEM_SET_BITS(mgmt_rx_reo_snapshot_high, 17, 15, value)
  1250. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_IS_CONSISTENT(mgmt_pkt_ctr, mgmt_pkt_ctr_redundant) \
  1251. (MLO_SHMEM_GET_BITS(mgmt_pkt_ctr, 0, 15) == MLO_SHMEM_GET_BITS(mgmt_pkt_ctr_redundant, 0, 15))
  1252. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_GLOBAL_TIMESTAMP_GET_FROM_DWORDS(mgmt_rx_reo_snapshot_low,mgmt_rx_reo_snapshot_high) \
  1253. (MLO_SHMEM_GET_BITS((mgmt_rx_reo_snapshot_high), 0, 17) << 15) | \
  1254. MLO_SHMEM_GET_BITS((mgmt_rx_reo_snapshot_low), 17, 15)
  1255. #define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_GET_ADRESS(mgmt_rx_reo_snapshot) \
  1256. (&mgmt_rx_reo_snapshot->mgmt_rx_reo_snapshot_low)
  1257. /* REO snapshot structure */
  1258. typedef struct {
  1259. /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MGMT_RX_REO_SNAPSHOT */
  1260. A_UINT32 tlv_header;
  1261. A_UINT32 reserved_alignment_padding;
  1262. /**
  1263. * mgmt_rx_reo_snapshot_low
  1264. *
  1265. * [0]: valid
  1266. * [16:1]: mgmt_pkt_ctr
  1267. * [31:17]: global_timestamp_low
  1268. */
  1269. A_UINT32 mgmt_rx_reo_snapshot_low;
  1270. /**
  1271. * mgmt_rx_reo_snapshot_high
  1272. *
  1273. * [16:0]: global_timestamp_high
  1274. * [31:17]: mgmt_pkt_ctr_redundant
  1275. */
  1276. A_UINT32 mgmt_rx_reo_snapshot_high;
  1277. } mgmt_rx_reo_snapshot;
  1278. A_COMPILE_TIME_ASSERT(check_mgmt_rx_reo_snapshot_8byte_size_quantum,
  1279. (((sizeof(mgmt_rx_reo_snapshot) % sizeof(A_UINT64) == 0x0))));
  1280. A_COMPILE_TIME_ASSERT(verify_mgmt_rx_reo_snapshot_low_offset,
  1281. (A_OFFSETOF(mgmt_rx_reo_snapshot, mgmt_rx_reo_snapshot_low) % sizeof(A_UINT64) == 0));
  1282. typedef struct {
  1283. /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MLO_GLB_RX_REO_PER_LINK_SNAPSHOT_INFO */
  1284. A_UINT32 tlv_header;
  1285. A_UINT32 reserved_alignment_padding;
  1286. mgmt_rx_reo_snapshot fw_consumed;
  1287. mgmt_rx_reo_snapshot fw_forwarded;
  1288. mgmt_rx_reo_snapshot hw_forwarded;
  1289. } mlo_glb_rx_reo_per_link_snapshot_info;
  1290. A_COMPILE_TIME_ASSERT(check_mlo_glb_rx_reo_per_link_snapshot_info_8byte_size_quantum,
  1291. (((sizeof(mlo_glb_rx_reo_per_link_snapshot_info) % sizeof(A_UINT64) == 0x0))));
  1292. A_COMPILE_TIME_ASSERT(verify_mlo_glb_rx_reo_per_link_snapshot_fw_consumed_offset,
  1293. (A_OFFSETOF(mlo_glb_rx_reo_per_link_snapshot_info, fw_consumed) % sizeof(A_UINT64) == 0));
  1294. /** Helper macro for params GET/SET of mlo_glb_rx_reo_snapshot_info */
  1295. #define MLO_SHMEM_GLB_RX_REO_SNAPSHOT_PARAM_NO_OF_LINKS_GET(link_info) MLO_SHMEM_GET_BITS(link_info, 0, 4)
  1296. #define MLO_SHMEM_GLB_RX_REO_SNAPSHOT_PARAM_NO_OF_LINKS_SET(link_info, value) MLO_SHMEM_SET_BITS(link_info, 0, 4, value)
  1297. #define MLO_SHMEM_GLB_RX_REO_SNAPSHOT_PARAM_VALID_LINK_BMAP_GET(link_info) MLO_SHMEM_GET_BITS(link_info, 4, 16)
  1298. #define MLO_SHMEM_GLB_RX_REO_SNAPSHOT_PARAM_VALID_LINK_BMAP_SET(link_info, value) MLO_SHMEM_SET_BITS(link_info, 4, 16, value)
  1299. /* Definition of the complete REO snapshot info */
  1300. typedef struct {
  1301. /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MLO_GLB_RX_REO_SNAPSHOT_INFO */
  1302. A_UINT32 tlv_header;
  1303. /**
  1304. * link_info
  1305. *
  1306. * [3:0]: no_of_links
  1307. * [19:4]: valid_link_bmap
  1308. * [31:20]: reserved
  1309. */
  1310. A_UINT32 link_info;
  1311. /* This TLV is followed by array of mlo_glb_rx_reo_per_link_snapshot_info:
  1312. * mlo_glb_rx_reo_per_link_snapshot_info will have multiple instances
  1313. * equal to num of hw links received by no_of_link
  1314. * mlo_glb_rx_reo_per_link_snapshot_info per_link_info[];
  1315. */
  1316. } mlo_glb_rx_reo_snapshot_info;
  1317. A_COMPILE_TIME_ASSERT(check_mlo_glb_rx_reo_snapshot_info_8byte_size_quantum,
  1318. (((sizeof(mlo_glb_rx_reo_snapshot_info) % sizeof(A_UINT64) == 0x0))));
  1319. /** Helper macro for params GET/SET of mlo_glb_link */
  1320. #define MLO_SHMEM_GLB_LINK_PARAM_LINK_STATUS_GET(link_status) MLO_SHMEM_GET_BITS(link_status, 0, 8)
  1321. #define MLO_SHMEM_GLB_LINK_PARAM_LINK_STATUS_SET(link_status, value) MLO_SHMEM_SET_BITS(link_status, 0, 8, value)
  1322. /*glb link info structures used for scratchpad memory (crash and recovery) */
  1323. typedef struct {
  1324. /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MLO_GLB_LINK */
  1325. A_UINT32 tlv_header;
  1326. /**
  1327. * link_status
  1328. *
  1329. * [7:0]: link_status
  1330. * [31:8]: reserved
  1331. */
  1332. A_UINT32 link_status;
  1333. /*
  1334. * Based on MLO timestamp, which is global across chips -
  1335. * this will be first updated when MLO sync is completed.
  1336. */
  1337. A_UINT32 boot_timestamp_low_us;
  1338. A_UINT32 boot_timestamp_high_us;
  1339. /*
  1340. * Based on MLO timestamp, will be updated with a configurable
  1341. * periodicity (default 1 sec)
  1342. */
  1343. A_UINT32 health_check_timestamp_low_us;
  1344. A_UINT32 health_check_timestamp_high_us;
  1345. } mlo_glb_link;
  1346. A_COMPILE_TIME_ASSERT(check_mlo_glb_link_8byte_size_quantum,
  1347. (((sizeof(mlo_glb_link) % sizeof(A_UINT64) == 0x0))));
  1348. A_COMPILE_TIME_ASSERT(verify_mlo_glb_link_boot_timestamp_low_offset,
  1349. (A_OFFSETOF(mlo_glb_link, boot_timestamp_low_us) % sizeof(A_UINT64) == 0));
  1350. A_COMPILE_TIME_ASSERT(verify_mlo_glb_link_health_check_timestamp_low_offset,
  1351. (A_OFFSETOF(mlo_glb_link, health_check_timestamp_low_us) % sizeof(A_UINT64) == 0));
  1352. /** Helper macro for params GET/SET of mlo_glb_link_info */
  1353. #define MLO_SHMEM_GLB_LINK_INFO_PARAM_NO_OF_LINKS_GET(link_info) MLO_SHMEM_GET_BITS(link_info, 0, 4)
  1354. #define MLO_SHMEM_GLB_LINK_INFO_PARAM_NO_OF_LINKS_SET(link_info, value) MLO_SHMEM_SET_BITS(link_info, 0, 4, value)
  1355. #define MLO_SHMEM_GLB_LINK_INFO_PARAM_VALID_LINK_BMAP_GET(link_info) MLO_SHMEM_GET_BITS(link_info, 4, 16)
  1356. #define MLO_SHMEM_GLB_LINK_INFO_PARAM_VALID_LINK_BMAP_SET(link_info, value) MLO_SHMEM_SET_BITS(link_info, 4, 16, value)
  1357. typedef struct {
  1358. /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MLO_GLB_LINK_INFO */
  1359. A_UINT32 tlv_header;
  1360. /**
  1361. * link_info
  1362. *
  1363. * [3:0]: no_of_links
  1364. * [19:4]: valid_link_bmap
  1365. * [31:20]: reserved
  1366. */
  1367. A_UINT32 link_info;
  1368. /* This TLV is followed by array of mlo_glb_link:
  1369. * mlo_glb_link will have mutiple instances equal to num of hw links
  1370. * received by no_of_link
  1371. * mlo_glb_link glb_link_info[];
  1372. */
  1373. } mlo_glb_link_info;
  1374. A_COMPILE_TIME_ASSERT(check_mlo_glb_link_info_8byte_size_quantum,
  1375. (((sizeof(mlo_glb_link_info) % sizeof(A_UINT64) == 0x0))));
  1376. /** Helper macro for params GET/SET of mlo_glb_h_shmem */
  1377. #define MLO_SHMEM_GLB_H_SHMEM_PARAM_MINOR_VERSION_GET(major_minor_version) MLO_SHMEM_GET_BITS(major_minor_version, 0, 16)
  1378. #define MLO_SHMEM_GLB_H_SHMEM_PARAM_MINOR_VERSION_SET(major_minor_version, value) MLO_SHMEM_SET_BITS(major_minor_version, 0, 16, value)
  1379. #define MLO_SHMEM_GLB_H_SHMEM_PARAM_MAJOR_VERSION_GET(major_minor_version) MLO_SHMEM_GET_BITS(major_minor_version, 16, 16)
  1380. #define MLO_SHMEM_GLB_H_SHMEM_PARAM_MAJOR_VERSION_SET(major_minor_version, value) MLO_SHMEM_SET_BITS(major_minor_version, 16, 16, value)
  1381. /* Definition of Global H SHMEM Arena */
  1382. typedef struct {
  1383. /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MLO_GLB_H_SHMEM */
  1384. A_UINT32 tlv_header;
  1385. /**
  1386. * major_minor_version
  1387. *
  1388. * [15:0]: minor version
  1389. * [31:16]: major version
  1390. */
  1391. A_UINT32 major_minor_version;
  1392. /* This TLV is followed by TLVs
  1393. * mlo_glb_rx_reo_snapshot_info reo_snapshot;
  1394. * mlo_glb_link_info glb_info;
  1395. */
  1396. } mlo_glb_h_shmem;
  1397. A_COMPILE_TIME_ASSERT(check_mlo_glb_h_shmem_8byte_size_quantum,
  1398. (((sizeof(mlo_glb_h_shmem) % sizeof(A_UINT64) == 0x0))));
  1399. #endif /* __WLANDEFS_H__ */