wlan_defs.h 41 KB

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