debugfs.c 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. /*
  2. * This file is part of wl12xx
  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 "wl12xx.h"
  25. #include "acx.h"
  26. #include "debugfs.h"
  27. #define WL12XX_DEBUGFS_FWSTATS_FILE(a, b, c) \
  28. DEBUGFS_FWSTATS_FILE(a, b, c, wl12xx_acx_statistics)
  29. WL12XX_DEBUGFS_FWSTATS_FILE(tx, internal_desc_overflow, "%u");
  30. WL12XX_DEBUGFS_FWSTATS_FILE(rx, out_of_mem, "%u");
  31. WL12XX_DEBUGFS_FWSTATS_FILE(rx, hdr_overflow, "%u");
  32. WL12XX_DEBUGFS_FWSTATS_FILE(rx, hw_stuck, "%u");
  33. WL12XX_DEBUGFS_FWSTATS_FILE(rx, dropped, "%u");
  34. WL12XX_DEBUGFS_FWSTATS_FILE(rx, fcs_err, "%u");
  35. WL12XX_DEBUGFS_FWSTATS_FILE(rx, xfr_hint_trig, "%u");
  36. WL12XX_DEBUGFS_FWSTATS_FILE(rx, path_reset, "%u");
  37. WL12XX_DEBUGFS_FWSTATS_FILE(rx, reset_counter, "%u");
  38. WL12XX_DEBUGFS_FWSTATS_FILE(dma, rx_requested, "%u");
  39. WL12XX_DEBUGFS_FWSTATS_FILE(dma, rx_errors, "%u");
  40. WL12XX_DEBUGFS_FWSTATS_FILE(dma, tx_requested, "%u");
  41. WL12XX_DEBUGFS_FWSTATS_FILE(dma, tx_errors, "%u");
  42. WL12XX_DEBUGFS_FWSTATS_FILE(isr, cmd_cmplt, "%u");
  43. WL12XX_DEBUGFS_FWSTATS_FILE(isr, fiqs, "%u");
  44. WL12XX_DEBUGFS_FWSTATS_FILE(isr, rx_headers, "%u");
  45. WL12XX_DEBUGFS_FWSTATS_FILE(isr, rx_mem_overflow, "%u");
  46. WL12XX_DEBUGFS_FWSTATS_FILE(isr, rx_rdys, "%u");
  47. WL12XX_DEBUGFS_FWSTATS_FILE(isr, irqs, "%u");
  48. WL12XX_DEBUGFS_FWSTATS_FILE(isr, tx_procs, "%u");
  49. WL12XX_DEBUGFS_FWSTATS_FILE(isr, decrypt_done, "%u");
  50. WL12XX_DEBUGFS_FWSTATS_FILE(isr, dma0_done, "%u");
  51. WL12XX_DEBUGFS_FWSTATS_FILE(isr, dma1_done, "%u");
  52. WL12XX_DEBUGFS_FWSTATS_FILE(isr, tx_exch_complete, "%u");
  53. WL12XX_DEBUGFS_FWSTATS_FILE(isr, commands, "%u");
  54. WL12XX_DEBUGFS_FWSTATS_FILE(isr, rx_procs, "%u");
  55. WL12XX_DEBUGFS_FWSTATS_FILE(isr, hw_pm_mode_changes, "%u");
  56. WL12XX_DEBUGFS_FWSTATS_FILE(isr, host_acknowledges, "%u");
  57. WL12XX_DEBUGFS_FWSTATS_FILE(isr, pci_pm, "%u");
  58. WL12XX_DEBUGFS_FWSTATS_FILE(isr, wakeups, "%u");
  59. WL12XX_DEBUGFS_FWSTATS_FILE(isr, low_rssi, "%u");
  60. WL12XX_DEBUGFS_FWSTATS_FILE(wep, addr_key_count, "%u");
  61. WL12XX_DEBUGFS_FWSTATS_FILE(wep, default_key_count, "%u");
  62. /* skipping wep.reserved */
  63. WL12XX_DEBUGFS_FWSTATS_FILE(wep, key_not_found, "%u");
  64. WL12XX_DEBUGFS_FWSTATS_FILE(wep, decrypt_fail, "%u");
  65. WL12XX_DEBUGFS_FWSTATS_FILE(wep, packets, "%u");
  66. WL12XX_DEBUGFS_FWSTATS_FILE(wep, interrupt, "%u");
  67. WL12XX_DEBUGFS_FWSTATS_FILE(pwr, ps_enter, "%u");
  68. WL12XX_DEBUGFS_FWSTATS_FILE(pwr, elp_enter, "%u");
  69. WL12XX_DEBUGFS_FWSTATS_FILE(pwr, missing_bcns, "%u");
  70. WL12XX_DEBUGFS_FWSTATS_FILE(pwr, wake_on_host, "%u");
  71. WL12XX_DEBUGFS_FWSTATS_FILE(pwr, wake_on_timer_exp, "%u");
  72. WL12XX_DEBUGFS_FWSTATS_FILE(pwr, tx_with_ps, "%u");
  73. WL12XX_DEBUGFS_FWSTATS_FILE(pwr, tx_without_ps, "%u");
  74. WL12XX_DEBUGFS_FWSTATS_FILE(pwr, rcvd_beacons, "%u");
  75. WL12XX_DEBUGFS_FWSTATS_FILE(pwr, power_save_off, "%u");
  76. WL12XX_DEBUGFS_FWSTATS_FILE(pwr, enable_ps, "%u");
  77. WL12XX_DEBUGFS_FWSTATS_FILE(pwr, disable_ps, "%u");
  78. WL12XX_DEBUGFS_FWSTATS_FILE(pwr, fix_tsf_ps, "%u");
  79. /* skipping cont_miss_bcns_spread for now */
  80. WL12XX_DEBUGFS_FWSTATS_FILE(pwr, rcvd_awake_beacons, "%u");
  81. WL12XX_DEBUGFS_FWSTATS_FILE(mic, rx_pkts, "%u");
  82. WL12XX_DEBUGFS_FWSTATS_FILE(mic, calc_failure, "%u");
  83. WL12XX_DEBUGFS_FWSTATS_FILE(aes, encrypt_fail, "%u");
  84. WL12XX_DEBUGFS_FWSTATS_FILE(aes, decrypt_fail, "%u");
  85. WL12XX_DEBUGFS_FWSTATS_FILE(aes, encrypt_packets, "%u");
  86. WL12XX_DEBUGFS_FWSTATS_FILE(aes, decrypt_packets, "%u");
  87. WL12XX_DEBUGFS_FWSTATS_FILE(aes, encrypt_interrupt, "%u");
  88. WL12XX_DEBUGFS_FWSTATS_FILE(aes, decrypt_interrupt, "%u");
  89. WL12XX_DEBUGFS_FWSTATS_FILE(event, heart_beat, "%u");
  90. WL12XX_DEBUGFS_FWSTATS_FILE(event, calibration, "%u");
  91. WL12XX_DEBUGFS_FWSTATS_FILE(event, rx_mismatch, "%u");
  92. WL12XX_DEBUGFS_FWSTATS_FILE(event, rx_mem_empty, "%u");
  93. WL12XX_DEBUGFS_FWSTATS_FILE(event, rx_pool, "%u");
  94. WL12XX_DEBUGFS_FWSTATS_FILE(event, oom_late, "%u");
  95. WL12XX_DEBUGFS_FWSTATS_FILE(event, phy_transmit_error, "%u");
  96. WL12XX_DEBUGFS_FWSTATS_FILE(event, tx_stuck, "%u");
  97. WL12XX_DEBUGFS_FWSTATS_FILE(ps, pspoll_timeouts, "%u");
  98. WL12XX_DEBUGFS_FWSTATS_FILE(ps, upsd_timeouts, "%u");
  99. WL12XX_DEBUGFS_FWSTATS_FILE(ps, upsd_max_sptime, "%u");
  100. WL12XX_DEBUGFS_FWSTATS_FILE(ps, upsd_max_apturn, "%u");
  101. WL12XX_DEBUGFS_FWSTATS_FILE(ps, pspoll_max_apturn, "%u");
  102. WL12XX_DEBUGFS_FWSTATS_FILE(ps, pspoll_utilization, "%u");
  103. WL12XX_DEBUGFS_FWSTATS_FILE(ps, upsd_utilization, "%u");
  104. WL12XX_DEBUGFS_FWSTATS_FILE(rxpipe, rx_prep_beacon_drop, "%u");
  105. WL12XX_DEBUGFS_FWSTATS_FILE(rxpipe, descr_host_int_trig_rx_data, "%u");
  106. WL12XX_DEBUGFS_FWSTATS_FILE(rxpipe, beacon_buffer_thres_host_int_trig_rx_data,
  107. "%u");
  108. WL12XX_DEBUGFS_FWSTATS_FILE(rxpipe, missed_beacon_host_int_trig_rx_data, "%u");
  109. WL12XX_DEBUGFS_FWSTATS_FILE(rxpipe, tx_xfr_host_int_trig_rx_data, "%u");
  110. int wl12xx_debugfs_add_files(struct wl1271 *wl,
  111. struct dentry *rootdir)
  112. {
  113. int ret = 0;
  114. struct dentry *entry, *stats, *moddir;
  115. moddir = debugfs_create_dir(KBUILD_MODNAME, rootdir);
  116. if (!moddir || IS_ERR(moddir)) {
  117. entry = moddir;
  118. goto err;
  119. }
  120. stats = debugfs_create_dir("fw_stats", moddir);
  121. if (!stats || IS_ERR(stats)) {
  122. entry = stats;
  123. goto err;
  124. }
  125. DEBUGFS_FWSTATS_ADD(tx, internal_desc_overflow);
  126. DEBUGFS_FWSTATS_ADD(rx, out_of_mem);
  127. DEBUGFS_FWSTATS_ADD(rx, hdr_overflow);
  128. DEBUGFS_FWSTATS_ADD(rx, hw_stuck);
  129. DEBUGFS_FWSTATS_ADD(rx, dropped);
  130. DEBUGFS_FWSTATS_ADD(rx, fcs_err);
  131. DEBUGFS_FWSTATS_ADD(rx, xfr_hint_trig);
  132. DEBUGFS_FWSTATS_ADD(rx, path_reset);
  133. DEBUGFS_FWSTATS_ADD(rx, reset_counter);
  134. DEBUGFS_FWSTATS_ADD(dma, rx_requested);
  135. DEBUGFS_FWSTATS_ADD(dma, rx_errors);
  136. DEBUGFS_FWSTATS_ADD(dma, tx_requested);
  137. DEBUGFS_FWSTATS_ADD(dma, tx_errors);
  138. DEBUGFS_FWSTATS_ADD(isr, cmd_cmplt);
  139. DEBUGFS_FWSTATS_ADD(isr, fiqs);
  140. DEBUGFS_FWSTATS_ADD(isr, rx_headers);
  141. DEBUGFS_FWSTATS_ADD(isr, rx_mem_overflow);
  142. DEBUGFS_FWSTATS_ADD(isr, rx_rdys);
  143. DEBUGFS_FWSTATS_ADD(isr, irqs);
  144. DEBUGFS_FWSTATS_ADD(isr, tx_procs);
  145. DEBUGFS_FWSTATS_ADD(isr, decrypt_done);
  146. DEBUGFS_FWSTATS_ADD(isr, dma0_done);
  147. DEBUGFS_FWSTATS_ADD(isr, dma1_done);
  148. DEBUGFS_FWSTATS_ADD(isr, tx_exch_complete);
  149. DEBUGFS_FWSTATS_ADD(isr, commands);
  150. DEBUGFS_FWSTATS_ADD(isr, rx_procs);
  151. DEBUGFS_FWSTATS_ADD(isr, hw_pm_mode_changes);
  152. DEBUGFS_FWSTATS_ADD(isr, host_acknowledges);
  153. DEBUGFS_FWSTATS_ADD(isr, pci_pm);
  154. DEBUGFS_FWSTATS_ADD(isr, wakeups);
  155. DEBUGFS_FWSTATS_ADD(isr, low_rssi);
  156. DEBUGFS_FWSTATS_ADD(wep, addr_key_count);
  157. DEBUGFS_FWSTATS_ADD(wep, default_key_count);
  158. /* skipping wep.reserved */
  159. DEBUGFS_FWSTATS_ADD(wep, key_not_found);
  160. DEBUGFS_FWSTATS_ADD(wep, decrypt_fail);
  161. DEBUGFS_FWSTATS_ADD(wep, packets);
  162. DEBUGFS_FWSTATS_ADD(wep, interrupt);
  163. DEBUGFS_FWSTATS_ADD(pwr, ps_enter);
  164. DEBUGFS_FWSTATS_ADD(pwr, elp_enter);
  165. DEBUGFS_FWSTATS_ADD(pwr, missing_bcns);
  166. DEBUGFS_FWSTATS_ADD(pwr, wake_on_host);
  167. DEBUGFS_FWSTATS_ADD(pwr, wake_on_timer_exp);
  168. DEBUGFS_FWSTATS_ADD(pwr, tx_with_ps);
  169. DEBUGFS_FWSTATS_ADD(pwr, tx_without_ps);
  170. DEBUGFS_FWSTATS_ADD(pwr, rcvd_beacons);
  171. DEBUGFS_FWSTATS_ADD(pwr, power_save_off);
  172. DEBUGFS_FWSTATS_ADD(pwr, enable_ps);
  173. DEBUGFS_FWSTATS_ADD(pwr, disable_ps);
  174. DEBUGFS_FWSTATS_ADD(pwr, fix_tsf_ps);
  175. /* skipping cont_miss_bcns_spread for now */
  176. DEBUGFS_FWSTATS_ADD(pwr, rcvd_awake_beacons);
  177. DEBUGFS_FWSTATS_ADD(mic, rx_pkts);
  178. DEBUGFS_FWSTATS_ADD(mic, calc_failure);
  179. DEBUGFS_FWSTATS_ADD(aes, encrypt_fail);
  180. DEBUGFS_FWSTATS_ADD(aes, decrypt_fail);
  181. DEBUGFS_FWSTATS_ADD(aes, encrypt_packets);
  182. DEBUGFS_FWSTATS_ADD(aes, decrypt_packets);
  183. DEBUGFS_FWSTATS_ADD(aes, encrypt_interrupt);
  184. DEBUGFS_FWSTATS_ADD(aes, decrypt_interrupt);
  185. DEBUGFS_FWSTATS_ADD(event, heart_beat);
  186. DEBUGFS_FWSTATS_ADD(event, calibration);
  187. DEBUGFS_FWSTATS_ADD(event, rx_mismatch);
  188. DEBUGFS_FWSTATS_ADD(event, rx_mem_empty);
  189. DEBUGFS_FWSTATS_ADD(event, rx_pool);
  190. DEBUGFS_FWSTATS_ADD(event, oom_late);
  191. DEBUGFS_FWSTATS_ADD(event, phy_transmit_error);
  192. DEBUGFS_FWSTATS_ADD(event, tx_stuck);
  193. DEBUGFS_FWSTATS_ADD(ps, pspoll_timeouts);
  194. DEBUGFS_FWSTATS_ADD(ps, upsd_timeouts);
  195. DEBUGFS_FWSTATS_ADD(ps, upsd_max_sptime);
  196. DEBUGFS_FWSTATS_ADD(ps, upsd_max_apturn);
  197. DEBUGFS_FWSTATS_ADD(ps, pspoll_max_apturn);
  198. DEBUGFS_FWSTATS_ADD(ps, pspoll_utilization);
  199. DEBUGFS_FWSTATS_ADD(ps, upsd_utilization);
  200. DEBUGFS_FWSTATS_ADD(rxpipe, rx_prep_beacon_drop);
  201. DEBUGFS_FWSTATS_ADD(rxpipe, descr_host_int_trig_rx_data);
  202. DEBUGFS_FWSTATS_ADD(rxpipe, beacon_buffer_thres_host_int_trig_rx_data);
  203. DEBUGFS_FWSTATS_ADD(rxpipe, missed_beacon_host_int_trig_rx_data);
  204. DEBUGFS_FWSTATS_ADD(rxpipe, tx_xfr_host_int_trig_rx_data);
  205. return 0;
  206. err:
  207. if (IS_ERR(entry))
  208. ret = PTR_ERR(entry);
  209. else
  210. ret = -ENOMEM;
  211. return ret;
  212. }