Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 1 | /* |
Sujith | cee075a | 2009-03-13 09:07:23 +0530 | [diff] [blame] | 2 | * Copyright (c) 2008-2009 Atheros Communications Inc. |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 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 | |
| 17 | #ifndef DEBUG_H |
| 18 | #define DEBUG_H |
| 19 | |
Luis R. Rodriguez | 4d6b228 | 2009-09-07 04:52:26 -0700 | [diff] [blame] | 20 | #include "hw.h" |
| 21 | |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 22 | struct ath_txq; |
| 23 | struct ath_buf; |
| 24 | |
| 25 | #ifdef CONFIG_ATH9K_DEBUG |
| 26 | #define TX_STAT_INC(q, c) sc->debug.stats.txstats[q].c++ |
| 27 | #else |
| 28 | #define TX_STAT_INC(q, c) do { } while (0) |
| 29 | #endif |
| 30 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 31 | #ifdef CONFIG_ATH9K_DEBUG |
| 32 | |
| 33 | /** |
| 34 | * struct ath_interrupt_stats - Contains statistics about interrupts |
| 35 | * @total: Total no. of interrupts generated so far |
| 36 | * @rxok: RX with no errors |
| 37 | * @rxeol: RX with no more RXDESC available |
| 38 | * @rxorn: RX FIFO overrun |
| 39 | * @txok: TX completed at the requested rate |
| 40 | * @txurn: TX FIFO underrun |
| 41 | * @mib: MIB regs reaching its threshold |
| 42 | * @rxphyerr: RX with phy errors |
| 43 | * @rx_keycache_miss: RX with key cache misses |
| 44 | * @swba: Software Beacon Alert |
| 45 | * @bmiss: Beacon Miss |
| 46 | * @bnr: Beacon Not Ready |
| 47 | * @cst: Carrier Sense TImeout |
| 48 | * @gtt: Global TX Timeout |
| 49 | * @tim: RX beacon TIM occurrence |
| 50 | * @cabend: RX End of CAB traffic |
| 51 | * @dtimsync: DTIM sync lossage |
| 52 | * @dtim: RX Beacon with DTIM |
| 53 | */ |
| 54 | struct ath_interrupt_stats { |
| 55 | u32 total; |
| 56 | u32 rxok; |
| 57 | u32 rxeol; |
| 58 | u32 rxorn; |
| 59 | u32 txok; |
| 60 | u32 txeol; |
| 61 | u32 txurn; |
| 62 | u32 mib; |
| 63 | u32 rxphyerr; |
| 64 | u32 rx_keycache_miss; |
| 65 | u32 swba; |
| 66 | u32 bmiss; |
| 67 | u32 bnr; |
| 68 | u32 cst; |
| 69 | u32 gtt; |
| 70 | u32 tim; |
| 71 | u32 cabend; |
| 72 | u32 dtimsync; |
| 73 | u32 dtim; |
| 74 | }; |
| 75 | |
Jeff Hansen | bedf087 | 2009-05-27 12:48:28 +0000 | [diff] [blame] | 76 | struct ath_rc_stats { |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 77 | u32 success; |
| 78 | u32 retries; |
| 79 | u32 xretries; |
Sujith | 9e71279 | 2009-02-20 15:13:20 +0530 | [diff] [blame] | 80 | u8 per; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 81 | }; |
| 82 | |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 83 | /** |
| 84 | * struct ath_tx_stats - Statistics about TX |
| 85 | * @queued: Total MPDUs (non-aggr) queued |
| 86 | * @completed: Total MPDUs (non-aggr) completed |
| 87 | * @a_aggr: Total no. of aggregates queued |
| 88 | * @a_queued: Total AMPDUs queued |
| 89 | * @a_completed: Total AMPDUs completed |
| 90 | * @a_retries: No. of AMPDUs retried (SW) |
| 91 | * @a_xretries: No. of AMPDUs dropped due to xretries |
| 92 | * @fifo_underrun: FIFO underrun occurrences |
| 93 | Valid only for: |
| 94 | - non-aggregate condition. |
| 95 | - first packet of aggregate. |
| 96 | * @xtxop: No. of frames filtered because of TXOP limit |
| 97 | * @timer_exp: Transmit timer expiry |
| 98 | * @desc_cfg_err: Descriptor configuration errors |
| 99 | * @data_urn: TX data underrun errors |
| 100 | * @delim_urn: TX delimiter underrun errors |
| 101 | */ |
| 102 | struct ath_tx_stats { |
| 103 | u32 queued; |
| 104 | u32 completed; |
| 105 | u32 a_aggr; |
| 106 | u32 a_queued; |
| 107 | u32 a_completed; |
| 108 | u32 a_retries; |
| 109 | u32 a_xretries; |
| 110 | u32 fifo_underrun; |
| 111 | u32 xtxop; |
| 112 | u32 timer_exp; |
| 113 | u32 desc_cfg_err; |
| 114 | u32 data_underrun; |
| 115 | u32 delim_underrun; |
| 116 | }; |
| 117 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 118 | struct ath_stats { |
| 119 | struct ath_interrupt_stats istats; |
Jeff Hansen | bedf087 | 2009-05-27 12:48:28 +0000 | [diff] [blame] | 120 | struct ath_rc_stats rcstats[RATE_TABLE_SIZE]; |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 121 | struct ath_tx_stats txstats[ATH9K_NUM_TX_QUEUES]; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 122 | }; |
| 123 | |
| 124 | struct ath9k_debug { |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 125 | struct dentry *debugfs_phy; |
Jeff Hansen | 2493928 | 2009-05-27 12:48:29 +0000 | [diff] [blame] | 126 | struct dentry *debugfs_debug; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 127 | struct dentry *debugfs_dma; |
| 128 | struct dentry *debugfs_interrupt; |
| 129 | struct dentry *debugfs_rcstat; |
Jouni Malinen | 39d89cd | 2009-03-03 19:23:40 +0200 | [diff] [blame] | 130 | struct dentry *debugfs_wiphy; |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 131 | struct dentry *debugfs_xmit; |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 132 | struct ath_stats stats; |
| 133 | }; |
| 134 | |
Luis R. Rodriguez | 4d6b228 | 2009-09-07 04:52:26 -0700 | [diff] [blame] | 135 | int ath9k_init_debug(struct ath_hw *ah); |
| 136 | void ath9k_exit_debug(struct ath_hw *ah); |
| 137 | |
Gabor Juhos | 19d8bc2 | 2009-03-05 16:55:18 +0100 | [diff] [blame] | 138 | int ath9k_debug_create_root(void); |
| 139 | void ath9k_debug_remove_root(void); |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 140 | void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status); |
| 141 | void ath_debug_stat_rc(struct ath_softc *sc, struct sk_buff *skb); |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 142 | void ath_debug_stat_tx(struct ath_softc *sc, struct ath_txq *txq, |
| 143 | struct ath_buf *bf); |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 144 | void ath_debug_stat_retries(struct ath_softc *sc, int rix, |
Sujith | 9e71279 | 2009-02-20 15:13:20 +0530 | [diff] [blame] | 145 | int xretries, int retries, u8 per); |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 146 | |
| 147 | #else |
| 148 | |
Luis R. Rodriguez | 4d6b228 | 2009-09-07 04:52:26 -0700 | [diff] [blame] | 149 | static inline int ath9k_init_debug(struct ath_hw *ah) |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 150 | { |
| 151 | return 0; |
| 152 | } |
| 153 | |
Luis R. Rodriguez | 4d6b228 | 2009-09-07 04:52:26 -0700 | [diff] [blame] | 154 | static inline void ath9k_exit_debug(struct ath_hw *ah) |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 155 | { |
| 156 | } |
| 157 | |
Gabor Juhos | 19d8bc2 | 2009-03-05 16:55:18 +0100 | [diff] [blame] | 158 | static inline int ath9k_debug_create_root(void) |
| 159 | { |
| 160 | return 0; |
| 161 | } |
| 162 | |
| 163 | static inline void ath9k_debug_remove_root(void) |
| 164 | { |
| 165 | } |
| 166 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 167 | static inline void ath_debug_stat_interrupt(struct ath_softc *sc, |
| 168 | enum ath9k_int status) |
| 169 | { |
| 170 | } |
| 171 | |
| 172 | static inline void ath_debug_stat_rc(struct ath_softc *sc, |
| 173 | struct sk_buff *skb) |
| 174 | { |
| 175 | } |
| 176 | |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 177 | static inline void ath_debug_stat_tx(struct ath_softc *sc, |
| 178 | struct ath_txq *txq, |
| 179 | struct ath_buf *bf) |
| 180 | { |
| 181 | } |
| 182 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 183 | static inline void ath_debug_stat_retries(struct ath_softc *sc, int rix, |
Sujith | 9e71279 | 2009-02-20 15:13:20 +0530 | [diff] [blame] | 184 | int xretries, int retries, u8 per) |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 185 | { |
| 186 | } |
| 187 | |
| 188 | #endif /* CONFIG_ATH9K_DEBUG */ |
| 189 | |
| 190 | #endif /* DEBUG_H */ |