wlan_defs.h 59 KB

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