wlan_defs.h 24 KB

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