debug.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /*
  2. * Copyright (c) 2008-2009 Atheros Communications Inc.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef DEBUG_H
  17. #define DEBUG_H
  18. enum ATH_DEBUG {
  19. ATH_DBG_RESET = 0x00000001,
  20. ATH_DBG_QUEUE = 0x00000002,
  21. ATH_DBG_EEPROM = 0x00000004,
  22. ATH_DBG_CALIBRATE = 0x00000008,
  23. ATH_DBG_INTERRUPT = 0x00000010,
  24. ATH_DBG_REGULATORY = 0x00000020,
  25. ATH_DBG_ANI = 0x00000040,
  26. ATH_DBG_XMIT = 0x00000080,
  27. ATH_DBG_BEACON = 0x00000100,
  28. ATH_DBG_CONFIG = 0x00000200,
  29. ATH_DBG_FATAL = 0x00000400,
  30. ATH_DBG_PS = 0x00000800,
  31. ATH_DBG_ANY = 0xffffffff
  32. };
  33. #define DBG_DEFAULT (ATH_DBG_FATAL)
  34. #ifdef CONFIG_ATH9K_DEBUG
  35. /**
  36. * struct ath_interrupt_stats - Contains statistics about interrupts
  37. * @total: Total no. of interrupts generated so far
  38. * @rxok: RX with no errors
  39. * @rxeol: RX with no more RXDESC available
  40. * @rxorn: RX FIFO overrun
  41. * @txok: TX completed at the requested rate
  42. * @txurn: TX FIFO underrun
  43. * @mib: MIB regs reaching its threshold
  44. * @rxphyerr: RX with phy errors
  45. * @rx_keycache_miss: RX with key cache misses
  46. * @swba: Software Beacon Alert
  47. * @bmiss: Beacon Miss
  48. * @bnr: Beacon Not Ready
  49. * @cst: Carrier Sense TImeout
  50. * @gtt: Global TX Timeout
  51. * @tim: RX beacon TIM occurrence
  52. * @cabend: RX End of CAB traffic
  53. * @dtimsync: DTIM sync lossage
  54. * @dtim: RX Beacon with DTIM
  55. */
  56. struct ath_interrupt_stats {
  57. u32 total;
  58. u32 rxok;
  59. u32 rxeol;
  60. u32 rxorn;
  61. u32 txok;
  62. u32 txeol;
  63. u32 txurn;
  64. u32 mib;
  65. u32 rxphyerr;
  66. u32 rx_keycache_miss;
  67. u32 swba;
  68. u32 bmiss;
  69. u32 bnr;
  70. u32 cst;
  71. u32 gtt;
  72. u32 tim;
  73. u32 cabend;
  74. u32 dtimsync;
  75. u32 dtim;
  76. };
  77. struct ath_legacy_rc_stats {
  78. u32 success;
  79. };
  80. struct ath_11n_rc_stats {
  81. u32 success;
  82. u32 retries;
  83. u32 xretries;
  84. u8 per;
  85. };
  86. struct ath_stats {
  87. struct ath_interrupt_stats istats;
  88. struct ath_legacy_rc_stats legacy_rcstats[12]; /* max(11a,11b,11g) */
  89. struct ath_11n_rc_stats n_rcstats[16]; /* 0..15 MCS rates */
  90. };
  91. struct ath9k_debug {
  92. int debug_mask;
  93. struct dentry *debugfs_phy;
  94. struct dentry *debugfs_dma;
  95. struct dentry *debugfs_interrupt;
  96. struct dentry *debugfs_rcstat;
  97. struct dentry *debugfs_wiphy;
  98. struct ath_stats stats;
  99. };
  100. void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...);
  101. int ath9k_init_debug(struct ath_softc *sc);
  102. void ath9k_exit_debug(struct ath_softc *sc);
  103. int ath9k_debug_create_root(void);
  104. void ath9k_debug_remove_root(void);
  105. void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status);
  106. void ath_debug_stat_rc(struct ath_softc *sc, struct sk_buff *skb);
  107. void ath_debug_stat_retries(struct ath_softc *sc, int rix,
  108. int xretries, int retries, u8 per);
  109. #else
  110. static inline void DPRINTF(struct ath_softc *sc, int dbg_mask,
  111. const char *fmt, ...)
  112. {
  113. }
  114. static inline int ath9k_init_debug(struct ath_softc *sc)
  115. {
  116. return 0;
  117. }
  118. static inline void ath9k_exit_debug(struct ath_softc *sc)
  119. {
  120. }
  121. static inline int ath9k_debug_create_root(void)
  122. {
  123. return 0;
  124. }
  125. static inline void ath9k_debug_remove_root(void)
  126. {
  127. }
  128. static inline void ath_debug_stat_interrupt(struct ath_softc *sc,
  129. enum ath9k_int status)
  130. {
  131. }
  132. static inline void ath_debug_stat_rc(struct ath_softc *sc,
  133. struct sk_buff *skb)
  134. {
  135. }
  136. static inline void ath_debug_stat_retries(struct ath_softc *sc, int rix,
  137. int xretries, int retries, u8 per)
  138. {
  139. }
  140. #endif /* CONFIG_ATH9K_DEBUG */
  141. #endif /* DEBUG_H */