wlan_defs.h 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895
  1. /*
  2. * Copyright (c) 2004-2010, 2013-2016 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. #ifndef CONFIG_160MHZ_SUPPORT
  42. #define CONFIG_160MHZ_SUPPORT 0 /* default: 160 MHz channels not supported */
  43. #endif
  44. #ifndef SUPPORT_11AX
  45. #define SUPPORT_11AX 0 /* 11ax not supported by default */
  46. #endif
  47. /*
  48. * MAX_SPATIAL_STREAM_ANY -
  49. * what is the largest number of spatial streams that any target supports
  50. */
  51. #define MAX_SPATIAL_STREAM_ANY_V2 4 /* pre-hawkeye */
  52. #define MAX_SPATIAL_STREAM_ANY_V3 8 /* includes hawkeye */
  53. /*
  54. * (temporarily) leave the old MAX_SPATIAL_STREAM_ANY name in place as an alias,
  55. * and in case some old code is using it
  56. */
  57. #define MAX_SPATIAL_STREAM_ANY MAX_SPATIAL_STREAM_ANY_V2 /* DEPRECATED */
  58. typedef enum {
  59. MODE_11A = 0, /* 11a Mode */
  60. MODE_11G = 1, /* 11b/g Mode */
  61. MODE_11B = 2, /* 11b Mode */
  62. MODE_11GONLY = 3, /* 11g only Mode */
  63. MODE_11NA_HT20 = 4, /* 11a HT20 mode */
  64. MODE_11NG_HT20 = 5, /* 11g HT20 mode */
  65. MODE_11NA_HT40 = 6, /* 11a HT40 mode */
  66. MODE_11NG_HT40 = 7, /* 11g HT40 mode */
  67. MODE_11AC_VHT20 = 8,
  68. MODE_11AC_VHT40 = 9,
  69. MODE_11AC_VHT80 = 10,
  70. MODE_11AC_VHT20_2G = 11,
  71. MODE_11AC_VHT40_2G = 12,
  72. MODE_11AC_VHT80_2G = 13,
  73. #if CONFIG_160MHZ_SUPPORT
  74. MODE_11AC_VHT80_80 = 14,
  75. MODE_11AC_VHT160 = 15,
  76. #endif
  77. #if SUPPORT_11AX
  78. MODE_11AX_HE20 = 16,
  79. MODE_11AX_HE40 = 17,
  80. MODE_11AX_HE80 = 18,
  81. MODE_11AX_HE80_80 = 19,
  82. MODE_11AX_HE160 = 20,
  83. MODE_11AX_HE20_2G = 21,
  84. MODE_11AX_HE40_2G = 22,
  85. MODE_11AX_HE80_2G = 23,
  86. #endif
  87. /*
  88. * MODE_UNKNOWN should not be used within the host / target interface.
  89. * Thus, it is permissible for ODE_UNKNOWN to be conditionally-defined,
  90. * taking different values when compiling for different targets.
  91. */
  92. MODE_UNKNOWN,
  93. MODE_UNKNOWN_NO_160MHZ_SUPPORT = 14, /* not needed? */
  94. #if 0
  95. MODE_UNKNOWN_NO_11AX_SUPPORT = 16, /* not needed? */
  96. MODE_UNKNOWN_11AX_SUPPORT = 24, /* not needed? */
  97. #endif
  98. MODE_UNKNOWN_160MHZ_SUPPORT = MODE_UNKNOWN, /* not needed? */
  99. #ifdef ATHR_WIN_NWF
  100. PHY_MODE_MAX = MODE_UNKNOWN,
  101. PHY_MODE_MAX_NO_160_MHZ_SUPPORT = MODE_UNKNOWN_NO_160MHZ_SUPPORT,
  102. PHY_MODE_MAX_160_MHZ_SUPPORT = MODE_UNKNOWN_160MHZ_SUPPORT,
  103. #else
  104. MODE_MAX = MODE_UNKNOWN,
  105. MODE_MAX_NO_160_MHZ_SUPPORT = MODE_UNKNOWN_NO_160MHZ_SUPPORT,
  106. MODE_MAX_160_MHZ_SUPPORT = MODE_UNKNOWN_160MHZ_SUPPORT,
  107. #endif
  108. } WLAN_PHY_MODE;
  109. #if CONFIG_160MHZ_SUPPORT == 0
  110. A_COMPILE_TIME_ASSERT(
  111. mode_unknown_value_consistency_Check,
  112. MODE_UNKNOWN == MODE_UNKNOWN_NO_160MHZ_SUPPORT);
  113. #else
  114. A_COMPILE_TIME_ASSERT(
  115. mode_unknown_value_consistency_Check,
  116. MODE_UNKNOWN == MODE_UNKNOWN_160MHZ_SUPPORT);
  117. #endif
  118. typedef enum {
  119. VHT_MODE_NONE = 0, /* NON VHT Mode, e.g., HT, DSSS, CCK */
  120. VHT_MODE_20M = 1,
  121. VHT_MODE_40M = 2,
  122. VHT_MODE_80M = 3,
  123. VHT_MODE_160M = 4
  124. } VHT_OPER_MODE;
  125. typedef enum {
  126. WLAN_11A_CAPABILITY = 1,
  127. WLAN_11G_CAPABILITY = 2,
  128. WLAN_11AG_CAPABILITY = 3,
  129. } WLAN_CAPABILITY;
  130. #if (NUM_SPATIAL_STREAM > 4) || SUPPORT_11AX
  131. typedef struct {
  132. A_UINT64 mask_l;
  133. A_UINT64 mask_h;
  134. } A_RATEMASK;
  135. #elif (NUM_SPATIAL_STREAM > 3)
  136. #define A_RATEMASK A_UINT64
  137. #else
  138. #define A_RATEMASK A_UINT32
  139. #endif
  140. #if (NUM_SPATIAL_STREAM > 4) || SUPPORT_11AX
  141. typedef A_UINT16 A_RATE;
  142. typedef A_UINT16 A_RATECODE;
  143. #else
  144. typedef A_UINT8 A_RATE;
  145. typedef A_UINT8 A_RATECODE;
  146. #endif
  147. #define A_RATEMASK_NUM_OCTET (sizeof (A_RATEMASK))
  148. #define A_RATEMASK_NUM_BITS ((sizeof (A_RATEMASK)) << 3)
  149. #if CONFIG_160MHZ_SUPPORT
  150. #define IS_MODE_VHT(mode) (((mode) == MODE_11AC_VHT20) || \
  151. ((mode) == MODE_11AC_VHT40) || \
  152. ((mode) == MODE_11AC_VHT80) || \
  153. ((mode) == MODE_11AC_VHT80_80) || \
  154. ((mode) == MODE_11AC_VHT160))
  155. #else
  156. #define IS_MODE_VHT(mode) (((mode) == MODE_11AC_VHT20) || \
  157. ((mode) == MODE_11AC_VHT40) || \
  158. ((mode) == MODE_11AC_VHT80))
  159. #endif
  160. #define IS_MODE_HE(mode) (((mode) == MODE_11AX_HE20) || \
  161. ((mode) == MODE_11AX_HE40) || \
  162. ((mode) == MODE_11AX_HE80) || \
  163. ((mode) == MODE_11AX_HE80_80) || \
  164. ((mode) == MODE_11AX_HE160) || \
  165. ((mode) == MODE_11AX_HE20_2G) || \
  166. ((mode) == MODE_11AX_HE40_2G) || \
  167. ((mode) == MODE_11AX_HE80_2G))
  168. #define IS_MODE_VHT_2G(mode) (((mode) == MODE_11AC_VHT20_2G) || \
  169. ((mode) == MODE_11AC_VHT40_2G) || \
  170. ((mode) == MODE_11AC_VHT80_2G))
  171. #define IS_MODE_11A(mode) (((mode) == MODE_11A) || \
  172. ((mode) == MODE_11NA_HT20) || \
  173. ((mode) == MODE_11NA_HT40) || \
  174. (IS_MODE_VHT(mode)))
  175. #define IS_MODE_11B(mode) ((mode) == MODE_11B)
  176. #define IS_MODE_11G(mode) (((mode) == MODE_11G) || \
  177. ((mode) == MODE_11GONLY) || \
  178. ((mode) == MODE_11NG_HT20) || \
  179. ((mode) == MODE_11NG_HT40) || \
  180. (IS_MODE_VHT_2G(mode)))
  181. #define IS_MODE_11GN(mode) (((mode) == MODE_11NG_HT20) || \
  182. ((mode) == MODE_11NG_HT40))
  183. #define IS_MODE_11GONLY(mode) ((mode) == MODE_11GONLY)
  184. enum {
  185. REGDMN_MODE_11A = 0x00000001, /* 11a channels */
  186. REGDMN_MODE_TURBO = 0x00000002, /* 11a turbo-only channels */
  187. REGDMN_MODE_11B = 0x00000004, /* 11b channels */
  188. REGDMN_MODE_PUREG = 0x00000008, /* 11g channels (OFDM only) */
  189. REGDMN_MODE_11G = 0x00000008, /* XXX historical */
  190. REGDMN_MODE_108G = 0x00000020, /* 11g+Turbo channels */
  191. REGDMN_MODE_108A = 0x00000040, /* 11a+Turbo channels */
  192. REGDMN_MODE_XR = 0x00000100, /* XR channels */
  193. REGDMN_MODE_11A_HALF_RATE = 0x00000200, /* 11A half rate channels */
  194. REGDMN_MODE_11A_QUARTER_RATE = 0x00000400, /* 11A quarter rate channels */
  195. REGDMN_MODE_11NG_HT20 = 0x00000800, /* 11N-G HT20 channels */
  196. REGDMN_MODE_11NA_HT20 = 0x00001000, /* 11N-A HT20 channels */
  197. REGDMN_MODE_11NG_HT40PLUS = 0x00002000, /* 11N-G HT40 + channels */
  198. REGDMN_MODE_11NG_HT40MINUS = 0x00004000, /* 11N-G HT40 - channels */
  199. REGDMN_MODE_11NA_HT40PLUS = 0x00008000, /* 11N-A HT40 + channels */
  200. REGDMN_MODE_11NA_HT40MINUS = 0x00010000, /* 11N-A HT40 - channels */
  201. REGDMN_MODE_11AC_VHT20 = 0x00020000, /* 5Ghz, VHT20 */
  202. REGDMN_MODE_11AC_VHT40PLUS = 0x00040000, /* 5Ghz, VHT40 + channels */
  203. REGDMN_MODE_11AC_VHT40MINUS = 0x00080000, /* 5Ghz VHT40 - channels */
  204. REGDMN_MODE_11AC_VHT80 = 0x000100000, /* 5Ghz, VHT80 channels */
  205. REGDMN_MODE_11AC_VHT20_2G = 0x000200000, /* 2Ghz, VHT20 */
  206. REGDMN_MODE_11AC_VHT40_2G = 0x000400000, /* 2Ghz, VHT40 */
  207. REGDMN_MODE_11AC_VHT80_2G = 0x000800000, /* 2Ghz, VHT80 */
  208. REGDMN_MODE_11AC_VHT160 = 0x001000000, /* 5Ghz, VHT160 */
  209. REGDMN_MODE_11AC_VHT40_2GPLUS = 0x002000000, /* 2Ghz, VHT40+ */
  210. REGDMN_MODE_11AC_VHT40_2GMINUS = 0x004000000, /* 2Ghz, VHT40- */
  211. REGDMN_MODE_11AC_VHT80_80 = 0x008000000, /* 5GHz, VHT80+80 */
  212. };
  213. #define REGDMN_MODE_ALL (0xFFFFFFFF) /* REGDMN_MODE_ALL is defined out of the enum
  214. * to prevent the ARM compile "warning #66:
  215. * enumeration value is out of int range"
  216. * Anyway, this is a BIT-OR of all possible values.
  217. */
  218. #define REGDMN_CAP1_CHAN_HALF_RATE 0x00000001
  219. #define REGDMN_CAP1_CHAN_QUARTER_RATE 0x00000002
  220. #define REGDMN_CAP1_CHAN_HAL49GHZ 0x00000004
  221. /* regulatory capabilities */
  222. #define REGDMN_EEPROM_EEREGCAP_EN_FCC_MIDBAND 0x0040
  223. #define REGDMN_EEPROM_EEREGCAP_EN_KK_U1_EVEN 0x0080
  224. #define REGDMN_EEPROM_EEREGCAP_EN_KK_U2 0x0100
  225. #define REGDMN_EEPROM_EEREGCAP_EN_KK_MIDBAND 0x0200
  226. #define REGDMN_EEPROM_EEREGCAP_EN_KK_U1_ODD 0x0400
  227. #define REGDMN_EEPROM_EEREGCAP_EN_KK_NEW_11A 0x0800
  228. typedef struct {
  229. A_UINT32 tlv_header; /* TLV tag and len; tag equals WMI_TLVTAG_STRUC_HAL_REG_CAPABILITIES */
  230. A_UINT32 eeprom_rd; /* regdomain value specified in EEPROM */
  231. A_UINT32 eeprom_rd_ext; /* regdomain */
  232. A_UINT32 regcap1; /* CAP1 capabilities bit map. */
  233. A_UINT32 regcap2; /* REGDMN EEPROM CAP. */
  234. A_UINT32 wireless_modes; /* REGDMN MODE */
  235. A_UINT32 low_2ghz_chan;
  236. A_UINT32 high_2ghz_chan;
  237. A_UINT32 low_5ghz_chan;
  238. A_UINT32 high_5ghz_chan;
  239. } HAL_REG_CAPABILITIES;
  240. /*
  241. * Used to update rate-control logic with the status of the tx-completion.
  242. * In host-based implementation of the rate-control feature, this struture is used to
  243. * create the payload for HTT message/s from target to host.
  244. */
  245. typedef struct {
  246. A_RATECODE rateCode;
  247. A_UINT8 flags;
  248. } RATE_CODE;
  249. typedef struct {
  250. RATE_CODE ptx_rc; /* rate code, bw, chain mask sgi */
  251. A_UINT8 reserved[2];
  252. A_UINT32 flags; /* Encodes information such as excessive
  253. retransmission, aggregate, some info
  254. from .11 frame control,
  255. STBC, LDPC, (SGI and Tx Chain Mask
  256. are encoded in ptx_rc->flags field),
  257. AMPDU truncation (BT/time based etc.),
  258. RTS/CTS attempt */
  259. A_UINT32 num_enqued; /* # of MPDUs (for non-AMPDU 1) for this rate */
  260. A_UINT32 num_retries; /* Total # of transmission attempt for this rate */
  261. A_UINT32 num_failed; /* # of failed MPDUs in A-MPDU, 0 otherwise */
  262. A_UINT32 ack_rssi; /* ACK RSSI: b'7..b'0 avg RSSI across all chain */
  263. A_UINT32 time_stamp ; /* ACK timestamp (helps determine age) */
  264. A_UINT32 is_probe; /* Valid if probing. Else, 0 */
  265. A_UINT32 ba_win_size; /* b'7..b0, block Ack Window size, b'31..b8 Resvd */
  266. A_UINT32 failed_ba_bmap_0_31; /* failed BA bitmap 0..31 */
  267. A_UINT32 failed_ba_bmap_32_63; /* failed BA bitmap 32..63 */
  268. A_UINT32 bmap_tried_0_31; /* enqued bitmap 0..31 */
  269. A_UINT32 bmap_tried_32_63; /* enqued bitmap 32..63 */
  270. } RC_TX_DONE_PARAMS;
  271. #define RC_SET_TX_DONE_INFO(_dst, _rc, _f, _nq, _nr, _nf, _rssi, _ts) \
  272. do { \
  273. (_dst).ptx_rc.rateCode = (_rc).rateCode; \
  274. (_dst).ptx_rc.flags = (_rc).flags; \
  275. (_dst).flags = (_f); \
  276. (_dst).num_enqued = (_nq); \
  277. (_dst).num_retries = (_nr); \
  278. (_dst).num_failed = (_nf); \
  279. (_dst).ack_rssi = (_rssi); \
  280. (_dst).time_stamp = (_ts); \
  281. } while (0)
  282. #define RC_SET_TXBF_DONE_INFO(_dst, _f) \
  283. do { \
  284. (_dst).flags |= (_f); \
  285. } while (0)
  286. /* NOTE: NUM_DYN_BW and NUM_SCHED_ENTRIES cannot be changed without breaking WMI Compatibility */
  287. #define NUM_SCHED_ENTRIES 2
  288. #define NUM_DYN_BW_MAX 4
  289. /* Some products only use 20/40/80; some use 20/40/80/160 */
  290. #ifndef NUM_DYN_BW
  291. #define NUM_DYN_BW 3 /* default: support up through 80 MHz */
  292. #endif
  293. #define NUM_DYN_BW_MASK 0x3
  294. #define PROD_SCHED_BW_ENTRIES (NUM_SCHED_ENTRIES * NUM_DYN_BW)
  295. #if NUM_DYN_BW > 4
  296. /* Extend rate table module first */
  297. #error "Extend rate table module first"
  298. #endif
  299. #define MAX_IBSS_PEERS 32
  300. /*
  301. * RC_TX_RATE_SCHEDULE and RC_TX_RATE_INFO defs are used only in the target.
  302. * (Host-based rate control is no longer applicable.)
  303. * Maintain the defs in wlanfw_cmn for the sake of existing Rome / Helium
  304. * targets, but for Lithium targets remove them from wlanfw_cmn and define
  305. * them in a target-only location instead.
  306. * SUPPORT_11AX is essentially used as a condition to identify Lithium targets.
  307. * Some host drivers would also have SUPPORT_11AX defined, and thus would lose
  308. * the definition of RC_TX_RATE_SCHEDULE and RC_TX_RATE_INFO, but that's okay
  309. * because the host should have no references to these target-only data
  310. * structures.
  311. */
  312. #if !((NUM_SPATIAL_STREAM > 4) || SUPPORT_11AX)
  313. #if defined(CONFIG_AR900B_SUPPORT) || defined(AR900B)
  314. typedef struct{
  315. A_UINT32 psdu_len[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  316. A_UINT16 flags[NUM_SCHED_ENTRIES][NUM_DYN_BW];
  317. A_RATE rix[NUM_SCHED_ENTRIES][NUM_DYN_BW];
  318. A_UINT8 tpc[NUM_SCHED_ENTRIES][NUM_DYN_BW];
  319. A_UINT32 antmask[NUM_SCHED_ENTRIES];
  320. A_UINT8 num_mpdus[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  321. A_UINT16 txbf_cv_len;
  322. A_UINT32 txbf_cv_ptr;
  323. A_UINT16 txbf_flags;
  324. A_UINT16 txbf_cv_size;
  325. A_UINT8 txbf_nc_idx;
  326. A_UINT8 tries[NUM_SCHED_ENTRIES];
  327. A_UINT8 bw_mask[NUM_SCHED_ENTRIES];
  328. A_UINT8 max_bw[NUM_SCHED_ENTRIES];
  329. A_UINT8 num_sched_entries;
  330. A_UINT8 paprd_mask;
  331. A_UINT8 rts_rix;
  332. A_UINT8 sh_pream;
  333. A_UINT8 min_spacing_1_4_us;
  334. A_UINT8 fixed_delims;
  335. A_UINT8 bw_in_service;
  336. A_RATE probe_rix;
  337. A_UINT8 num_valid_rates;
  338. A_UINT8 rtscts_tpc;
  339. A_UINT8 dd_profile;
  340. } RC_TX_RATE_SCHEDULE;
  341. #else
  342. typedef struct{
  343. A_UINT32 psdu_len[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  344. A_UINT16 flags[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  345. A_RATE rix[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  346. A_UINT8 tpc[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  347. A_UINT8 num_mpdus[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  348. A_UINT32 antmask[NUM_SCHED_ENTRIES];
  349. A_UINT32 txbf_cv_ptr;
  350. A_UINT16 txbf_cv_len;
  351. A_UINT8 tries[NUM_SCHED_ENTRIES];
  352. A_UINT8 num_valid_rates;
  353. A_UINT8 paprd_mask;
  354. A_UINT8 rts_rix;
  355. A_UINT8 sh_pream;
  356. A_UINT8 min_spacing_1_4_us;
  357. A_UINT8 fixed_delims;
  358. A_UINT8 bw_in_service;
  359. A_RATE probe_rix;
  360. } RC_TX_RATE_SCHEDULE;
  361. #endif
  362. typedef struct{
  363. A_UINT16 flags[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  364. A_RATE rix[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  365. #ifdef DYN_TPC_ENABLE
  366. A_UINT8 tpc[NUM_DYN_BW * NUM_SCHED_ENTRIES];
  367. #endif
  368. #ifdef SECTORED_ANTENNA
  369. A_UINT32 antmask[NUM_SCHED_ENTRIES];
  370. #endif
  371. A_UINT8 tries[NUM_SCHED_ENTRIES];
  372. A_UINT8 num_valid_rates;
  373. A_UINT8 rts_rix;
  374. A_UINT8 sh_pream;
  375. A_UINT8 bw_in_service;
  376. A_RATE probe_rix;
  377. A_UINT8 dd_profile;
  378. } RC_TX_RATE_INFO;
  379. #endif /* !((NUM_SPATIAL_STREAM > 4) || SUPPORT_11AX) */
  380. /*
  381. * Temporarily continue to provide the WHAL_RC_INIT_RC_MASKS def in wlan_defs.h
  382. * for older targets.
  383. * The WHAL_RX_INIT_RC_MASKS macro def needs to be moved into ratectrl_11ac.h
  384. * for all targets, but until this is complete, the WHAL_RC_INIT_RC_MASKS def
  385. * will be maintained here in its old location.
  386. */
  387. #if CONFIG_160MHZ_SUPPORT == 0
  388. #define WHAL_RC_INIT_RC_MASKS(_rm) do { \
  389. _rm[WHAL_RC_MASK_IDX_NON_HT] = A_RATEMASK_OFDM_CCK; \
  390. _rm[WHAL_RC_MASK_IDX_HT_20] = A_RATEMASK_HT_20; \
  391. _rm[WHAL_RC_MASK_IDX_HT_40] = A_RATEMASK_HT_40; \
  392. _rm[WHAL_RC_MASK_IDX_VHT_20] = A_RATEMASK_VHT_20; \
  393. _rm[WHAL_RC_MASK_IDX_VHT_40] = A_RATEMASK_VHT_40; \
  394. _rm[WHAL_RC_MASK_IDX_VHT_80] = A_RATEMASK_VHT_80; \
  395. } while (0)
  396. #endif
  397. /**
  398. * strucutre describing host memory chunk.
  399. */
  400. typedef struct {
  401. A_UINT32 tlv_header; /* TLV tag and len; tag equals WMITLV_TAG_STRUC_wlan_host_memory_chunk */
  402. /** id of the request that is passed up in service ready */
  403. A_UINT32 req_id;
  404. /** the physical address the memory chunk */
  405. A_UINT32 ptr;
  406. /** size of the chunk */
  407. A_UINT32 size;
  408. } wlan_host_memory_chunk;
  409. #define NUM_UNITS_IS_NUM_VDEVS 0x1
  410. #define NUM_UNITS_IS_NUM_PEERS 0x2
  411. #define NUM_UNITS_IS_NUM_ACTIVE_PEERS 0x4
  412. /* request host to allocate memory contiguously */
  413. #define REQ_TO_HOST_FOR_CONT_MEMORY 0x8
  414. /**
  415. * structure used by FW for requesting host memory
  416. */
  417. typedef struct {
  418. A_UINT32 tlv_header; /* TLV tag and len; tag equals WMI_TLVTAG_STRUC_wlan_host_mem_req */
  419. /** ID of the request */
  420. A_UINT32 req_id;
  421. /** size of the of each unit */
  422. A_UINT32 unit_size;
  423. /**
  424. * flags to indicate that
  425. * the number units is dependent
  426. * on number of resources(num vdevs num peers .. etc)
  427. */
  428. A_UINT32 num_unit_info;
  429. /*
  430. * actual number of units to allocate . if flags in the num_unit_info
  431. * indicate that number of units is tied to number of a particular
  432. * resource to allocate then num_units filed is set to 0 and host
  433. * will derive the number units from number of the resources it is
  434. * requesting.
  435. */
  436. A_UINT32 num_units;
  437. } wlan_host_mem_req;
  438. typedef enum {
  439. IGNORE_DTIM = 0x01,
  440. NORMAL_DTIM = 0x02,
  441. STICK_DTIM = 0x03,
  442. AUTO_DTIM = 0x04,
  443. } BEACON_DTIM_POLICY;
  444. /* During test it is observed that 6 * 400 = 2400 can
  445. * be alloced in addition to CFG_TGT_NUM_MSDU_DESC.
  446. * If there is any change memory requirement, this number
  447. * needs to be revisited. */
  448. #define TOTAL_VOW_ALLOCABLE 2400
  449. #define VOW_DESC_GRAB_MAX 800
  450. #define VOW_GET_NUM_VI_STA(vow_config) (((vow_config) & 0xffff0000) >> 16)
  451. #define VOW_GET_DESC_PER_VI_STA(vow_config) ((vow_config) & 0x0000ffff)
  452. /***TODO!!! Get these values dynamically in WMI_READY event and use it to calculate the mem req*/
  453. /* size in bytes required for msdu descriptor. If it changes, this should be updated. LARGE_AP
  454. * case is not considered. LARGE_AP is disabled when VoW is enabled.*/
  455. #define MSDU_DESC_SIZE 20
  456. /* size in bytes required to support a peer in target.
  457. * This obtained by considering Two tids per peer.
  458. * peer structure = 168 bytes
  459. * tid = 96 bytes (per sta 2 means we need 192 bytes)
  460. * peer_cb = 16 * 2
  461. * key = 52 * 2
  462. * AST = 12 * 2
  463. * rate, reorder.. = 384
  464. * smart antenna = 50
  465. */
  466. #define MEMORY_REQ_FOR_PEER 800
  467. /*
  468. * NB: it is important to keep all the fields in the structure dword long
  469. * so that it is easy to handle the statistics in BE host.
  470. */
  471. struct wlan_dbg_tx_stats {
  472. /* Num HTT cookies queued to dispatch list */
  473. A_INT32 comp_queued;
  474. /* Num HTT cookies dispatched */
  475. A_INT32 comp_delivered;
  476. /* Num MSDU queued to WAL */
  477. A_INT32 msdu_enqued;
  478. /* Num MPDU queue to WAL */
  479. A_INT32 mpdu_enqued;
  480. /* Num MSDUs dropped by WMM limit */
  481. A_INT32 wmm_drop;
  482. /* Num Local frames queued */
  483. A_INT32 local_enqued;
  484. /* Num Local frames done */
  485. A_INT32 local_freed;
  486. /* Num queued to HW */
  487. A_INT32 hw_queued;
  488. /* Num PPDU reaped from HW */
  489. A_INT32 hw_reaped;
  490. /* Num underruns */
  491. A_INT32 underrun;
  492. #if defined(AR900B)
  493. /* HW Paused. */
  494. A_UINT32 hw_paused;
  495. #endif
  496. /* Num PPDUs cleaned up in TX abort */
  497. A_INT32 tx_abort;
  498. /* Num MPDUs requed by SW */
  499. A_INT32 mpdus_requed;
  500. /* excessive retries */
  501. A_UINT32 tx_ko;
  502. #if defined(AR900B)
  503. A_UINT32 tx_xretry;
  504. #endif
  505. /* data hw rate code */
  506. A_UINT32 data_rc;
  507. /* Scheduler self triggers */
  508. A_UINT32 self_triggers;
  509. /* frames dropped due to excessive sw retries */
  510. A_UINT32 sw_retry_failure;
  511. /* illegal rate phy errors */
  512. A_UINT32 illgl_rate_phy_err;
  513. /* wal pdev continous xretry */
  514. A_UINT32 pdev_cont_xretry;
  515. /* wal pdev continous xretry */
  516. A_UINT32 pdev_tx_timeout;
  517. /* wal pdev resets */
  518. A_UINT32 pdev_resets;
  519. /* frames dropped due to non-availability of stateless TIDs */
  520. A_UINT32 stateless_tid_alloc_failure;
  521. /* PhY/BB underrun */
  522. A_UINT32 phy_underrun;
  523. /* MPDU is more than txop limit */
  524. A_UINT32 txop_ovf;
  525. #if defined(AR900B)
  526. /* Number of Sequences posted */
  527. A_UINT32 seq_posted;
  528. /* Number of Sequences failed queueing */
  529. A_UINT32 seq_failed_queueing;
  530. /* Number of Sequences completed */
  531. A_UINT32 seq_completed;
  532. /* Number of Sequences restarted */
  533. A_UINT32 seq_restarted;
  534. /* Number of MU Sequences posted */
  535. A_UINT32 mu_seq_posted;
  536. /* Num MPDUs flushed by SW, HWPAUSED, SW TXABORT (Reset,channel change) */
  537. A_INT32 mpdus_sw_flush;
  538. /* Num MPDUs filtered by HW, all filter condition (TTL expired) */
  539. A_INT32 mpdus_hw_filter;
  540. /* Num MPDUs truncated by PDG (TXOP, TBTT, PPDU_duration based on rate, dyn_bw) */
  541. A_INT32 mpdus_truncated;
  542. /* Num MPDUs that was tried but didn't receive ACK or BA */
  543. A_INT32 mpdus_ack_failed;
  544. /* Num MPDUs that was dropped du to expiry. */
  545. A_INT32 mpdus_expired;
  546. #endif
  547. };
  548. struct wlan_dbg_rx_stats {
  549. /* Cnts any change in ring routing mid-ppdu */
  550. A_INT32 mid_ppdu_route_change;
  551. /* Total number of statuses processed */
  552. A_INT32 status_rcvd;
  553. /* Extra frags on rings 0-3 */
  554. A_INT32 r0_frags;
  555. A_INT32 r1_frags;
  556. A_INT32 r2_frags;
  557. A_INT32 r3_frags;
  558. /* MSDUs / MPDUs delivered to HTT */
  559. A_INT32 htt_msdus;
  560. A_INT32 htt_mpdus;
  561. /* MSDUs / MPDUs delivered to local stack */
  562. A_INT32 loc_msdus;
  563. A_INT32 loc_mpdus;
  564. /* AMSDUs that have more MSDUs than the status ring size */
  565. A_INT32 oversize_amsdu;
  566. /* Number of PHY errors */
  567. A_INT32 phy_errs;
  568. /* Number of PHY errors drops */
  569. A_INT32 phy_err_drop;
  570. /* Number of mpdu errors - FCS, MIC, ENC etc. */
  571. A_INT32 mpdu_errs;
  572. #if defined(AR900B)
  573. /* Number of rx overflow errors. */
  574. A_INT32 rx_ovfl_errs;
  575. #endif
  576. };
  577. struct wlan_dbg_mem_stats {
  578. A_UINT32 iram_free_size;
  579. A_UINT32 dram_free_size;
  580. };
  581. struct wlan_dbg_peer_stats {
  582. A_INT32 dummy; /* REMOVE THIS ONCE REAL PEER STAT COUNTERS ARE ADDED */
  583. };
  584. typedef struct {
  585. A_UINT32 mcs[10];
  586. A_UINT32 sgi[10];
  587. A_UINT32 nss[4];
  588. A_UINT32 nsts;
  589. A_UINT32 stbc[10];
  590. A_UINT32 bw[3];
  591. A_UINT32 pream[6];
  592. A_UINT32 ldpc;
  593. A_UINT32 txbf;
  594. A_UINT32 mgmt_rssi;
  595. A_UINT32 data_rssi;
  596. A_UINT32 rssi_chain0;
  597. A_UINT32 rssi_chain1;
  598. A_UINT32 rssi_chain2;
  599. /*
  600. * TEMPORARY: leave rssi_chain3 in place for AR900B builds until code using
  601. * rssi_chain3 has been converted to use wlan_dbg_rx_rate_info_v2_t.
  602. * At that time, this rssi_chain3 field will be deleted.
  603. */
  604. #if defined(AR900B)
  605. A_UINT32 rssi_chain3;
  606. #endif
  607. } wlan_dbg_rx_rate_info_t ;
  608. typedef struct {
  609. A_UINT32 mcs[10];
  610. A_UINT32 sgi[10];
  611. /*
  612. * TEMPORARY: leave nss conditionally defined, until all code that
  613. * requires nss[4] is converted to use wlan_dbg_tx_rate_info_v2_t.
  614. * At that time, this nss array will be made length = 3 unconditionally.
  615. */
  616. #if defined(CONFIG_AR900B_SUPPORT) || defined(AR900B)
  617. A_UINT32 nss[4];
  618. #else
  619. A_UINT32 nss[3];
  620. #endif
  621. A_UINT32 stbc[10];
  622. A_UINT32 bw[3];
  623. A_UINT32 pream[4];
  624. A_UINT32 ldpc;
  625. A_UINT32 rts_cnt;
  626. A_UINT32 ack_rssi;
  627. } wlan_dbg_tx_rate_info_t ;
  628. #define WLAN_MAX_MCS 10
  629. typedef struct {
  630. A_UINT32 mcs[WLAN_MAX_MCS];
  631. A_UINT32 sgi[WLAN_MAX_MCS];
  632. A_UINT32 nss[MAX_SPATIAL_STREAM_ANY_V2];
  633. A_UINT32 nsts;
  634. A_UINT32 stbc[WLAN_MAX_MCS];
  635. A_UINT32 bw[NUM_DYN_BW_MAX];
  636. A_UINT32 pream[6];
  637. A_UINT32 ldpc;
  638. A_UINT32 txbf;
  639. A_UINT32 mgmt_rssi;
  640. A_UINT32 data_rssi;
  641. A_UINT32 rssi_chain0;
  642. A_UINT32 rssi_chain1;
  643. A_UINT32 rssi_chain2;
  644. A_UINT32 rssi_chain3;
  645. A_UINT32 reserved[8];
  646. } wlan_dbg_rx_rate_info_v2_t;
  647. typedef struct {
  648. A_UINT32 mcs[WLAN_MAX_MCS];
  649. A_UINT32 sgi[WLAN_MAX_MCS];
  650. A_UINT32 nss[MAX_SPATIAL_STREAM_ANY_V2];
  651. A_UINT32 stbc[WLAN_MAX_MCS];
  652. A_UINT32 bw[NUM_DYN_BW_MAX];
  653. A_UINT32 pream[4];
  654. A_UINT32 ldpc;
  655. A_UINT32 rts_cnt;
  656. A_UINT32 ack_rssi;
  657. A_UINT32 reserved[8];
  658. } wlan_dbg_tx_rate_info_v2_t;
  659. typedef struct {
  660. A_UINT32 mcs[WLAN_MAX_MCS];
  661. A_UINT32 sgi[WLAN_MAX_MCS];
  662. A_UINT32 nss[MAX_SPATIAL_STREAM_ANY_V3];
  663. A_UINT32 nsts;
  664. A_UINT32 stbc[WLAN_MAX_MCS];
  665. A_UINT32 bw[NUM_DYN_BW_MAX];
  666. A_UINT32 pream[6];
  667. A_UINT32 ldpc;
  668. A_UINT32 txbf;
  669. A_UINT32 mgmt_rssi;
  670. A_UINT32 data_rssi;
  671. A_UINT32 rssi_chain0;
  672. A_UINT32 rssi_chain1;
  673. A_UINT32 rssi_chain2;
  674. A_UINT32 rssi_chain3;
  675. A_UINT32 reserved[8];
  676. } wlan_dbg_rx_rate_info_v3_t;
  677. typedef struct {
  678. A_UINT32 mcs[WLAN_MAX_MCS];
  679. A_UINT32 sgi[WLAN_MAX_MCS];
  680. A_UINT32 nss[MAX_SPATIAL_STREAM_ANY_V3];
  681. A_UINT32 stbc[WLAN_MAX_MCS];
  682. A_UINT32 bw[NUM_DYN_BW_MAX];
  683. A_UINT32 pream[4];
  684. A_UINT32 ldpc;
  685. A_UINT32 rts_cnt;
  686. A_UINT32 ack_rssi;
  687. A_UINT32 reserved[8];
  688. } wlan_dbg_tx_rate_info_v3_t;
  689. #define WHAL_DBG_PHY_ERR_MAXCNT 18
  690. #define WHAL_DBG_SIFS_STATUS_MAXCNT 8
  691. #define WHAL_DBG_SIFS_ERR_MAXCNT 8
  692. #define WHAL_DBG_CMD_RESULT_MAXCNT 11
  693. #define WHAL_DBG_CMD_STALL_ERR_MAXCNT 4
  694. #define WHAL_DBG_FLUSH_REASON_MAXCNT 40
  695. typedef enum {
  696. WIFI_URRN_STATS_FIRST_PKT,
  697. WIFI_URRN_STATS_BETWEEN_MPDU,
  698. WIFI_URRN_STATS_WITHIN_MPDU,
  699. WHAL_MAX_URRN_STATS
  700. } wifi_urrn_type_t;
  701. typedef struct wlan_dbg_txbf_snd_stats {
  702. A_UINT32 cbf_20[4];
  703. A_UINT32 cbf_40[4];
  704. A_UINT32 cbf_80[4];
  705. A_UINT32 sounding[9];
  706. A_UINT32 cbf_160[4];
  707. } wlan_dbg_txbf_snd_stats_t;
  708. typedef struct wlan_dbg_wifi2_error_stats {
  709. A_UINT32 urrn_stats[WHAL_MAX_URRN_STATS];
  710. A_UINT32 flush_errs[WHAL_DBG_FLUSH_REASON_MAXCNT];
  711. A_UINT32 schd_stall_errs[WHAL_DBG_CMD_STALL_ERR_MAXCNT];
  712. A_UINT32 schd_cmd_result[WHAL_DBG_CMD_RESULT_MAXCNT];
  713. A_UINT32 sifs_status[WHAL_DBG_SIFS_STATUS_MAXCNT];
  714. A_UINT8 phy_errs[WHAL_DBG_PHY_ERR_MAXCNT];
  715. A_UINT32 rx_rate_inval;
  716. } wlan_dbg_wifi2_error_stats_t;
  717. typedef struct wlan_dbg_wifi2_error2_stats {
  718. A_UINT32 schd_errs[WHAL_DBG_CMD_STALL_ERR_MAXCNT];
  719. A_UINT32 sifs_errs[WHAL_DBG_SIFS_ERR_MAXCNT];
  720. } wlan_dbg_wifi2_error2_stats_t;
  721. #define WLAN_DBG_STATS_SIZE_TXBF_VHT 10
  722. #define WLAN_DBG_STATS_SIZE_TXBF_HT 8
  723. #define WLAN_DBG_STATS_SIZE_TXBF_OFDM 8
  724. #define WLAN_DBG_STATS_SIZE_TXBF_CCK 7
  725. typedef struct wlan_dbg_txbf_data_stats {
  726. A_UINT32 tx_txbf_vht[WLAN_DBG_STATS_SIZE_TXBF_VHT];
  727. A_UINT32 rx_txbf_vht[WLAN_DBG_STATS_SIZE_TXBF_VHT];
  728. A_UINT32 tx_txbf_ht[WLAN_DBG_STATS_SIZE_TXBF_HT];
  729. A_UINT32 tx_txbf_ofdm[WLAN_DBG_STATS_SIZE_TXBF_OFDM];
  730. A_UINT32 tx_txbf_cck[WLAN_DBG_STATS_SIZE_TXBF_CCK];
  731. } wlan_dbg_txbf_data_stats_t;
  732. struct wlan_dbg_tx_mu_stats {
  733. A_UINT32 mu_sch_nusers_2;
  734. A_UINT32 mu_sch_nusers_3;
  735. A_UINT32 mu_mpdus_queued_usr[4];
  736. A_UINT32 mu_mpdus_tried_usr[4];
  737. A_UINT32 mu_mpdus_failed_usr[4];
  738. A_UINT32 mu_mpdus_requeued_usr[4];
  739. A_UINT32 mu_err_no_ba_usr[4];
  740. A_UINT32 mu_mpdu_underrun_usr[4];
  741. A_UINT32 mu_ampdu_underrun_usr[4];
  742. };
  743. struct wlan_dbg_tx_selfgen_stats {
  744. A_UINT32 su_ndpa;
  745. A_UINT32 su_ndp;
  746. A_UINT32 mu_ndpa;
  747. A_UINT32 mu_ndp;
  748. A_UINT32 mu_brpoll_1;
  749. A_UINT32 mu_brpoll_2;
  750. A_UINT32 mu_bar_1;
  751. A_UINT32 mu_bar_2;
  752. A_UINT32 cts_burst;
  753. A_UINT32 su_ndp_err;
  754. A_UINT32 su_ndpa_err;
  755. A_UINT32 mu_ndp_err;
  756. A_UINT32 mu_brp1_err;
  757. A_UINT32 mu_brp2_err;
  758. };
  759. typedef struct wlan_dbg_sifs_resp_stats {
  760. A_UINT32 ps_poll_trigger; /* num ps-poll trigger frames */
  761. A_UINT32 uapsd_trigger; /* num uapsd trigger frames */
  762. A_UINT32 qb_data_trigger[2]; /* num data trigger frames; idx 0: explicit and idx 1: implicit */
  763. A_UINT32 qb_bar_trigger[2]; /* num bar trigger frames; idx 0: explicit and idx 1: implicit */
  764. A_UINT32 sifs_resp_data; /* num ppdus transmitted at SIFS interval */
  765. A_UINT32 sifs_resp_err; /* num ppdus failed to meet SIFS resp timing */
  766. } wlan_dgb_sifs_resp_stats_t;
  767. /** wlan_dbg_wifi2_error_stats_t is not grouped with the
  768. * following structure as it is allocated differently and only
  769. * belongs to whal
  770. */
  771. typedef struct wlan_dbg_stats_wifi2 {
  772. wlan_dbg_txbf_snd_stats_t txbf_snd_info;
  773. wlan_dbg_txbf_data_stats_t txbf_data_info;
  774. struct wlan_dbg_tx_selfgen_stats tx_selfgen;
  775. struct wlan_dbg_tx_mu_stats tx_mu;
  776. wlan_dgb_sifs_resp_stats_t sifs_resp_info;
  777. } wlan_dbg_wifi2_stats_t;
  778. typedef struct {
  779. wlan_dbg_rx_rate_info_t rx_phy_info;
  780. wlan_dbg_tx_rate_info_t tx_rate_info;
  781. } wlan_dbg_rate_info_t;
  782. typedef struct {
  783. wlan_dbg_rx_rate_info_v2_t rx_phy_info;
  784. wlan_dbg_tx_rate_info_v2_t tx_rate_info;
  785. } wlan_dbg_rate_info_v2_t;
  786. struct wlan_dbg_stats {
  787. struct wlan_dbg_tx_stats tx;
  788. struct wlan_dbg_rx_stats rx;
  789. #if defined(AR900B)
  790. struct wlan_dbg_mem_stats mem;
  791. #endif
  792. struct wlan_dbg_peer_stats peer;
  793. };
  794. #define DBG_STATS_MAX_HWQ_NUM 10
  795. #define DBG_STATS_MAX_TID_NUM 20
  796. #define DBG_STATS_MAX_CONG_NUM 16
  797. struct wlan_dbg_txq_stats {
  798. A_UINT16 num_pkts_queued[DBG_STATS_MAX_HWQ_NUM];
  799. A_UINT16 tid_hw_qdepth[DBG_STATS_MAX_TID_NUM]; /* WAL_MAX_TID is 20 */
  800. A_UINT16 tid_sw_qdepth[DBG_STATS_MAX_TID_NUM]; /* WAL_MAX_TID is 20 */
  801. };
  802. struct wlan_dbg_tidq_stats{
  803. A_UINT32 wlan_dbg_tid_txq_status;
  804. struct wlan_dbg_txq_stats txq_st;
  805. };
  806. #endif /* __WLANDEFS_H__ */