acx.h 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. /*
  2. * This file is part of wl18xx
  3. *
  4. * Copyright (C) 2011 Texas Instruments. All rights reserved.
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * version 2 as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  18. * 02110-1301 USA
  19. *
  20. */
  21. #ifndef __WL18XX_ACX_H__
  22. #define __WL18XX_ACX_H__
  23. #include "../wlcore/wlcore.h"
  24. #include "../wlcore/acx.h"
  25. enum {
  26. ACX_NS_IPV6_FILTER = 0x0050,
  27. ACX_PEER_HT_OPERATION_MODE_CFG = 0x0051,
  28. ACX_CSUM_CONFIG = 0x0052,
  29. ACX_SIM_CONFIG = 0x0053,
  30. ACX_CLEAR_STATISTICS = 0x0054,
  31. ACX_AUTO_RX_STREAMING = 0x0055,
  32. ACX_PEER_CAP = 0x0056
  33. };
  34. /* numbers of bits the length field takes (add 1 for the actual number) */
  35. #define WL18XX_HOST_IF_LEN_SIZE_FIELD 15
  36. #define WL18XX_ACX_EVENTS_VECTOR (WL1271_ACX_INTR_WATCHDOG | \
  37. WL1271_ACX_INTR_INIT_COMPLETE | \
  38. WL1271_ACX_INTR_EVENT_A | \
  39. WL1271_ACX_INTR_EVENT_B | \
  40. WL1271_ACX_INTR_CMD_COMPLETE | \
  41. WL1271_ACX_INTR_HW_AVAILABLE | \
  42. WL1271_ACX_INTR_DATA | \
  43. WL1271_ACX_SW_INTR_WATCHDOG)
  44. #define WL18XX_INTR_MASK (WL1271_ACX_INTR_WATCHDOG | \
  45. WL1271_ACX_INTR_EVENT_A | \
  46. WL1271_ACX_INTR_EVENT_B | \
  47. WL1271_ACX_INTR_HW_AVAILABLE | \
  48. WL1271_ACX_INTR_DATA | \
  49. WL1271_ACX_SW_INTR_WATCHDOG)
  50. struct wl18xx_acx_host_config_bitmap {
  51. struct acx_header header;
  52. __le32 host_cfg_bitmap;
  53. __le32 host_sdio_block_size;
  54. /* extra mem blocks per frame in TX. */
  55. __le32 extra_mem_blocks;
  56. /*
  57. * number of bits of the length field in the first TX word
  58. * (up to 15 - for using the entire 16 bits).
  59. */
  60. __le32 length_field_size;
  61. } __packed;
  62. enum {
  63. CHECKSUM_OFFLOAD_DISABLED = 0,
  64. CHECKSUM_OFFLOAD_ENABLED = 1,
  65. CHECKSUM_OFFLOAD_FAKE_RX = 2,
  66. CHECKSUM_OFFLOAD_INVALID = 0xFF
  67. };
  68. struct wl18xx_acx_checksum_state {
  69. struct acx_header header;
  70. /* enum acx_checksum_state */
  71. u8 checksum_state;
  72. u8 pad[3];
  73. } __packed;
  74. struct wl18xx_acx_error_stats {
  75. u32 error_frame;
  76. u32 error_null_Frame_tx_start;
  77. u32 error_numll_frame_cts_start;
  78. u32 error_bar_retry;
  79. u32 error_frame_cts_nul_flid;
  80. } __packed;
  81. struct wl18xx_acx_debug_stats {
  82. u32 debug1;
  83. u32 debug2;
  84. u32 debug3;
  85. u32 debug4;
  86. u32 debug5;
  87. u32 debug6;
  88. } __packed;
  89. struct wl18xx_acx_ring_stats {
  90. u32 prepared_descs;
  91. u32 tx_cmplt;
  92. } __packed;
  93. struct wl18xx_acx_tx_stats {
  94. u32 tx_prepared_descs;
  95. u32 tx_cmplt;
  96. u32 tx_template_prepared;
  97. u32 tx_data_prepared;
  98. u32 tx_template_programmed;
  99. u32 tx_data_programmed;
  100. u32 tx_burst_programmed;
  101. u32 tx_starts;
  102. u32 tx_imm_resp;
  103. u32 tx_start_templates;
  104. u32 tx_start_int_templates;
  105. u32 tx_start_fw_gen;
  106. u32 tx_start_data;
  107. u32 tx_start_null_frame;
  108. u32 tx_exch;
  109. u32 tx_retry_template;
  110. u32 tx_retry_data;
  111. u32 tx_exch_pending;
  112. u32 tx_exch_expiry;
  113. u32 tx_done_template;
  114. u32 tx_done_data;
  115. u32 tx_done_int_template;
  116. u32 tx_frame_checksum;
  117. u32 tx_checksum_result;
  118. u32 frag_called;
  119. u32 frag_mpdu_alloc_failed;
  120. u32 frag_init_called;
  121. u32 frag_in_process_called;
  122. u32 frag_tkip_called;
  123. u32 frag_key_not_found;
  124. u32 frag_need_fragmentation;
  125. u32 frag_bad_mblk_num;
  126. u32 frag_failed;
  127. u32 frag_cache_hit;
  128. u32 frag_cache_miss;
  129. } __packed;
  130. struct wl18xx_acx_rx_stats {
  131. u32 rx_beacon_early_term;
  132. u32 rx_out_of_mpdu_nodes;
  133. u32 rx_hdr_overflow;
  134. u32 rx_dropped_frame;
  135. u32 rx_done_stage;
  136. u32 rx_done;
  137. u32 rx_defrag;
  138. u32 rx_defrag_end;
  139. u32 rx_cmplt;
  140. u32 rx_pre_complt;
  141. u32 rx_cmplt_task;
  142. u32 rx_phy_hdr;
  143. u32 rx_timeout;
  144. u32 rx_timeout_wa;
  145. u32 rx_wa_density_dropped_frame;
  146. u32 rx_wa_ba_not_expected;
  147. u32 rx_frame_checksum;
  148. u32 rx_checksum_result;
  149. u32 defrag_called;
  150. u32 defrag_init_called;
  151. u32 defrag_in_process_called;
  152. u32 defrag_tkip_called;
  153. u32 defrag_need_defrag;
  154. u32 defrag_decrypt_failed;
  155. u32 decrypt_key_not_found;
  156. u32 defrag_need_decrypt;
  157. u32 rx_tkip_replays;
  158. } __packed;
  159. struct wl18xx_acx_isr_stats {
  160. u32 irqs;
  161. } __packed;
  162. #define PWR_STAT_MAX_CONT_MISSED_BCNS_SPREAD 10
  163. struct wl18xx_acx_pwr_stats {
  164. u32 missing_bcns_cnt;
  165. u32 rcvd_bcns_cnt;
  166. u32 connection_out_of_sync;
  167. u32 cont_miss_bcns_spread[PWR_STAT_MAX_CONT_MISSED_BCNS_SPREAD];
  168. u32 rcvd_awake_bcns_cnt;
  169. } __packed;
  170. struct wl18xx_acx_event_stats {
  171. u32 calibration;
  172. u32 rx_mismatch;
  173. u32 rx_mem_empty;
  174. } __packed;
  175. struct wl18xx_acx_ps_poll_stats {
  176. u32 ps_poll_timeouts;
  177. u32 upsd_timeouts;
  178. u32 upsd_max_ap_turn;
  179. u32 ps_poll_max_ap_turn;
  180. u32 ps_poll_utilization;
  181. u32 upsd_utilization;
  182. } __packed;
  183. struct wl18xx_acx_rx_filter_stats {
  184. u32 beacon_filter;
  185. u32 arp_filter;
  186. u32 mc_filter;
  187. u32 dup_filter;
  188. u32 data_filter;
  189. u32 ibss_filter;
  190. u32 protection_filter;
  191. u32 accum_arp_pend_requests;
  192. u32 max_arp_queue_dep;
  193. } __packed;
  194. struct wl18xx_acx_rx_rate_stats {
  195. u32 rx_frames_per_rates[50];
  196. } __packed;
  197. #define AGGR_STATS_TX_AGG 16
  198. #define AGGR_STATS_TX_RATE 16
  199. #define AGGR_STATS_RX_SIZE_LEN 16
  200. struct wl18xx_acx_aggr_stats {
  201. u32 tx_agg_vs_rate[AGGR_STATS_TX_AGG * AGGR_STATS_TX_RATE];
  202. u32 rx_size[AGGR_STATS_RX_SIZE_LEN];
  203. } __packed;
  204. #define PIPE_STATS_HW_FIFO 11
  205. struct wl18xx_acx_pipeline_stats {
  206. u32 hs_tx_stat_fifo_int;
  207. u32 hs_rx_stat_fifo_int;
  208. u32 tcp_tx_stat_fifo_int;
  209. u32 tcp_rx_stat_fifo_int;
  210. u32 enc_tx_stat_fifo_int;
  211. u32 enc_rx_stat_fifo_int;
  212. u32 rx_complete_stat_fifo_int;
  213. u32 pre_proc_swi;
  214. u32 post_proc_swi;
  215. u32 sec_frag_swi;
  216. u32 pre_to_defrag_swi;
  217. u32 defrag_to_csum_swi;
  218. u32 csum_to_rx_xfer_swi;
  219. u32 dec_packet_in;
  220. u32 dec_packet_in_fifo_full;
  221. u32 dec_packet_out;
  222. u32 cs_rx_packet_in;
  223. u32 cs_rx_packet_out;
  224. u16 pipeline_fifo_full[PIPE_STATS_HW_FIFO];
  225. } __packed;
  226. struct wl18xx_acx_mem_stats {
  227. u32 rx_free_mem_blks;
  228. u32 tx_free_mem_blks;
  229. u32 fwlog_free_mem_blks;
  230. u32 fw_gen_free_mem_blks;
  231. } __packed;
  232. struct wl18xx_acx_statistics {
  233. struct acx_header header;
  234. struct wl18xx_acx_error_stats error;
  235. struct wl18xx_acx_debug_stats debug;
  236. struct wl18xx_acx_tx_stats tx;
  237. struct wl18xx_acx_rx_stats rx;
  238. struct wl18xx_acx_isr_stats isr;
  239. struct wl18xx_acx_pwr_stats pwr;
  240. struct wl18xx_acx_ps_poll_stats ps_poll;
  241. struct wl18xx_acx_rx_filter_stats rx_filter;
  242. struct wl18xx_acx_rx_rate_stats rx_rate;
  243. struct wl18xx_acx_aggr_stats aggr_size;
  244. struct wl18xx_acx_pipeline_stats pipeline;
  245. struct wl18xx_acx_mem_stats mem;
  246. } __packed;
  247. struct wl18xx_acx_clear_statistics {
  248. struct acx_header header;
  249. };
  250. enum wlcore_bandwidth {
  251. WLCORE_BANDWIDTH_20MHZ,
  252. WLCORE_BANDWIDTH_40MHZ,
  253. };
  254. struct wlcore_peer_ht_operation_mode {
  255. struct acx_header header;
  256. u8 hlid;
  257. u8 bandwidth; /* enum wlcore_bandwidth */
  258. u8 padding[2];
  259. };
  260. /*
  261. * ACX_PEER_CAP
  262. * this struct is very similar to wl1271_acx_ht_capabilities, with the
  263. * addition of supported rates
  264. */
  265. struct wlcore_acx_peer_cap {
  266. struct acx_header header;
  267. /* bitmask of capability bits supported by the peer */
  268. __le32 ht_capabilites;
  269. /* rates supported by the remote peer */
  270. __le32 supported_rates;
  271. /* Indicates to which link these capabilities apply. */
  272. u8 hlid;
  273. /*
  274. * This the maximum A-MPDU length supported by the AP. The FW may not
  275. * exceed this length when sending A-MPDUs
  276. */
  277. u8 ampdu_max_length;
  278. /* This is the minimal spacing required when sending A-MPDUs to the AP*/
  279. u8 ampdu_min_spacing;
  280. u8 padding;
  281. } __packed;
  282. int wl18xx_acx_host_if_cfg_bitmap(struct wl1271 *wl, u32 host_cfg_bitmap,
  283. u32 sdio_blk_size, u32 extra_mem_blks,
  284. u32 len_field_size);
  285. int wl18xx_acx_set_checksum_state(struct wl1271 *wl);
  286. int wl18xx_acx_clear_statistics(struct wl1271 *wl);
  287. int wl18xx_acx_peer_ht_operation_mode(struct wl1271 *wl, u8 hlid, bool wide);
  288. int wl18xx_acx_set_peer_cap(struct wl1271 *wl,
  289. struct ieee80211_sta_ht_cap *ht_cap,
  290. bool allow_ht_operation,
  291. u32 rate_set, u8 hlid);
  292. #endif /* __WL18XX_ACX_H__ */