wlan_defs.h 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191
  1. /*
  2. * Copyright (c) 2013-2016, 2018-2019 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. /*
  139. * MODE_UNKNOWN should not be used within the host / target interface.
  140. * Thus, it is permissible for ODE_UNKNOWN to be conditionally-defined,
  141. * taking different values when compiling for different targets.
  142. */
  143. MODE_UNKNOWN,
  144. MODE_UNKNOWN_NO_160MHZ_SUPPORT = 14, /* not needed? */
  145. #if 0
  146. MODE_UNKNOWN_NO_11AX_SUPPORT = 16, /* not needed? */
  147. MODE_UNKNOWN_11AX_SUPPORT = 24, /* not needed? */
  148. #endif
  149. MODE_UNKNOWN_160MHZ_SUPPORT = MODE_UNKNOWN, /* not needed? */
  150. #ifdef ATHR_WIN_NWF
  151. PHY_MODE_MAX = MODE_UNKNOWN,
  152. PHY_MODE_MAX_NO_160_MHZ_SUPPORT = MODE_UNKNOWN_NO_160MHZ_SUPPORT,
  153. PHY_MODE_MAX_160_MHZ_SUPPORT = MODE_UNKNOWN_160MHZ_SUPPORT,
  154. #else
  155. MODE_MAX = MODE_UNKNOWN,
  156. MODE_MAX_NO_160_MHZ_SUPPORT = MODE_UNKNOWN_NO_160MHZ_SUPPORT,
  157. MODE_MAX_160_MHZ_SUPPORT = MODE_UNKNOWN_160MHZ_SUPPORT,
  158. #endif
  159. } WLAN_PHY_MODE;
  160. #ifndef CONFIG_160MHZ_SUPPORT
  161. A_COMPILE_TIME_ASSERT(
  162. mode_unknown_value_consistency_Check,
  163. MODE_UNKNOWN == MODE_UNKNOWN_NO_160MHZ_SUPPORT);
  164. #else
  165. A_COMPILE_TIME_ASSERT(
  166. mode_unknown_value_consistency_Check,
  167. MODE_UNKNOWN == MODE_UNKNOWN_160MHZ_SUPPORT);
  168. #endif
  169. typedef enum {
  170. VHT_MODE_NONE = 0, /* NON VHT Mode, e.g., HT, DSSS, CCK */
  171. VHT_MODE_20M = 1,
  172. VHT_MODE_40M = 2,
  173. VHT_MODE_80M = 3,
  174. VHT_MODE_160M = 4
  175. } VHT_OPER_MODE;
  176. typedef enum {
  177. WLAN_11A_CAPABILITY = 1,
  178. WLAN_11G_CAPABILITY = 2,
  179. WLAN_11AG_CAPABILITY = 3,
  180. } WLAN_CAPABILITY;
  181. #ifdef CONFIG_160MHZ_SUPPORT
  182. #define IS_MODE_VHT(mode) (((mode) == MODE_11AC_VHT20) || \
  183. ((mode) == MODE_11AC_VHT40) || \
  184. ((mode) == MODE_11AC_VHT80) || \
  185. ((mode) == MODE_11AC_VHT80_80) || \
  186. ((mode) == MODE_11AC_VHT160))
  187. #else
  188. #define IS_MODE_VHT(mode) (((mode) == MODE_11AC_VHT20) || \
  189. ((mode) == MODE_11AC_VHT40) || \
  190. ((mode) == MODE_11AC_VHT80))
  191. #endif
  192. #if SUPPORT_11AX
  193. #define IS_MODE_HE(mode) (((mode) == MODE_11AX_HE20) || \
  194. ((mode) == MODE_11AX_HE40) || \
  195. ((mode) == MODE_11AX_HE80) || \
  196. ((mode) == MODE_11AX_HE80_80) || \
  197. ((mode) == MODE_11AX_HE160) || \
  198. ((mode) == MODE_11AX_HE20_2G) || \
  199. ((mode) == MODE_11AX_HE40_2G) || \
  200. ((mode) == MODE_11AX_HE80_2G))
  201. #define IS_MODE_HE_2G(mode) (((mode) == MODE_11AX_HE20_2G) || \
  202. ((mode) == MODE_11AX_HE40_2G) || \
  203. ((mode) == MODE_11AX_HE80_2G))
  204. #endif /* SUPPORT_11AX */
  205. #define IS_MODE_VHT_2G(mode) (((mode) == MODE_11AC_VHT20_2G) || \
  206. ((mode) == MODE_11AC_VHT40_2G) || \
  207. ((mode) == MODE_11AC_VHT80_2G))
  208. #define IS_MODE_11A(mode) (((mode) == MODE_11A) || \
  209. ((mode) == MODE_11NA_HT20) || \
  210. ((mode) == MODE_11NA_HT40) || \
  211. (IS_MODE_VHT(mode)))
  212. #define IS_MODE_11B(mode) ((mode) == MODE_11B)
  213. #define IS_MODE_11G(mode) (((mode) == MODE_11G) || \
  214. ((mode) == MODE_11GONLY) || \
  215. ((mode) == MODE_11NG_HT20) || \
  216. ((mode) == MODE_11NG_HT40) || \
  217. (IS_MODE_VHT_2G(mode)))
  218. #define IS_MODE_11GN(mode) (((mode) == MODE_11NG_HT20) || \
  219. ((mode) == MODE_11NG_HT40))
  220. #define IS_MODE_11GONLY(mode) ((mode) == MODE_11GONLY)
  221. #define IS_MODE_LEGACY(phymode) ((phymode == MODE_11A) || \
  222. (phymode == MODE_11G) || \
  223. (phymode == MODE_11B) || \
  224. (phymode == MODE_11GONLY))
  225. #define IS_MODE_11N(phymode) ((phymode >= MODE_11NA_HT20) && \
  226. (phymode <= MODE_11NG_HT40))
  227. #ifdef CONFIG_160MHZ_SUPPORT
  228. #define IS_MODE_11AC(phymode) ((phymode >= MODE_11AC_VHT20) && \
  229. (phymode <= MODE_11AC_VHT160))
  230. #else
  231. #define IS_MODE_11AC(phymode) ((phymode >= MODE_11AC_VHT20) && \
  232. (phymode <= MODE_11AC_VHT80_2G))
  233. #endif /* CONFIG_160MHZ_SUPPORT */
  234. #if SUPPORT_11AX
  235. #define IS_MODE_80MHZ(phymode) ((phymode == MODE_11AC_VHT80_2G) || \
  236. (phymode == MODE_11AC_VHT80) || \
  237. (phymode == MODE_11AX_HE80) || \
  238. (phymode == MODE_11AX_HE80_2G))
  239. #define IS_MODE_40MHZ(phymode) ((phymode == MODE_11AC_VHT40_2G) || \
  240. (phymode == MODE_11AC_VHT40) || \
  241. (phymode == MODE_11NG_HT40) || \
  242. (phymode == MODE_11NA_HT40) || \
  243. (phymode == MODE_11AX_HE40) || \
  244. (phymode == MODE_11AX_HE40_2G))
  245. #else
  246. #define IS_MODE_80MHZ(phymode) ((phymode == MODE_11AC_VHT80_2G) || \
  247. (phymode == MODE_11AC_VHT80))
  248. #define IS_MODE_40MHZ(phymode) ((phymode == MODE_11AC_VHT40_2G) || \
  249. (phymode == MODE_11AC_VHT40) || \
  250. (phymode == MODE_11NG_HT40) || \
  251. (phymode == MODE_11NA_HT40))
  252. #endif /* SUPPORT_11AX */
  253. enum {
  254. REGDMN_MODE_11A = 0x00000001, /* 11a channels */
  255. REGDMN_MODE_TURBO = 0x00000002, /* 11a turbo-only channels */
  256. REGDMN_MODE_11B = 0x00000004, /* 11b channels */
  257. REGDMN_MODE_PUREG = 0x00000008, /* 11g channels (OFDM only) */
  258. REGDMN_MODE_11G = 0x00000008, /* XXX historical */
  259. REGDMN_MODE_108G = 0x00000020, /* 11g+Turbo channels */
  260. REGDMN_MODE_108A = 0x00000040, /* 11a+Turbo channels */
  261. REGDMN_MODE_XR = 0x00000100, /* XR channels */
  262. REGDMN_MODE_11A_HALF_RATE = 0x00000200, /* 11A half rate channels */
  263. REGDMN_MODE_11A_QUARTER_RATE = 0x00000400, /* 11A quarter rate channels */
  264. REGDMN_MODE_11NG_HT20 = 0x00000800, /* 11N-G HT20 channels */
  265. REGDMN_MODE_11NA_HT20 = 0x00001000, /* 11N-A HT20 channels */
  266. REGDMN_MODE_11NG_HT40PLUS = 0x00002000, /* 11N-G HT40 + channels */
  267. REGDMN_MODE_11NG_HT40MINUS = 0x00004000, /* 11N-G HT40 - channels */
  268. REGDMN_MODE_11NA_HT40PLUS = 0x00008000, /* 11N-A HT40 + channels */
  269. REGDMN_MODE_11NA_HT40MINUS = 0x00010000, /* 11N-A HT40 - channels */
  270. REGDMN_MODE_11AC_VHT20 = 0x00020000, /* 5Ghz, VHT20 */
  271. REGDMN_MODE_11AC_VHT40PLUS = 0x00040000, /* 5Ghz, VHT40 + channels */
  272. REGDMN_MODE_11AC_VHT40MINUS = 0x00080000, /* 5Ghz VHT40 - channels */
  273. REGDMN_MODE_11AC_VHT80 = 0x000100000, /* 5Ghz, VHT80 channels */
  274. REGDMN_MODE_11AC_VHT20_2G = 0x000200000, /* 2Ghz, VHT20 */
  275. REGDMN_MODE_11AC_VHT40_2G = 0x000400000, /* 2Ghz, VHT40 */
  276. REGDMN_MODE_11AC_VHT80_2G = 0x000800000, /* 2Ghz, VHT80 */
  277. REGDMN_MODE_11AC_VHT160 = 0x001000000, /* 5Ghz, VHT160 */
  278. REGDMN_MODE_11AC_VHT40_2GPLUS = 0x002000000, /* 2Ghz, VHT40+ */
  279. REGDMN_MODE_11AC_VHT40_2GMINUS = 0x004000000, /* 2Ghz, VHT40- */
  280. REGDMN_MODE_11AC_VHT80_80 = 0x008000000, /* 5GHz, VHT80+80 */
  281. };
  282. #define REGDMN_MODE_ALL (0xFFFFFFFF) /* REGDMN_MODE_ALL is defined out of the enum
  283. * to prevent the ARM compile "warning #66:
  284. * enumeration value is out of int range"
  285. * Anyway, this is a BIT-OR of all possible values.
  286. */
  287. #define REGDMN_CAP1_CHAN_HALF_RATE 0x00000001
  288. #define REGDMN_CAP1_CHAN_QUARTER_RATE 0x00000002
  289. #define REGDMN_CAP1_CHAN_HAL49GHZ 0x00000004
  290. /* regulatory capabilities */
  291. #define REGDMN_EEPROM_EEREGCAP_EN_FCC_MIDBAND 0x0040
  292. #define REGDMN_EEPROM_EEREGCAP_EN_KK_U1_EVEN 0x0080
  293. #define REGDMN_EEPROM_EEREGCAP_EN_KK_U2 0x0100
  294. #define REGDMN_EEPROM_EEREGCAP_EN_KK_MIDBAND 0x0200
  295. #define REGDMN_EEPROM_EEREGCAP_EN_KK_U1_ODD 0x0400
  296. #define REGDMN_EEPROM_EEREGCAP_EN_KK_NEW_11A 0x0800
  297. typedef struct {
  298. A_UINT32 tlv_header; /* TLV tag and len; tag equals WMI_TLVTAG_STRUC_HAL_REG_CAPABILITIES */
  299. A_UINT32 eeprom_rd; /* regdomain value specified in EEPROM */
  300. A_UINT32 eeprom_rd_ext; /* regdomain */
  301. A_UINT32 regcap1; /* CAP1 capabilities bit map. */
  302. A_UINT32 regcap2; /* REGDMN EEPROM CAP. */
  303. A_UINT32 wireless_modes; /* REGDMN MODE */
  304. A_UINT32 low_2ghz_chan;
  305. A_UINT32 high_2ghz_chan;
  306. A_UINT32 low_5ghz_chan;
  307. A_UINT32 high_5ghz_chan;
  308. } HAL_REG_CAPABILITIES;
  309. #ifdef NUM_SPATIAL_STREAM
  310. /*
  311. * The rate control definitions below are only used in the target.
  312. * (Host-based rate control is no longer applicable.)
  313. * Maintain the defs in wlanfw_cmn for the sake of existing Rome / Helium
  314. * targets, but for Lithium targets remove them from wlanfw_cmn and define
  315. * them in a target-only location instead.
  316. * SUPPORT_11AX is essentially used as a condition to identify Lithium targets.
  317. * Some host drivers would also have SUPPORT_11AX defined, and thus would lose
  318. * the definition of RATE_CODE, RC_TX_DONE_PARAMS, and related macros, but
  319. * that's okay because the host should have no references to these
  320. * target-only data structures.
  321. */
  322. #if !((NUM_SPATIAL_STREAM > 4) || SUPPORT_11AX) /* following N/A for Lithium */
  323. /*
  324. * Used to update rate-control logic with the status of the tx-completion.
  325. * In host-based implementation of the rate-control feature, this struture is used to
  326. * create the payload for HTT message/s from target to host.
  327. */
  328. #ifndef CONFIG_MOVE_RC_STRUCT_TO_MACCORE
  329. #if (NUM_SPATIAL_STREAM > 3)
  330. #define A_RATEMASK A_UINT64
  331. #else
  332. #define A_RATEMASK A_UINT32
  333. #endif
  334. #endif /* CONFIG_MOVE_RC_STRUCT_TO_MACCORE */
  335. typedef A_UINT8 A_RATE;
  336. typedef A_UINT8 A_RATECODE;
  337. #define A_RATEMASK_NUM_OCTET (sizeof (A_RATEMASK))
  338. #define A_RATEMASK_NUM_BITS ((sizeof (A_RATEMASK)) << 3)
  339. typedef struct {
  340. A_RATECODE rateCode;
  341. A_UINT8 flags;
  342. } RATE_CODE;
  343. typedef struct {
  344. RATE_CODE ptx_rc; /* rate code, bw, chain mask sgi */
  345. A_UINT8 reserved[2];
  346. A_UINT32 flags; /* Encodes information such as excessive
  347. retransmission, aggregate, some info
  348. from .11 frame control,
  349. STBC, LDPC, (SGI and Tx Chain Mask
  350. are encoded in ptx_rc->flags field),
  351. AMPDU truncation (BT/time based etc.),
  352. RTS/CTS attempt */
  353. A_UINT32 num_enqued; /* # of MPDUs (for non-AMPDU 1) for this rate */
  354. A_UINT32 num_retries; /* Total # of transmission attempt for this rate */
  355. A_UINT32 num_failed; /* # of failed MPDUs in A-MPDU, 0 otherwise */
  356. A_UINT32 ack_rssi; /* ACK RSSI: b'7..b'0 avg RSSI across all chain */
  357. A_UINT32 time_stamp ; /* ACK timestamp (helps determine age) */
  358. A_UINT32 is_probe; /* Valid if probing. Else, 0 */
  359. A_UINT32 ba_win_size; /* b'7..b0, block Ack Window size, b'31..b8 Resvd */
  360. A_UINT32 failed_ba_bmap_0_31; /* failed BA bitmap 0..31 */
  361. A_UINT32 failed_ba_bmap_32_63; /* failed BA bitmap 32..63 */
  362. A_UINT32 bmap_tried_0_31; /* enqued bitmap 0..31 */
  363. A_UINT32 bmap_tried_32_63; /* enqued bitmap 32..63 */
  364. } RC_TX_DONE_PARAMS;
  365. #define RC_SET_TX_DONE_INFO(_dst, _rc, _f, _nq, _nr, _nf, _rssi, _ts) \
  366. do { \
  367. (_dst).ptx_rc.rateCode = (_rc).rateCode; \
  368. (_dst).ptx_rc.flags = (_rc).flags; \
  369. (_dst).flags = (_f); \
  370. (_dst).num_enqued = (_nq); \
  371. (_dst).num_retries = (_nr); \
  372. (_dst).num_failed = (_nf); \
  373. (_dst).ack_rssi = (_rssi); \
  374. (_dst).time_stamp = (_ts); \
  375. } while (0)
  376. #define RC_SET_TXBF_DONE_INFO(_dst, _f) \
  377. do { \
  378. (_dst).flags |= (_f); \
  379. } while (0)
  380. /*
  381. * NOTE: NUM_SCHED_ENTRIES is not used in the host/target interface, but for
  382. * historical reasons has been defined in the host/target interface files.
  383. * The NUM_SCHED_ENTRIES definition is being moved into a target-only
  384. * header file for newer (Lithium) targets, but is being left here for
  385. * non-Lithium cases, to avoid having to rework legacy targets to move
  386. * the NUM_SCHED_ENTRIES definition into a target-only header file.
  387. * Moving the NUM_SCHED_ENTRIES definition into a non-Lithium conditional
  388. * block should have no impact on the host, since the host does not use
  389. * NUM_SCHED_ENTRIES.
  390. */
  391. #define NUM_SCHED_ENTRIES 2
  392. #endif /* !((NUM_SPATIAL_STREAM > 4) || SUPPORT_11AX) */ /* above N/A for Lithium */
  393. #endif /* NUM_SPATIAL_STREAM */
  394. /* NOTE: NUM_DYN_BW cannot be changed without breaking WMI Compatibility */
  395. #define NUM_DYN_BW_MAX 4
  396. /* Some products only use 20/40/80; some use 20/40/80/160 */
  397. #ifndef NUM_DYN_BW
  398. #define NUM_DYN_BW 3 /* default: support up through 80 MHz */
  399. #endif
  400. #define NUM_DYN_BW_MASK 0x3
  401. #define PROD_SCHED_BW_ENTRIES (NUM_SCHED_ENTRIES * NUM_DYN_BW)
  402. #if NUM_DYN_BW > 4
  403. /* Extend rate table module first */
  404. #error "Extend rate table module first"
  405. #endif
  406. #define MAX_IBSS_PEERS 32
  407. #ifdef NUM_SPATIAL_STREAM
  408. /*
  409. * RC_TX_RATE_SCHEDULE and RC_TX_RATE_INFO defs are used only in the target.
  410. * (Host-based rate control is no longer applicable.)
  411. * Maintain the defs in wlanfw_cmn for the sake of existing Rome / Helium
  412. * targets, but for Lithium targets remove them from wlanfw_cmn and define
  413. * them in a target-only location instead.
  414. * SUPPORT_11AX is essentially used as a condition to identify Lithium targets.
  415. * Some host drivers would also have SUPPORT_11AX defined, and thus would lose
  416. * the definition of RC_TX_RATE_SCHEDULE and RC_TX_RATE_INFO, but that's okay
  417. * because the host should have no references to these target-only data
  418. * structures.
  419. */
  420. #ifndef CONFIG_MOVE_RC_STRUCT_TO_MACCORE
  421. #if !((NUM_SPATIAL_STREAM > 4) || SUPPORT_11AX)
  422. #if defined(CONFIG_AR900B_SUPPORT) || defined(AR900B)
  423. typedef struct{
  424. A_UINT32 psdu_len[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  425. A_UINT16 flags[NUM_SCHED_ENTRIES][NUM_DYN_BW];
  426. A_RATE rix[NUM_SCHED_ENTRIES][NUM_DYN_BW];
  427. A_UINT8 tpc[NUM_SCHED_ENTRIES][NUM_DYN_BW];
  428. A_UINT32 antmask[NUM_SCHED_ENTRIES];
  429. A_UINT8 num_mpdus[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  430. A_UINT16 txbf_cv_len;
  431. A_UINT32 txbf_cv_ptr;
  432. A_UINT16 txbf_flags;
  433. A_UINT16 txbf_cv_size;
  434. A_UINT8 txbf_nc_idx;
  435. A_UINT8 tries[NUM_SCHED_ENTRIES];
  436. A_UINT8 bw_mask[NUM_SCHED_ENTRIES];
  437. A_UINT8 max_bw[NUM_SCHED_ENTRIES];
  438. A_UINT8 num_sched_entries;
  439. A_UINT8 paprd_mask;
  440. A_RATE rts_rix;
  441. A_UINT8 sh_pream;
  442. A_UINT8 min_spacing_1_4_us;
  443. A_UINT8 fixed_delims;
  444. A_UINT8 bw_in_service;
  445. A_RATE probe_rix;
  446. A_UINT8 num_valid_rates;
  447. A_UINT8 rtscts_tpc;
  448. A_UINT8 dd_profile;
  449. } RC_TX_RATE_SCHEDULE;
  450. #else
  451. typedef struct{
  452. A_UINT32 psdu_len[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  453. A_UINT16 flags[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  454. A_RATE rix[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  455. A_UINT8 tpc[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  456. A_UINT8 num_mpdus[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  457. A_UINT32 antmask[NUM_SCHED_ENTRIES];
  458. A_UINT32 txbf_cv_ptr;
  459. A_UINT16 txbf_cv_len;
  460. A_UINT8 tries[NUM_SCHED_ENTRIES];
  461. A_UINT8 num_valid_rates;
  462. A_UINT8 paprd_mask;
  463. A_RATE rts_rix;
  464. A_UINT8 sh_pream;
  465. A_UINT8 min_spacing_1_4_us;
  466. A_UINT8 fixed_delims;
  467. A_UINT8 bw_in_service;
  468. A_RATE probe_rix;
  469. } RC_TX_RATE_SCHEDULE;
  470. #endif
  471. typedef struct{
  472. A_UINT16 flags[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  473. A_RATE rix[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  474. #ifdef DYN_TPC_ENABLE
  475. A_UINT8 tpc[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  476. #endif
  477. #ifdef SECTORED_ANTENNA
  478. A_UINT32 antmask[NUM_SCHED_ENTRIES];
  479. #endif
  480. A_UINT8 tries[NUM_SCHED_ENTRIES];
  481. A_UINT8 num_valid_rates;
  482. A_RATE rts_rix;
  483. A_UINT8 sh_pream;
  484. A_UINT8 bw_in_service;
  485. A_RATE probe_rix;
  486. A_UINT8 dd_profile;
  487. } RC_TX_RATE_INFO;
  488. #endif /* !((NUM_SPATIAL_STREAM > 4) || SUPPORT_11AX) */
  489. #endif /* CONFIG_MOVE_RC_STRUCT_TO_MACCORE */
  490. #endif
  491. /*
  492. * Temporarily continue to provide the WHAL_RC_INIT_RC_MASKS def in wlan_defs.h
  493. * for older targets.
  494. * The WHAL_RX_INIT_RC_MASKS macro def needs to be moved into ratectrl_11ac.h
  495. * for all targets, but until this is complete, the WHAL_RC_INIT_RC_MASKS def
  496. * will be maintained here in its old location.
  497. */
  498. #ifndef CONFIG_160MHZ_SUPPORT
  499. #define WHAL_RC_INIT_RC_MASKS(_rm) do { \
  500. _rm[WHAL_RC_MASK_IDX_NON_HT] = A_RATEMASK_OFDM_CCK; \
  501. _rm[WHAL_RC_MASK_IDX_HT_20] = A_RATEMASK_HT_20; \
  502. _rm[WHAL_RC_MASK_IDX_HT_40] = A_RATEMASK_HT_40; \
  503. _rm[WHAL_RC_MASK_IDX_VHT_20] = A_RATEMASK_VHT_20; \
  504. _rm[WHAL_RC_MASK_IDX_VHT_40] = A_RATEMASK_VHT_40; \
  505. _rm[WHAL_RC_MASK_IDX_VHT_80] = A_RATEMASK_VHT_80; \
  506. } while (0)
  507. #endif
  508. /**
  509. * strucutre describing host memory chunk.
  510. */
  511. typedef struct {
  512. A_UINT32 tlv_header; /* TLV tag and len; tag equals WMITLV_TAG_STRUC_wlan_host_memory_chunk */
  513. /** id of the request that is passed up in service ready */
  514. A_UINT32 req_id;
  515. /** the physical address the memory chunk */
  516. A_UINT32 ptr;
  517. /** size of the chunk */
  518. A_UINT32 size;
  519. /** ptr_high
  520. * most significant bits of physical address of the memory chunk
  521. * Only applicable for addressing more than 32 bit.
  522. * This will only be non-zero if the target has set
  523. * WMI_SERVICE_SUPPORT_EXTEND_ADDRESS flag.
  524. */
  525. A_UINT32 ptr_high;
  526. } wlan_host_memory_chunk;
  527. #define NUM_UNITS_IS_NUM_VDEVS 0x1
  528. #define NUM_UNITS_IS_NUM_PEERS 0x2
  529. #define NUM_UNITS_IS_NUM_ACTIVE_PEERS 0x4
  530. /* request host to allocate memory contiguously */
  531. #define REQ_TO_HOST_FOR_CONT_MEMORY 0x8
  532. /**
  533. * structure used by FW for requesting host memory
  534. */
  535. typedef struct {
  536. A_UINT32 tlv_header; /* TLV tag and len; tag equals WMI_TLVTAG_STRUC_wlan_host_mem_req */
  537. /** ID of the request */
  538. A_UINT32 req_id;
  539. /** size of the of each unit */
  540. A_UINT32 unit_size;
  541. /**
  542. * flags to indicate that
  543. * the number units is dependent
  544. * on number of resources(num vdevs num peers .. etc)
  545. */
  546. A_UINT32 num_unit_info;
  547. /*
  548. * actual number of units to allocate . if flags in the num_unit_info
  549. * indicate that number of units is tied to number of a particular
  550. * resource to allocate then num_units filed is set to 0 and host
  551. * will derive the number units from number of the resources it is
  552. * requesting.
  553. */
  554. A_UINT32 num_units;
  555. } wlan_host_mem_req;
  556. typedef enum {
  557. IGNORE_DTIM = 0x01,
  558. NORMAL_DTIM = 0x02,
  559. STICK_DTIM = 0x03,
  560. AUTO_DTIM = 0x04,
  561. } BEACON_DTIM_POLICY;
  562. /* During test it is observed that 6 * 400 = 2400 can
  563. * be alloced in addition to CFG_TGT_NUM_MSDU_DESC.
  564. * If there is any change memory requirement, this number
  565. * needs to be revisited. */
  566. #define TOTAL_VOW_ALLOCABLE 2400
  567. #define VOW_DESC_GRAB_MAX 800
  568. #define VOW_GET_NUM_VI_STA(vow_config) (((vow_config) & 0xffff0000) >> 16)
  569. #define VOW_GET_DESC_PER_VI_STA(vow_config) ((vow_config) & 0x0000ffff)
  570. /***TODO!!! Get these values dynamically in WMI_READY event and use it to calculate the mem req*/
  571. /* size in bytes required for msdu descriptor. If it changes, this should be updated. LARGE_AP
  572. * case is not considered. LARGE_AP is disabled when VoW is enabled.*/
  573. #define MSDU_DESC_SIZE 20
  574. /* size in bytes required to support a peer in target.
  575. * This obtained by considering Two tids per peer.
  576. * peer structure = 168 bytes
  577. * tid = 96 bytes (per sta 2 means we need 192 bytes)
  578. * peer_cb = 16 * 2
  579. * key = 52 * 2
  580. * AST = 12 * 2
  581. * rate, reorder.. = 384
  582. * smart antenna = 50
  583. */
  584. #define MEMORY_REQ_FOR_PEER 800
  585. /*
  586. * NB: it is important to keep all the fields in the structure dword long
  587. * so that it is easy to handle the statistics in BE host.
  588. */
  589. /*
  590. * wlan_dbg_tx_stats_v1, _v2:
  591. * differing versions of the wlan_dbg_tx_stats struct used by different
  592. * targets
  593. */
  594. struct wlan_dbg_tx_stats_v1 {
  595. /* Num HTT cookies queued to dispatch list */
  596. A_INT32 comp_queued;
  597. /* Num HTT cookies dispatched */
  598. A_INT32 comp_delivered;
  599. /* Num MSDU queued to WAL */
  600. A_INT32 msdu_enqued;
  601. /* Num MPDU queue to WAL */
  602. A_INT32 mpdu_enqued;
  603. /* Num MSDUs dropped by WMM limit */
  604. A_INT32 wmm_drop;
  605. /* Num Local frames queued */
  606. A_INT32 local_enqued;
  607. /* Num Local frames done */
  608. A_INT32 local_freed;
  609. /* Num queued to HW */
  610. A_INT32 hw_queued;
  611. /* Num PPDU reaped from HW */
  612. A_INT32 hw_reaped;
  613. /* Num underruns */
  614. A_INT32 underrun;
  615. /* Num PPDUs cleaned up in TX abort */
  616. A_INT32 tx_abort;
  617. /* Num MPDUs requed by SW */
  618. A_INT32 mpdus_requed;
  619. /* excessive retries */
  620. A_UINT32 tx_ko;
  621. /* data hw rate code */
  622. A_UINT32 data_rc;
  623. /* Scheduler self triggers */
  624. A_UINT32 self_triggers;
  625. /* frames dropped due to excessive sw retries */
  626. A_UINT32 sw_retry_failure;
  627. /* illegal rate phy errors */
  628. A_UINT32 illgl_rate_phy_err;
  629. /* wal pdev continous xretry */
  630. A_UINT32 pdev_cont_xretry;
  631. /* wal pdev continous xretry */
  632. A_UINT32 pdev_tx_timeout;
  633. /* wal pdev resets */
  634. A_UINT32 pdev_resets;
  635. /* frames dropped due to non-availability of stateless TIDs */
  636. A_UINT32 stateless_tid_alloc_failure;
  637. /* PhY/BB underrun */
  638. A_UINT32 phy_underrun;
  639. /* MPDU is more than txop limit */
  640. A_UINT32 txop_ovf;
  641. };
  642. struct wlan_dbg_tx_stats_v2 {
  643. /* Num HTT cookies queued to dispatch list */
  644. A_INT32 comp_queued;
  645. /* Num HTT cookies dispatched */
  646. A_INT32 comp_delivered;
  647. /* Num MSDU queued to WAL */
  648. A_INT32 msdu_enqued;
  649. /* Num MPDU queue to WAL */
  650. A_INT32 mpdu_enqued;
  651. /* Num MSDUs dropped by WMM limit */
  652. A_INT32 wmm_drop;
  653. /* Num Local frames queued */
  654. A_INT32 local_enqued;
  655. /* Num Local frames done */
  656. A_INT32 local_freed;
  657. /* Num queued to HW */
  658. A_INT32 hw_queued;
  659. /* Num PPDU reaped from HW */
  660. A_INT32 hw_reaped;
  661. /* Num underruns */
  662. A_INT32 underrun;
  663. /* HW Paused. */
  664. A_UINT32 hw_paused;
  665. /* Num PPDUs cleaned up in TX abort */
  666. A_INT32 tx_abort;
  667. /* Num MPDUs requed by SW */
  668. A_INT32 mpdus_requed;
  669. /* excessive retries */
  670. A_UINT32 tx_ko;
  671. A_UINT32 tx_xretry;
  672. /* data hw rate code */
  673. A_UINT32 data_rc;
  674. /* Scheduler self triggers */
  675. A_UINT32 self_triggers;
  676. /* frames dropped due to excessive sw retries */
  677. A_UINT32 sw_retry_failure;
  678. /* illegal rate phy errors */
  679. A_UINT32 illgl_rate_phy_err;
  680. /* wal pdev continous xretry */
  681. A_UINT32 pdev_cont_xretry;
  682. /* wal pdev continous xretry */
  683. A_UINT32 pdev_tx_timeout;
  684. /* wal pdev resets */
  685. A_UINT32 pdev_resets;
  686. /* frames dropped due to non-availability of stateless TIDs */
  687. A_UINT32 stateless_tid_alloc_failure;
  688. /* PhY/BB underrun */
  689. A_UINT32 phy_underrun;
  690. /* MPDU is more than txop limit */
  691. A_UINT32 txop_ovf;
  692. /* Number of Sequences posted */
  693. A_UINT32 seq_posted;
  694. /* Number of Sequences failed queueing */
  695. A_UINT32 seq_failed_queueing;
  696. /* Number of Sequences completed */
  697. A_UINT32 seq_completed;
  698. /* Number of Sequences restarted */
  699. A_UINT32 seq_restarted;
  700. /* Number of MU Sequences posted */
  701. A_UINT32 mu_seq_posted;
  702. /* Num MPDUs flushed by SW, HWPAUSED, SW TXABORT (Reset,channel change) */
  703. A_INT32 mpdus_sw_flush;
  704. /* Num MPDUs filtered by HW, all filter condition (TTL expired) */
  705. A_INT32 mpdus_hw_filter;
  706. /* Num MPDUs truncated by PDG (TXOP, TBTT, PPDU_duration based on rate, dyn_bw) */
  707. A_INT32 mpdus_truncated;
  708. /* Num MPDUs that was tried but didn't receive ACK or BA */
  709. A_INT32 mpdus_ack_failed;
  710. /* Num MPDUs that was dropped du to expiry. */
  711. A_INT32 mpdus_expired;
  712. };
  713. #if defined(AR900B)
  714. #define wlan_dbg_tx_stats wlan_dbg_tx_stats_v2
  715. #else
  716. #define wlan_dbg_tx_stats wlan_dbg_tx_stats_v1
  717. #endif
  718. /*
  719. * wlan_dbg_rx_stats_v1, _v2:
  720. * differing versions of the wlan_dbg_rx_stats struct used by different
  721. * targets
  722. */
  723. struct wlan_dbg_rx_stats_v1 {
  724. /* Cnts any change in ring routing mid-ppdu */
  725. A_INT32 mid_ppdu_route_change;
  726. /* Total number of statuses processed */
  727. A_INT32 status_rcvd;
  728. /* Extra frags on rings 0-3 */
  729. A_INT32 r0_frags;
  730. A_INT32 r1_frags;
  731. A_INT32 r2_frags;
  732. A_INT32 r3_frags;
  733. /* MSDUs / MPDUs delivered to HTT */
  734. A_INT32 htt_msdus;
  735. A_INT32 htt_mpdus;
  736. /* MSDUs / MPDUs delivered to local stack */
  737. A_INT32 loc_msdus;
  738. A_INT32 loc_mpdus;
  739. /* AMSDUs that have more MSDUs than the status ring size */
  740. A_INT32 oversize_amsdu;
  741. /* Number of PHY errors */
  742. A_INT32 phy_errs;
  743. /* Number of PHY errors drops */
  744. A_INT32 phy_err_drop;
  745. /* Number of mpdu errors - FCS, MIC, ENC etc. */
  746. A_INT32 mpdu_errs;
  747. };
  748. struct wlan_dbg_rx_stats_v2 {
  749. /* Cnts any change in ring routing mid-ppdu */
  750. A_INT32 mid_ppdu_route_change;
  751. /* Total number of statuses processed */
  752. A_INT32 status_rcvd;
  753. /* Extra frags on rings 0-3 */
  754. A_INT32 r0_frags;
  755. A_INT32 r1_frags;
  756. A_INT32 r2_frags;
  757. A_INT32 r3_frags;
  758. /* MSDUs / MPDUs delivered to HTT */
  759. A_INT32 htt_msdus;
  760. A_INT32 htt_mpdus;
  761. /* MSDUs / MPDUs delivered to local stack */
  762. A_INT32 loc_msdus;
  763. A_INT32 loc_mpdus;
  764. /* AMSDUs that have more MSDUs than the status ring size */
  765. A_INT32 oversize_amsdu;
  766. /* Number of PHY errors */
  767. A_INT32 phy_errs;
  768. /* Number of PHY errors drops */
  769. A_INT32 phy_err_drop;
  770. /* Number of mpdu errors - FCS, MIC, ENC etc. */
  771. A_INT32 mpdu_errs;
  772. /* Number of rx overflow errors. */
  773. A_INT32 rx_ovfl_errs;
  774. };
  775. #if defined(AR900B)
  776. #define wlan_dbg_rx_stats wlan_dbg_rx_stats_v2
  777. #else
  778. #define wlan_dbg_rx_stats wlan_dbg_rx_stats_v1
  779. #endif
  780. struct wlan_dbg_mem_stats {
  781. A_UINT32 iram_free_size;
  782. A_UINT32 dram_free_size;
  783. };
  784. struct wlan_dbg_peer_stats {
  785. A_INT32 dummy; /* REMOVE THIS ONCE REAL PEER STAT COUNTERS ARE ADDED */
  786. };
  787. /*
  788. * wlan_dbg_rx_rate_info_v1a_t, _v1b_t:
  789. * differing versions of the wlan_dbg_rx_rate_info struct used by different
  790. * targets
  791. */
  792. typedef struct {
  793. A_UINT32 mcs[10];
  794. A_UINT32 sgi[10];
  795. A_UINT32 nss[4];
  796. A_UINT32 nsts;
  797. A_UINT32 stbc[10];
  798. A_UINT32 bw[3];
  799. A_UINT32 pream[6];
  800. A_UINT32 ldpc;
  801. A_UINT32 txbf;
  802. A_UINT32 mgmt_rssi;
  803. A_UINT32 data_rssi;
  804. A_UINT32 rssi_chain0;
  805. A_UINT32 rssi_chain1;
  806. A_UINT32 rssi_chain2;
  807. } wlan_dbg_rx_rate_info_v1a_t;
  808. typedef struct {
  809. A_UINT32 mcs[10];
  810. A_UINT32 sgi[10];
  811. A_UINT32 nss[4];
  812. A_UINT32 nsts;
  813. A_UINT32 stbc[10];
  814. A_UINT32 bw[3];
  815. A_UINT32 pream[6];
  816. A_UINT32 ldpc;
  817. A_UINT32 txbf;
  818. A_UINT32 mgmt_rssi;
  819. A_UINT32 data_rssi;
  820. A_UINT32 rssi_chain0;
  821. A_UINT32 rssi_chain1;
  822. A_UINT32 rssi_chain2;
  823. /*
  824. * TEMPORARY: leave rssi_chain3 in place for AR900B builds until code using
  825. * rssi_chain3 has been converted to use wlan_dbg_rx_rate_info_v2_t.
  826. */
  827. A_UINT32 rssi_chain3;
  828. } wlan_dbg_rx_rate_info_v1b_t;
  829. #if defined(AR900B)
  830. #define wlan_dbg_rx_rate_info_t wlan_dbg_rx_rate_info_v1b_t
  831. #else
  832. #define wlan_dbg_rx_rate_info_t wlan_dbg_rx_rate_info_v1a_t
  833. #endif
  834. typedef struct {
  835. A_UINT32 mcs[10];
  836. A_UINT32 sgi[10];
  837. /*
  838. * TEMPORARY: leave nss conditionally defined, until all code that
  839. * requires nss[4] is converted to use wlan_dbg_tx_rate_info_v2_t.
  840. * At that time, this nss array will be made length = 3 unconditionally.
  841. */
  842. #if defined(CONFIG_AR900B_SUPPORT) || defined(AR900B)
  843. A_UINT32 nss[4];
  844. #else
  845. A_UINT32 nss[3];
  846. #endif
  847. A_UINT32 stbc[10];
  848. A_UINT32 bw[3];
  849. A_UINT32 pream[4];
  850. A_UINT32 ldpc;
  851. A_UINT32 rts_cnt;
  852. A_UINT32 ack_rssi;
  853. } wlan_dbg_tx_rate_info_t ;
  854. #define WLAN_MAX_MCS 10
  855. typedef struct {
  856. A_UINT32 mcs[WLAN_MAX_MCS];
  857. A_UINT32 sgi[WLAN_MAX_MCS];
  858. A_UINT32 nss[MAX_SPATIAL_STREAM_ANY_V2];
  859. A_UINT32 nsts;
  860. A_UINT32 stbc[WLAN_MAX_MCS];
  861. A_UINT32 bw[NUM_DYN_BW_MAX];
  862. A_UINT32 pream[6];
  863. A_UINT32 ldpc;
  864. A_UINT32 txbf;
  865. A_UINT32 mgmt_rssi;
  866. A_UINT32 data_rssi;
  867. A_UINT32 rssi_chain0;
  868. A_UINT32 rssi_chain1;
  869. A_UINT32 rssi_chain2;
  870. A_UINT32 rssi_chain3;
  871. A_UINT32 reserved[8];
  872. } wlan_dbg_rx_rate_info_v2_t;
  873. typedef struct {
  874. A_UINT32 mcs[WLAN_MAX_MCS];
  875. A_UINT32 sgi[WLAN_MAX_MCS];
  876. A_UINT32 nss[MAX_SPATIAL_STREAM_ANY_V2];
  877. A_UINT32 stbc[WLAN_MAX_MCS];
  878. A_UINT32 bw[NUM_DYN_BW_MAX];
  879. A_UINT32 pream[4];
  880. A_UINT32 ldpc;
  881. A_UINT32 rts_cnt;
  882. A_UINT32 ack_rssi;
  883. A_UINT32 reserved[8];
  884. } wlan_dbg_tx_rate_info_v2_t;
  885. typedef struct {
  886. A_UINT32 mcs[WLAN_MAX_MCS];
  887. A_UINT32 sgi[WLAN_MAX_MCS];
  888. A_UINT32 nss[MAX_SPATIAL_STREAM_ANY_V3];
  889. A_UINT32 nsts;
  890. A_UINT32 stbc[WLAN_MAX_MCS];
  891. A_UINT32 bw[NUM_DYN_BW_MAX];
  892. A_UINT32 pream[6];
  893. A_UINT32 ldpc;
  894. A_UINT32 txbf;
  895. A_UINT32 mgmt_rssi;
  896. A_UINT32 data_rssi;
  897. A_UINT32 rssi_chain0;
  898. A_UINT32 rssi_chain1;
  899. A_UINT32 rssi_chain2;
  900. A_UINT32 rssi_chain3;
  901. A_UINT32 reserved[8];
  902. } wlan_dbg_rx_rate_info_v3_t;
  903. typedef struct {
  904. A_UINT32 mcs[WLAN_MAX_MCS];
  905. A_UINT32 sgi[WLAN_MAX_MCS];
  906. A_UINT32 nss[MAX_SPATIAL_STREAM_ANY_V3];
  907. A_UINT32 stbc[WLAN_MAX_MCS];
  908. A_UINT32 bw[NUM_DYN_BW_MAX];
  909. A_UINT32 pream[4];
  910. A_UINT32 ldpc;
  911. A_UINT32 rts_cnt;
  912. A_UINT32 ack_rssi;
  913. A_UINT32 reserved[8];
  914. } wlan_dbg_tx_rate_info_v3_t;
  915. #define WHAL_DBG_PHY_ERR_MAXCNT 18
  916. #define WHAL_DBG_SIFS_STATUS_MAXCNT 8
  917. #define WHAL_DBG_SIFS_ERR_MAXCNT 8
  918. #define WHAL_DBG_CMD_RESULT_MAXCNT 11
  919. #define WHAL_DBG_CMD_STALL_ERR_MAXCNT 4
  920. #define WHAL_DBG_FLUSH_REASON_MAXCNT 40
  921. typedef enum {
  922. WIFI_URRN_STATS_FIRST_PKT,
  923. WIFI_URRN_STATS_BETWEEN_MPDU,
  924. WIFI_URRN_STATS_WITHIN_MPDU,
  925. WHAL_MAX_URRN_STATS
  926. } wifi_urrn_type_t;
  927. typedef struct wlan_dbg_txbf_snd_stats {
  928. A_UINT32 cbf_20[4];
  929. A_UINT32 cbf_40[4];
  930. A_UINT32 cbf_80[4];
  931. A_UINT32 sounding[9];
  932. A_UINT32 cbf_160[4];
  933. } wlan_dbg_txbf_snd_stats_t;
  934. typedef struct wlan_dbg_wifi2_error_stats {
  935. A_UINT32 urrn_stats[WHAL_MAX_URRN_STATS];
  936. A_UINT32 flush_errs[WHAL_DBG_FLUSH_REASON_MAXCNT];
  937. A_UINT32 schd_stall_errs[WHAL_DBG_CMD_STALL_ERR_MAXCNT];
  938. A_UINT32 schd_cmd_result[WHAL_DBG_CMD_RESULT_MAXCNT];
  939. A_UINT32 sifs_status[WHAL_DBG_SIFS_STATUS_MAXCNT];
  940. A_UINT8 phy_errs[WHAL_DBG_PHY_ERR_MAXCNT];
  941. A_UINT32 rx_rate_inval;
  942. } wlan_dbg_wifi2_error_stats_t;
  943. typedef struct wlan_dbg_wifi2_error2_stats {
  944. A_UINT32 schd_errs[WHAL_DBG_CMD_STALL_ERR_MAXCNT];
  945. A_UINT32 sifs_errs[WHAL_DBG_SIFS_ERR_MAXCNT];
  946. } wlan_dbg_wifi2_error2_stats_t;
  947. #define WLAN_DBG_STATS_SIZE_TXBF_VHT 10
  948. #define WLAN_DBG_STATS_SIZE_TXBF_HT 8
  949. #define WLAN_DBG_STATS_SIZE_TXBF_OFDM 8
  950. #define WLAN_DBG_STATS_SIZE_TXBF_CCK 7
  951. typedef struct wlan_dbg_txbf_data_stats {
  952. A_UINT32 tx_txbf_vht[WLAN_DBG_STATS_SIZE_TXBF_VHT];
  953. A_UINT32 rx_txbf_vht[WLAN_DBG_STATS_SIZE_TXBF_VHT];
  954. A_UINT32 tx_txbf_ht[WLAN_DBG_STATS_SIZE_TXBF_HT];
  955. A_UINT32 tx_txbf_ofdm[WLAN_DBG_STATS_SIZE_TXBF_OFDM];
  956. A_UINT32 tx_txbf_cck[WLAN_DBG_STATS_SIZE_TXBF_CCK];
  957. } wlan_dbg_txbf_data_stats_t;
  958. struct wlan_dbg_tx_mu_stats {
  959. A_UINT32 mu_sch_nusers_2;
  960. A_UINT32 mu_sch_nusers_3;
  961. A_UINT32 mu_mpdus_queued_usr[4];
  962. A_UINT32 mu_mpdus_tried_usr[4];
  963. A_UINT32 mu_mpdus_failed_usr[4];
  964. A_UINT32 mu_mpdus_requeued_usr[4];
  965. A_UINT32 mu_err_no_ba_usr[4];
  966. A_UINT32 mu_mpdu_underrun_usr[4];
  967. A_UINT32 mu_ampdu_underrun_usr[4];
  968. };
  969. struct wlan_dbg_tx_selfgen_stats {
  970. A_UINT32 su_ndpa;
  971. A_UINT32 su_ndp;
  972. A_UINT32 mu_ndpa;
  973. A_UINT32 mu_ndp;
  974. A_UINT32 mu_brpoll_1;
  975. A_UINT32 mu_brpoll_2;
  976. A_UINT32 mu_bar_1;
  977. A_UINT32 mu_bar_2;
  978. A_UINT32 cts_burst;
  979. A_UINT32 su_ndp_err;
  980. A_UINT32 su_ndpa_err;
  981. A_UINT32 mu_ndp_err;
  982. A_UINT32 mu_brp1_err;
  983. A_UINT32 mu_brp2_err;
  984. };
  985. typedef struct wlan_dbg_sifs_resp_stats {
  986. A_UINT32 ps_poll_trigger; /* num ps-poll trigger frames */
  987. A_UINT32 uapsd_trigger; /* num uapsd trigger frames */
  988. A_UINT32 qb_data_trigger[2]; /* num data trigger frames; idx 0: explicit and idx 1: implicit */
  989. A_UINT32 qb_bar_trigger[2]; /* num bar trigger frames; idx 0: explicit and idx 1: implicit */
  990. A_UINT32 sifs_resp_data; /* num ppdus transmitted at SIFS interval */
  991. A_UINT32 sifs_resp_err; /* num ppdus failed to meet SIFS resp timing */
  992. } wlan_dgb_sifs_resp_stats_t;
  993. /** wlan_dbg_wifi2_error_stats_t is not grouped with the
  994. * following structure as it is allocated differently and only
  995. * belongs to whal
  996. */
  997. typedef struct wlan_dbg_stats_wifi2 {
  998. wlan_dbg_txbf_snd_stats_t txbf_snd_info;
  999. wlan_dbg_txbf_data_stats_t txbf_data_info;
  1000. struct wlan_dbg_tx_selfgen_stats tx_selfgen;
  1001. struct wlan_dbg_tx_mu_stats tx_mu;
  1002. wlan_dgb_sifs_resp_stats_t sifs_resp_info;
  1003. } wlan_dbg_wifi2_stats_t;
  1004. /*
  1005. * wlan_dbg_rx_rate_info_v1a, _v1b:
  1006. * differing versions of the wlan_dbg_rx_rate_info struct used by different
  1007. * targets
  1008. */
  1009. typedef struct {
  1010. wlan_dbg_rx_rate_info_v1a_t rx_phy_info;
  1011. wlan_dbg_tx_rate_info_t tx_rate_info;
  1012. } wlan_dbg_rate_info_v1a_t;
  1013. typedef struct {
  1014. wlan_dbg_rx_rate_info_v1b_t rx_phy_info;
  1015. wlan_dbg_tx_rate_info_t tx_rate_info;
  1016. } wlan_dbg_rate_info_v1b_t;
  1017. #if defined(AR900B)
  1018. #define wlan_dbg_rate_info_t wlan_dbg_rate_info_v1b_t
  1019. #else
  1020. #define wlan_dbg_rate_info_t wlan_dbg_rate_info_v1a_t
  1021. #endif
  1022. typedef struct {
  1023. wlan_dbg_rx_rate_info_v2_t rx_phy_info;
  1024. wlan_dbg_tx_rate_info_v2_t tx_rate_info;
  1025. } wlan_dbg_rate_info_v2_t;
  1026. /*
  1027. * wlan_dbg_stats_v1, _v2:
  1028. * differing versions of the wlan_dbg_stats struct used by different
  1029. * targets
  1030. */
  1031. struct wlan_dbg_stats_v1 {
  1032. struct wlan_dbg_tx_stats_v1 tx;
  1033. struct wlan_dbg_rx_stats_v1 rx;
  1034. struct wlan_dbg_peer_stats peer;
  1035. };
  1036. struct wlan_dbg_stats_v2 {
  1037. struct wlan_dbg_tx_stats_v2 tx;
  1038. struct wlan_dbg_rx_stats_v2 rx;
  1039. struct wlan_dbg_mem_stats mem;
  1040. struct wlan_dbg_peer_stats peer;
  1041. };
  1042. #if defined(AR900B)
  1043. #define wlan_dbg_stats wlan_dbg_stats_v2
  1044. #else
  1045. #define wlan_dbg_stats wlan_dbg_stats_v1
  1046. #endif
  1047. #define DBG_STATS_MAX_HWQ_NUM 10
  1048. #define DBG_STATS_MAX_TID_NUM 20
  1049. #define DBG_STATS_MAX_CONG_NUM 16
  1050. struct wlan_dbg_txq_stats {
  1051. A_UINT16 num_pkts_queued[DBG_STATS_MAX_HWQ_NUM];
  1052. A_UINT16 tid_hw_qdepth[DBG_STATS_MAX_TID_NUM]; /* WAL_MAX_TID is 20 */
  1053. A_UINT16 tid_sw_qdepth[DBG_STATS_MAX_TID_NUM]; /* WAL_MAX_TID is 20 */
  1054. };
  1055. struct wlan_dbg_tidq_stats {
  1056. A_UINT32 wlan_dbg_tid_txq_status;
  1057. struct wlan_dbg_txq_stats txq_st;
  1058. };
  1059. typedef enum {
  1060. WLAN_DBG_DATA_STALL_NONE = 0,
  1061. WLAN_DBG_DATA_STALL_VDEV_PAUSE, /* 1 */
  1062. WLAN_DBG_DATA_STALL_HWSCHED_CMD_FILTER, /* 2 */
  1063. WLAN_DBG_DATA_STALL_HWSCHED_CMD_FLUSH, /* 3 */
  1064. WLAN_DBG_DATA_STALL_RX_REFILL_FAILED, /* 4 */
  1065. WLAN_DBG_DATA_STALL_RX_FCS_LEN_ERROR, /* 5 */
  1066. WLAN_DBG_DATA_STALL_MAC_WDOG_ERRORS, /* 6 */ /* Mac watch dog */
  1067. WLAN_DBG_DATA_STALL_PHY_BB_WDOG_ERROR, /* 7 */ /* PHY watch dog */
  1068. WLAN_DBG_DATA_STALL_POST_TIM_NO_TXRX_ERROR, /* 8 */
  1069. WLAN_DBG_DATA_STALL_MAX,
  1070. } wlan_dbg_data_stall_type_e;
  1071. typedef enum {
  1072. WLAN_DBG_DATA_STALL_RECOVERY_NONE = 0,
  1073. WLAN_DBG_DATA_STALL_RECOVERY_CONNECT_DISCONNECT,
  1074. WLAN_DBG_DATA_STALL_RECOVERY_CONNECT_MAC_PHY_RESET,
  1075. WLAN_DBG_DATA_STALL_RECOVERY_CONNECT_PDR,
  1076. WLAN_DBG_DATA_STALL_RECOVERY_CONNECT_SSR,
  1077. } wlan_dbg_data_stall_recovery_type_e;
  1078. /*
  1079. * NOTE: If necessary, restore the explicit disabling of CONFIG_160MHZ_SUPPORT
  1080. * See the corresponding comment + pre-processor block at the top of the file.
  1081. */
  1082. #ifdef CONFIG_160MHZ_SUPPORT_UNDEF_WAR
  1083. #define CONFIG_160MHZ_SUPPORT 0
  1084. #undef CONFIG_160MHZ_SUPPORT_UNDEF_WAR
  1085. #endif
  1086. #endif /* __WLANDEFS_H__ */