debugfs.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524
  1. /*
  2. * This file is part of wl18xx
  3. *
  4. * Copyright (C) 2009 Nokia Corporation
  5. * Copyright (C) 2011-2012 Texas Instruments
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * version 2 as published by the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  19. * 02110-1301 USA
  20. *
  21. */
  22. #include "../wlcore/debugfs.h"
  23. #include "../wlcore/wlcore.h"
  24. #include "../wlcore/debug.h"
  25. #include "../wlcore/ps.h"
  26. #include "wl18xx.h"
  27. #include "acx.h"
  28. #include "cmd.h"
  29. #include "debugfs.h"
  30. #define WL18XX_DEBUGFS_FWSTATS_FILE(a, b, c) \
  31. DEBUGFS_FWSTATS_FILE(a, b, c, wl18xx_acx_statistics)
  32. #define WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(a, b, c) \
  33. DEBUGFS_FWSTATS_FILE_ARRAY(a, b, c, wl18xx_acx_statistics)
  34. WL18XX_DEBUGFS_FWSTATS_FILE(error, error_frame_non_ctrl, "%u");
  35. WL18XX_DEBUGFS_FWSTATS_FILE(error, error_frame_ctrl, "%u");
  36. WL18XX_DEBUGFS_FWSTATS_FILE(error, error_frame_during_protection, "%u");
  37. WL18XX_DEBUGFS_FWSTATS_FILE(error, null_frame_tx_start, "%u");
  38. WL18XX_DEBUGFS_FWSTATS_FILE(error, null_frame_cts_start, "%u");
  39. WL18XX_DEBUGFS_FWSTATS_FILE(error, bar_retry, "%u");
  40. WL18XX_DEBUGFS_FWSTATS_FILE(error, num_frame_cts_nul_flid, "%u");
  41. WL18XX_DEBUGFS_FWSTATS_FILE(error, tx_abort_failure, "%u");
  42. WL18XX_DEBUGFS_FWSTATS_FILE(error, tx_resume_failure, "%u");
  43. WL18XX_DEBUGFS_FWSTATS_FILE(error, rx_cmplt_db_overflow_cnt, "%u");
  44. WL18XX_DEBUGFS_FWSTATS_FILE(error, elp_while_rx_exch, "%u");
  45. WL18XX_DEBUGFS_FWSTATS_FILE(error, elp_while_tx_exch, "%u");
  46. WL18XX_DEBUGFS_FWSTATS_FILE(error, elp_while_tx, "%u");
  47. WL18XX_DEBUGFS_FWSTATS_FILE(error, elp_while_nvic_pending, "%u");
  48. WL18XX_DEBUGFS_FWSTATS_FILE(error, rx_excessive_frame_len, "%u");
  49. WL18XX_DEBUGFS_FWSTATS_FILE(error, burst_mismatch, "%u");
  50. WL18XX_DEBUGFS_FWSTATS_FILE(error, tbc_exch_mismatch, "%u");
  51. WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_prepared_descs, "%u");
  52. WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_cmplt, "%u");
  53. WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_template_prepared, "%u");
  54. WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_data_prepared, "%u");
  55. WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_template_programmed, "%u");
  56. WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_data_programmed, "%u");
  57. WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_burst_programmed, "%u");
  58. WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_starts, "%u");
  59. WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_stop, "%u");
  60. WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_templates, "%u");
  61. WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_int_templates, "%u");
  62. WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_fw_gen, "%u");
  63. WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_data, "%u");
  64. WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_start_null_frame, "%u");
  65. WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_exch, "%u");
  66. WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_retry_template, "%u");
  67. WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_retry_data, "%u");
  68. WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(tx, tx_retry_per_rate,
  69. NUM_OF_RATES_INDEXES);
  70. WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_exch_pending, "%u");
  71. WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_exch_expiry, "%u");
  72. WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_done_template, "%u");
  73. WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_done_data, "%u");
  74. WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_done_int_template, "%u");
  75. WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_cfe1, "%u");
  76. WL18XX_DEBUGFS_FWSTATS_FILE(tx, tx_cfe2, "%u");
  77. WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_called, "%u");
  78. WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_mpdu_alloc_failed, "%u");
  79. WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_init_called, "%u");
  80. WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_in_process_called, "%u");
  81. WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_tkip_called, "%u");
  82. WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_key_not_found, "%u");
  83. WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_need_fragmentation, "%u");
  84. WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_bad_mblk_num, "%u");
  85. WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_failed, "%u");
  86. WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_cache_hit, "%u");
  87. WL18XX_DEBUGFS_FWSTATS_FILE(tx, frag_cache_miss, "%u");
  88. WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_beacon_early_term, "%u");
  89. WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_out_of_mpdu_nodes, "%u");
  90. WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_hdr_overflow, "%u");
  91. WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_dropped_frame, "%u");
  92. WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_done, "%u");
  93. WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_defrag, "%u");
  94. WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_defrag_end, "%u");
  95. WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_cmplt, "%u");
  96. WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_pre_complt, "%u");
  97. WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_cmplt_task, "%u");
  98. WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_phy_hdr, "%u");
  99. WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_timeout, "%u");
  100. WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_rts_timeout, "%u");
  101. WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_timeout_wa, "%u");
  102. WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_called, "%u");
  103. WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_init_called, "%u");
  104. WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_in_process_called, "%u");
  105. WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_tkip_called, "%u");
  106. WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_need_defrag, "%u");
  107. WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_decrypt_failed, "%u");
  108. WL18XX_DEBUGFS_FWSTATS_FILE(rx, decrypt_key_not_found, "%u");
  109. WL18XX_DEBUGFS_FWSTATS_FILE(rx, defrag_need_decrypt, "%u");
  110. WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_tkip_replays, "%u");
  111. WL18XX_DEBUGFS_FWSTATS_FILE(rx, rx_xfr, "%u");
  112. WL18XX_DEBUGFS_FWSTATS_FILE(isr, irqs, "%u");
  113. WL18XX_DEBUGFS_FWSTATS_FILE(pwr, missing_bcns_cnt, "%u");
  114. WL18XX_DEBUGFS_FWSTATS_FILE(pwr, rcvd_bcns_cnt, "%u");
  115. WL18XX_DEBUGFS_FWSTATS_FILE(pwr, connection_out_of_sync, "%u");
  116. WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(pwr, cont_miss_bcns_spread,
  117. PWR_STAT_MAX_CONT_MISSED_BCNS_SPREAD);
  118. WL18XX_DEBUGFS_FWSTATS_FILE(pwr, rcvd_awake_bcns_cnt, "%u");
  119. WL18XX_DEBUGFS_FWSTATS_FILE(pwr, sleep_time_count, "%u");
  120. WL18XX_DEBUGFS_FWSTATS_FILE(pwr, sleep_time_avg, "%u");
  121. WL18XX_DEBUGFS_FWSTATS_FILE(pwr, sleep_cycle_avg, "%u");
  122. WL18XX_DEBUGFS_FWSTATS_FILE(pwr, sleep_percent, "%u");
  123. WL18XX_DEBUGFS_FWSTATS_FILE(pwr, ap_sleep_active_conf, "%u");
  124. WL18XX_DEBUGFS_FWSTATS_FILE(pwr, ap_sleep_user_conf, "%u");
  125. WL18XX_DEBUGFS_FWSTATS_FILE(pwr, ap_sleep_counter, "%u");
  126. WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, beacon_filter, "%u");
  127. WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, arp_filter, "%u");
  128. WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, mc_filter, "%u");
  129. WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, dup_filter, "%u");
  130. WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, data_filter, "%u");
  131. WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, ibss_filter, "%u");
  132. WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, protection_filter, "%u");
  133. WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, accum_arp_pend_requests, "%u");
  134. WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, max_arp_queue_dep, "%u");
  135. WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(rx_rate, rx_frames_per_rates, 50);
  136. WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(aggr_size, tx_agg_rate,
  137. AGGR_STATS_TX_AGG);
  138. WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(aggr_size, tx_agg_len,
  139. AGGR_STATS_TX_AGG);
  140. WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(aggr_size, rx_size,
  141. AGGR_STATS_RX_SIZE_LEN);
  142. WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, hs_tx_stat_fifo_int, "%u");
  143. WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, enc_tx_stat_fifo_int, "%u");
  144. WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, enc_rx_stat_fifo_int, "%u");
  145. WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, rx_complete_stat_fifo_int, "%u");
  146. WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, pre_proc_swi, "%u");
  147. WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, post_proc_swi, "%u");
  148. WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, sec_frag_swi, "%u");
  149. WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, pre_to_defrag_swi, "%u");
  150. WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, defrag_to_rx_xfer_swi, "%u");
  151. WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, dec_packet_in, "%u");
  152. WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, dec_packet_in_fifo_full, "%u");
  153. WL18XX_DEBUGFS_FWSTATS_FILE(pipeline, dec_packet_out, "%u");
  154. WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(pipeline, pipeline_fifo_full,
  155. PIPE_STATS_HW_FIFO);
  156. WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(diversity, num_of_packets_per_ant,
  157. DIVERSITY_STATS_NUM_OF_ANT);
  158. WL18XX_DEBUGFS_FWSTATS_FILE(diversity, total_num_of_toggles, "%u");
  159. WL18XX_DEBUGFS_FWSTATS_FILE(thermal, irq_thr_low, "%u");
  160. WL18XX_DEBUGFS_FWSTATS_FILE(thermal, irq_thr_high, "%u");
  161. WL18XX_DEBUGFS_FWSTATS_FILE(thermal, tx_stop, "%u");
  162. WL18XX_DEBUGFS_FWSTATS_FILE(thermal, tx_resume, "%u");
  163. WL18XX_DEBUGFS_FWSTATS_FILE(thermal, false_irq, "%u");
  164. WL18XX_DEBUGFS_FWSTATS_FILE(thermal, adc_source_unexpected, "%u");
  165. WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(calib, fail_count,
  166. WL18XX_NUM_OF_CALIBRATIONS_ERRORS);
  167. WL18XX_DEBUGFS_FWSTATS_FILE(calib, calib_count, "%u");
  168. WL18XX_DEBUGFS_FWSTATS_FILE(roaming, rssi_level, "%d");
  169. WL18XX_DEBUGFS_FWSTATS_FILE(dfs, num_of_radar_detections, "%d");
  170. static ssize_t conf_read(struct file *file, char __user *user_buf,
  171. size_t count, loff_t *ppos)
  172. {
  173. struct wl1271 *wl = file->private_data;
  174. struct wl18xx_priv *priv = wl->priv;
  175. struct wlcore_conf_header header;
  176. char *buf, *pos;
  177. size_t len;
  178. int ret;
  179. len = WL18XX_CONF_SIZE;
  180. buf = kmalloc(len, GFP_KERNEL);
  181. if (!buf)
  182. return -ENOMEM;
  183. header.magic = cpu_to_le32(WL18XX_CONF_MAGIC);
  184. header.version = cpu_to_le32(WL18XX_CONF_VERSION);
  185. header.checksum = 0;
  186. mutex_lock(&wl->mutex);
  187. pos = buf;
  188. memcpy(pos, &header, sizeof(header));
  189. pos += sizeof(header);
  190. memcpy(pos, &wl->conf, sizeof(wl->conf));
  191. pos += sizeof(wl->conf);
  192. memcpy(pos, &priv->conf, sizeof(priv->conf));
  193. mutex_unlock(&wl->mutex);
  194. ret = simple_read_from_buffer(user_buf, count, ppos, buf, len);
  195. kfree(buf);
  196. return ret;
  197. }
  198. static const struct file_operations conf_ops = {
  199. .read = conf_read,
  200. .open = simple_open,
  201. .llseek = default_llseek,
  202. };
  203. static ssize_t clear_fw_stats_write(struct file *file,
  204. const char __user *user_buf,
  205. size_t count, loff_t *ppos)
  206. {
  207. struct wl1271 *wl = file->private_data;
  208. int ret;
  209. mutex_lock(&wl->mutex);
  210. if (unlikely(wl->state != WLCORE_STATE_ON))
  211. goto out;
  212. ret = wl18xx_acx_clear_statistics(wl);
  213. if (ret < 0) {
  214. count = ret;
  215. goto out;
  216. }
  217. out:
  218. mutex_unlock(&wl->mutex);
  219. return count;
  220. }
  221. static const struct file_operations clear_fw_stats_ops = {
  222. .write = clear_fw_stats_write,
  223. .open = simple_open,
  224. .llseek = default_llseek,
  225. };
  226. static ssize_t radar_detection_write(struct file *file,
  227. const char __user *user_buf,
  228. size_t count, loff_t *ppos)
  229. {
  230. struct wl1271 *wl = file->private_data;
  231. int ret;
  232. u8 channel;
  233. ret = kstrtou8_from_user(user_buf, count, 10, &channel);
  234. if (ret < 0) {
  235. wl1271_warning("illegal channel");
  236. return -EINVAL;
  237. }
  238. mutex_lock(&wl->mutex);
  239. if (unlikely(wl->state != WLCORE_STATE_ON))
  240. goto out;
  241. ret = wl1271_ps_elp_wakeup(wl);
  242. if (ret < 0)
  243. goto out;
  244. ret = wl18xx_cmd_radar_detection_debug(wl, channel);
  245. if (ret < 0)
  246. count = ret;
  247. wl1271_ps_elp_sleep(wl);
  248. out:
  249. mutex_unlock(&wl->mutex);
  250. return count;
  251. }
  252. static const struct file_operations radar_detection_ops = {
  253. .write = radar_detection_write,
  254. .open = simple_open,
  255. .llseek = default_llseek,
  256. };
  257. static ssize_t dynamic_fw_traces_write(struct file *file,
  258. const char __user *user_buf,
  259. size_t count, loff_t *ppos)
  260. {
  261. struct wl1271 *wl = file->private_data;
  262. unsigned long value;
  263. int ret;
  264. ret = kstrtoul_from_user(user_buf, count, 0, &value);
  265. if (ret < 0)
  266. return ret;
  267. mutex_lock(&wl->mutex);
  268. wl->dynamic_fw_traces = value;
  269. if (unlikely(wl->state != WLCORE_STATE_ON))
  270. goto out;
  271. ret = wl1271_ps_elp_wakeup(wl);
  272. if (ret < 0)
  273. goto out;
  274. ret = wl18xx_acx_dynamic_fw_traces(wl);
  275. if (ret < 0)
  276. count = ret;
  277. wl1271_ps_elp_sleep(wl);
  278. out:
  279. mutex_unlock(&wl->mutex);
  280. return count;
  281. }
  282. static ssize_t dynamic_fw_traces_read(struct file *file,
  283. char __user *userbuf,
  284. size_t count, loff_t *ppos)
  285. {
  286. struct wl1271 *wl = file->private_data;
  287. return wl1271_format_buffer(userbuf, count, ppos,
  288. "%d\n", wl->dynamic_fw_traces);
  289. }
  290. static const struct file_operations dynamic_fw_traces_ops = {
  291. .read = dynamic_fw_traces_read,
  292. .write = dynamic_fw_traces_write,
  293. .open = simple_open,
  294. .llseek = default_llseek,
  295. };
  296. int wl18xx_debugfs_add_files(struct wl1271 *wl,
  297. struct dentry *rootdir)
  298. {
  299. int ret = 0;
  300. struct dentry *entry, *stats, *moddir;
  301. moddir = debugfs_create_dir(KBUILD_MODNAME, rootdir);
  302. if (!moddir || IS_ERR(moddir)) {
  303. entry = moddir;
  304. goto err;
  305. }
  306. stats = debugfs_create_dir("fw_stats", moddir);
  307. if (!stats || IS_ERR(stats)) {
  308. entry = stats;
  309. goto err;
  310. }
  311. DEBUGFS_ADD(clear_fw_stats, stats);
  312. DEBUGFS_FWSTATS_ADD(error, error_frame_non_ctrl);
  313. DEBUGFS_FWSTATS_ADD(error, error_frame_ctrl);
  314. DEBUGFS_FWSTATS_ADD(error, error_frame_during_protection);
  315. DEBUGFS_FWSTATS_ADD(error, null_frame_tx_start);
  316. DEBUGFS_FWSTATS_ADD(error, null_frame_cts_start);
  317. DEBUGFS_FWSTATS_ADD(error, bar_retry);
  318. DEBUGFS_FWSTATS_ADD(error, num_frame_cts_nul_flid);
  319. DEBUGFS_FWSTATS_ADD(error, tx_abort_failure);
  320. DEBUGFS_FWSTATS_ADD(error, tx_resume_failure);
  321. DEBUGFS_FWSTATS_ADD(error, rx_cmplt_db_overflow_cnt);
  322. DEBUGFS_FWSTATS_ADD(error, elp_while_rx_exch);
  323. DEBUGFS_FWSTATS_ADD(error, elp_while_tx_exch);
  324. DEBUGFS_FWSTATS_ADD(error, elp_while_tx);
  325. DEBUGFS_FWSTATS_ADD(error, elp_while_nvic_pending);
  326. DEBUGFS_FWSTATS_ADD(error, rx_excessive_frame_len);
  327. DEBUGFS_FWSTATS_ADD(error, burst_mismatch);
  328. DEBUGFS_FWSTATS_ADD(error, tbc_exch_mismatch);
  329. DEBUGFS_FWSTATS_ADD(tx, tx_prepared_descs);
  330. DEBUGFS_FWSTATS_ADD(tx, tx_cmplt);
  331. DEBUGFS_FWSTATS_ADD(tx, tx_template_prepared);
  332. DEBUGFS_FWSTATS_ADD(tx, tx_data_prepared);
  333. DEBUGFS_FWSTATS_ADD(tx, tx_template_programmed);
  334. DEBUGFS_FWSTATS_ADD(tx, tx_data_programmed);
  335. DEBUGFS_FWSTATS_ADD(tx, tx_burst_programmed);
  336. DEBUGFS_FWSTATS_ADD(tx, tx_starts);
  337. DEBUGFS_FWSTATS_ADD(tx, tx_stop);
  338. DEBUGFS_FWSTATS_ADD(tx, tx_start_templates);
  339. DEBUGFS_FWSTATS_ADD(tx, tx_start_int_templates);
  340. DEBUGFS_FWSTATS_ADD(tx, tx_start_fw_gen);
  341. DEBUGFS_FWSTATS_ADD(tx, tx_start_data);
  342. DEBUGFS_FWSTATS_ADD(tx, tx_start_null_frame);
  343. DEBUGFS_FWSTATS_ADD(tx, tx_exch);
  344. DEBUGFS_FWSTATS_ADD(tx, tx_retry_template);
  345. DEBUGFS_FWSTATS_ADD(tx, tx_retry_data);
  346. DEBUGFS_FWSTATS_ADD(tx, tx_retry_per_rate);
  347. DEBUGFS_FWSTATS_ADD(tx, tx_exch_pending);
  348. DEBUGFS_FWSTATS_ADD(tx, tx_exch_expiry);
  349. DEBUGFS_FWSTATS_ADD(tx, tx_done_template);
  350. DEBUGFS_FWSTATS_ADD(tx, tx_done_data);
  351. DEBUGFS_FWSTATS_ADD(tx, tx_done_int_template);
  352. DEBUGFS_FWSTATS_ADD(tx, tx_cfe1);
  353. DEBUGFS_FWSTATS_ADD(tx, tx_cfe2);
  354. DEBUGFS_FWSTATS_ADD(tx, frag_called);
  355. DEBUGFS_FWSTATS_ADD(tx, frag_mpdu_alloc_failed);
  356. DEBUGFS_FWSTATS_ADD(tx, frag_init_called);
  357. DEBUGFS_FWSTATS_ADD(tx, frag_in_process_called);
  358. DEBUGFS_FWSTATS_ADD(tx, frag_tkip_called);
  359. DEBUGFS_FWSTATS_ADD(tx, frag_key_not_found);
  360. DEBUGFS_FWSTATS_ADD(tx, frag_need_fragmentation);
  361. DEBUGFS_FWSTATS_ADD(tx, frag_bad_mblk_num);
  362. DEBUGFS_FWSTATS_ADD(tx, frag_failed);
  363. DEBUGFS_FWSTATS_ADD(tx, frag_cache_hit);
  364. DEBUGFS_FWSTATS_ADD(tx, frag_cache_miss);
  365. DEBUGFS_FWSTATS_ADD(rx, rx_beacon_early_term);
  366. DEBUGFS_FWSTATS_ADD(rx, rx_out_of_mpdu_nodes);
  367. DEBUGFS_FWSTATS_ADD(rx, rx_hdr_overflow);
  368. DEBUGFS_FWSTATS_ADD(rx, rx_dropped_frame);
  369. DEBUGFS_FWSTATS_ADD(rx, rx_done);
  370. DEBUGFS_FWSTATS_ADD(rx, rx_defrag);
  371. DEBUGFS_FWSTATS_ADD(rx, rx_defrag_end);
  372. DEBUGFS_FWSTATS_ADD(rx, rx_cmplt);
  373. DEBUGFS_FWSTATS_ADD(rx, rx_pre_complt);
  374. DEBUGFS_FWSTATS_ADD(rx, rx_cmplt_task);
  375. DEBUGFS_FWSTATS_ADD(rx, rx_phy_hdr);
  376. DEBUGFS_FWSTATS_ADD(rx, rx_timeout);
  377. DEBUGFS_FWSTATS_ADD(rx, rx_rts_timeout);
  378. DEBUGFS_FWSTATS_ADD(rx, rx_timeout_wa);
  379. DEBUGFS_FWSTATS_ADD(rx, defrag_called);
  380. DEBUGFS_FWSTATS_ADD(rx, defrag_init_called);
  381. DEBUGFS_FWSTATS_ADD(rx, defrag_in_process_called);
  382. DEBUGFS_FWSTATS_ADD(rx, defrag_tkip_called);
  383. DEBUGFS_FWSTATS_ADD(rx, defrag_need_defrag);
  384. DEBUGFS_FWSTATS_ADD(rx, defrag_decrypt_failed);
  385. DEBUGFS_FWSTATS_ADD(rx, decrypt_key_not_found);
  386. DEBUGFS_FWSTATS_ADD(rx, defrag_need_decrypt);
  387. DEBUGFS_FWSTATS_ADD(rx, rx_tkip_replays);
  388. DEBUGFS_FWSTATS_ADD(rx, rx_xfr);
  389. DEBUGFS_FWSTATS_ADD(isr, irqs);
  390. DEBUGFS_FWSTATS_ADD(pwr, missing_bcns_cnt);
  391. DEBUGFS_FWSTATS_ADD(pwr, rcvd_bcns_cnt);
  392. DEBUGFS_FWSTATS_ADD(pwr, connection_out_of_sync);
  393. DEBUGFS_FWSTATS_ADD(pwr, cont_miss_bcns_spread);
  394. DEBUGFS_FWSTATS_ADD(pwr, rcvd_awake_bcns_cnt);
  395. DEBUGFS_FWSTATS_ADD(pwr, sleep_time_count);
  396. DEBUGFS_FWSTATS_ADD(pwr, sleep_time_avg);
  397. DEBUGFS_FWSTATS_ADD(pwr, sleep_cycle_avg);
  398. DEBUGFS_FWSTATS_ADD(pwr, sleep_percent);
  399. DEBUGFS_FWSTATS_ADD(pwr, ap_sleep_active_conf);
  400. DEBUGFS_FWSTATS_ADD(pwr, ap_sleep_user_conf);
  401. DEBUGFS_FWSTATS_ADD(pwr, ap_sleep_counter);
  402. DEBUGFS_FWSTATS_ADD(rx_filter, beacon_filter);
  403. DEBUGFS_FWSTATS_ADD(rx_filter, arp_filter);
  404. DEBUGFS_FWSTATS_ADD(rx_filter, mc_filter);
  405. DEBUGFS_FWSTATS_ADD(rx_filter, dup_filter);
  406. DEBUGFS_FWSTATS_ADD(rx_filter, data_filter);
  407. DEBUGFS_FWSTATS_ADD(rx_filter, ibss_filter);
  408. DEBUGFS_FWSTATS_ADD(rx_filter, protection_filter);
  409. DEBUGFS_FWSTATS_ADD(rx_filter, accum_arp_pend_requests);
  410. DEBUGFS_FWSTATS_ADD(rx_filter, max_arp_queue_dep);
  411. DEBUGFS_FWSTATS_ADD(rx_rate, rx_frames_per_rates);
  412. DEBUGFS_FWSTATS_ADD(aggr_size, tx_agg_rate);
  413. DEBUGFS_FWSTATS_ADD(aggr_size, tx_agg_len);
  414. DEBUGFS_FWSTATS_ADD(aggr_size, rx_size);
  415. DEBUGFS_FWSTATS_ADD(pipeline, hs_tx_stat_fifo_int);
  416. DEBUGFS_FWSTATS_ADD(pipeline, enc_tx_stat_fifo_int);
  417. DEBUGFS_FWSTATS_ADD(pipeline, enc_rx_stat_fifo_int);
  418. DEBUGFS_FWSTATS_ADD(pipeline, rx_complete_stat_fifo_int);
  419. DEBUGFS_FWSTATS_ADD(pipeline, pre_proc_swi);
  420. DEBUGFS_FWSTATS_ADD(pipeline, post_proc_swi);
  421. DEBUGFS_FWSTATS_ADD(pipeline, sec_frag_swi);
  422. DEBUGFS_FWSTATS_ADD(pipeline, pre_to_defrag_swi);
  423. DEBUGFS_FWSTATS_ADD(pipeline, defrag_to_rx_xfer_swi);
  424. DEBUGFS_FWSTATS_ADD(pipeline, dec_packet_in);
  425. DEBUGFS_FWSTATS_ADD(pipeline, dec_packet_in_fifo_full);
  426. DEBUGFS_FWSTATS_ADD(pipeline, dec_packet_out);
  427. DEBUGFS_FWSTATS_ADD(pipeline, pipeline_fifo_full);
  428. DEBUGFS_FWSTATS_ADD(diversity, num_of_packets_per_ant);
  429. DEBUGFS_FWSTATS_ADD(diversity, total_num_of_toggles);
  430. DEBUGFS_FWSTATS_ADD(thermal, irq_thr_low);
  431. DEBUGFS_FWSTATS_ADD(thermal, irq_thr_high);
  432. DEBUGFS_FWSTATS_ADD(thermal, tx_stop);
  433. DEBUGFS_FWSTATS_ADD(thermal, tx_resume);
  434. DEBUGFS_FWSTATS_ADD(thermal, false_irq);
  435. DEBUGFS_FWSTATS_ADD(thermal, adc_source_unexpected);
  436. DEBUGFS_FWSTATS_ADD(calib, fail_count);
  437. DEBUGFS_FWSTATS_ADD(calib, calib_count);
  438. DEBUGFS_FWSTATS_ADD(roaming, rssi_level);
  439. DEBUGFS_FWSTATS_ADD(dfs, num_of_radar_detections);
  440. DEBUGFS_ADD(conf, moddir);
  441. DEBUGFS_ADD(radar_detection, moddir);
  442. DEBUGFS_ADD(dynamic_fw_traces, moddir);
  443. return 0;
  444. err:
  445. if (IS_ERR(entry))
  446. ret = PTR_ERR(entry);
  447. else
  448. ret = -ENOMEM;
  449. return ret;
  450. }