wlan_defs.h 41 KB

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