Sujith | 88b126a | 2008-11-28 22:19:02 +0530 | [diff] [blame] | 1 | /* |
Sujith | cee075a | 2009-03-13 09:07:23 +0530 | [diff] [blame] | 2 | * Copyright (c) 2008-2009 Atheros Communications Inc. |
Sujith | 88b126a | 2008-11-28 22:19:02 +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 | |
Gabor Juhos | 5210311 | 2009-03-06 09:57:39 +0100 | [diff] [blame] | 17 | #include <asm/unaligned.h> |
| 18 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 19 | #include "ath9k.h" |
Sujith | 88b126a | 2008-11-28 22:19:02 +0530 | [diff] [blame] | 20 | |
Luis R. Rodriguez | 475a6e4 | 2009-09-23 23:06:59 -0400 | [diff] [blame] | 21 | #define REG_WRITE_D(_ah, _reg, _val) \ |
| 22 | ath9k_hw_common(_ah)->ops->write((_ah), (_val), (_reg)) |
| 23 | #define REG_READ_D(_ah, _reg) \ |
| 24 | ath9k_hw_common(_ah)->ops->read((_ah), (_reg)) |
| 25 | |
Gabor Juhos | 19d8bc2 | 2009-03-05 16:55:18 +0100 | [diff] [blame] | 26 | static struct dentry *ath9k_debugfs_root; |
| 27 | |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 28 | static int ath9k_debugfs_open(struct inode *inode, struct file *file) |
| 29 | { |
| 30 | file->private_data = inode->i_private; |
| 31 | return 0; |
| 32 | } |
| 33 | |
Jeff Hansen | 2493928 | 2009-05-27 12:48:29 +0000 | [diff] [blame] | 34 | static ssize_t read_file_debug(struct file *file, char __user *user_buf, |
| 35 | size_t count, loff_t *ppos) |
| 36 | { |
| 37 | struct ath_softc *sc = file->private_data; |
Luis R. Rodriguez | c46917b | 2009-09-13 02:42:02 -0700 | [diff] [blame] | 38 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
Jeff Hansen | 2493928 | 2009-05-27 12:48:29 +0000 | [diff] [blame] | 39 | char buf[32]; |
Vasanthakumar Thiagarajan | 581f725 | 2009-06-02 19:28:55 +0530 | [diff] [blame] | 40 | unsigned int len; |
| 41 | |
Luis R. Rodriguez | c46917b | 2009-09-13 02:42:02 -0700 | [diff] [blame] | 42 | len = snprintf(buf, sizeof(buf), "0x%08x\n", common->debug_mask); |
Jeff Hansen | 2493928 | 2009-05-27 12:48:29 +0000 | [diff] [blame] | 43 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 44 | } |
| 45 | |
| 46 | static ssize_t write_file_debug(struct file *file, const char __user *user_buf, |
| 47 | size_t count, loff_t *ppos) |
| 48 | { |
| 49 | struct ath_softc *sc = file->private_data; |
Luis R. Rodriguez | c46917b | 2009-09-13 02:42:02 -0700 | [diff] [blame] | 50 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
Jeff Hansen | 2493928 | 2009-05-27 12:48:29 +0000 | [diff] [blame] | 51 | unsigned long mask; |
| 52 | char buf[32]; |
Vasanthakumar Thiagarajan | 581f725 | 2009-06-02 19:28:55 +0530 | [diff] [blame] | 53 | ssize_t len; |
| 54 | |
| 55 | len = min(count, sizeof(buf) - 1); |
| 56 | if (copy_from_user(buf, user_buf, len)) |
| 57 | return -EINVAL; |
| 58 | |
| 59 | buf[len] = '\0'; |
| 60 | if (strict_strtoul(buf, 0, &mask)) |
| 61 | return -EINVAL; |
| 62 | |
Luis R. Rodriguez | c46917b | 2009-09-13 02:42:02 -0700 | [diff] [blame] | 63 | common->debug_mask = mask; |
Jeff Hansen | 2493928 | 2009-05-27 12:48:29 +0000 | [diff] [blame] | 64 | return count; |
| 65 | } |
| 66 | |
| 67 | static const struct file_operations fops_debug = { |
| 68 | .read = read_file_debug, |
| 69 | .write = write_file_debug, |
| 70 | .open = ath9k_debugfs_open, |
| 71 | .owner = THIS_MODULE |
| 72 | }; |
| 73 | |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 74 | static ssize_t read_file_dma(struct file *file, char __user *user_buf, |
| 75 | size_t count, loff_t *ppos) |
| 76 | { |
| 77 | struct ath_softc *sc = file->private_data; |
Sujith | cbe61d8 | 2009-02-09 13:27:12 +0530 | [diff] [blame] | 78 | struct ath_hw *ah = sc->sc_ah; |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 79 | char buf[1024]; |
| 80 | unsigned int len = 0; |
| 81 | u32 val[ATH9K_NUM_DMA_DEBUG_REGS]; |
| 82 | int i, qcuOffset = 0, dcuOffset = 0; |
| 83 | u32 *qcuBase = &val[0], *dcuBase = &val[4]; |
| 84 | |
Sujith | 7cf4a2e | 2009-08-26 11:11:57 +0530 | [diff] [blame] | 85 | ath9k_ps_wakeup(sc); |
| 86 | |
Luis R. Rodriguez | 475a6e4 | 2009-09-23 23:06:59 -0400 | [diff] [blame] | 87 | REG_WRITE_D(ah, AR_MACMISC, |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 88 | ((AR_MACMISC_DMA_OBS_LINE_8 << AR_MACMISC_DMA_OBS_S) | |
| 89 | (AR_MACMISC_MISC_OBS_BUS_1 << |
| 90 | AR_MACMISC_MISC_OBS_BUS_MSB_S))); |
| 91 | |
| 92 | len += snprintf(buf + len, sizeof(buf) - len, |
| 93 | "Raw DMA Debug values:\n"); |
| 94 | |
| 95 | for (i = 0; i < ATH9K_NUM_DMA_DEBUG_REGS; i++) { |
| 96 | if (i % 4 == 0) |
| 97 | len += snprintf(buf + len, sizeof(buf) - len, "\n"); |
| 98 | |
Luis R. Rodriguez | 475a6e4 | 2009-09-23 23:06:59 -0400 | [diff] [blame] | 99 | val[i] = REG_READ_D(ah, AR_DMADBG_0 + (i * sizeof(u32))); |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 100 | len += snprintf(buf + len, sizeof(buf) - len, "%d: %08x ", |
| 101 | i, val[i]); |
| 102 | } |
| 103 | |
| 104 | len += snprintf(buf + len, sizeof(buf) - len, "\n\n"); |
| 105 | len += snprintf(buf + len, sizeof(buf) - len, |
| 106 | "Num QCU: chain_st fsp_ok fsp_st DCU: chain_st\n"); |
| 107 | |
| 108 | for (i = 0; i < ATH9K_NUM_QUEUES; i++, qcuOffset += 4, dcuOffset += 5) { |
| 109 | if (i == 8) { |
| 110 | qcuOffset = 0; |
| 111 | qcuBase++; |
| 112 | } |
| 113 | |
| 114 | if (i == 6) { |
| 115 | dcuOffset = 0; |
| 116 | dcuBase++; |
| 117 | } |
| 118 | |
| 119 | len += snprintf(buf + len, sizeof(buf) - len, |
| 120 | "%2d %2x %1x %2x %2x\n", |
| 121 | i, (*qcuBase & (0x7 << qcuOffset)) >> qcuOffset, |
| 122 | (*qcuBase & (0x8 << qcuOffset)) >> (qcuOffset + 3), |
| 123 | val[2] & (0x7 << (i * 3)) >> (i * 3), |
| 124 | (*dcuBase & (0x1f << dcuOffset)) >> dcuOffset); |
| 125 | } |
| 126 | |
| 127 | len += snprintf(buf + len, sizeof(buf) - len, "\n"); |
| 128 | |
| 129 | len += snprintf(buf + len, sizeof(buf) - len, |
| 130 | "qcu_stitch state: %2x qcu_fetch state: %2x\n", |
| 131 | (val[3] & 0x003c0000) >> 18, (val[3] & 0x03c00000) >> 22); |
| 132 | len += snprintf(buf + len, sizeof(buf) - len, |
| 133 | "qcu_complete state: %2x dcu_complete state: %2x\n", |
| 134 | (val[3] & 0x1c000000) >> 26, (val[6] & 0x3)); |
| 135 | len += snprintf(buf + len, sizeof(buf) - len, |
| 136 | "dcu_arb state: %2x dcu_fp state: %2x\n", |
| 137 | (val[5] & 0x06000000) >> 25, (val[5] & 0x38000000) >> 27); |
| 138 | len += snprintf(buf + len, sizeof(buf) - len, |
| 139 | "chan_idle_dur: %3d chan_idle_dur_valid: %1d\n", |
| 140 | (val[6] & 0x000003fc) >> 2, (val[6] & 0x00000400) >> 10); |
| 141 | len += snprintf(buf + len, sizeof(buf) - len, |
| 142 | "txfifo_valid_0: %1d txfifo_valid_1: %1d\n", |
| 143 | (val[6] & 0x00000800) >> 11, (val[6] & 0x00001000) >> 12); |
| 144 | len += snprintf(buf + len, sizeof(buf) - len, |
| 145 | "txfifo_dcu_num_0: %2d txfifo_dcu_num_1: %2d\n", |
| 146 | (val[6] & 0x0001e000) >> 13, (val[6] & 0x001e0000) >> 17); |
| 147 | |
| 148 | len += snprintf(buf + len, sizeof(buf) - len, "pcu observe: 0x%x \n", |
Luis R. Rodriguez | 475a6e4 | 2009-09-23 23:06:59 -0400 | [diff] [blame] | 149 | REG_READ_D(ah, AR_OBS_BUS_1)); |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 150 | len += snprintf(buf + len, sizeof(buf) - len, |
Luis R. Rodriguez | 475a6e4 | 2009-09-23 23:06:59 -0400 | [diff] [blame] | 151 | "AR_CR: 0x%x \n", REG_READ_D(ah, AR_CR)); |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 152 | |
Sujith | 7cf4a2e | 2009-08-26 11:11:57 +0530 | [diff] [blame] | 153 | ath9k_ps_restore(sc); |
| 154 | |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 155 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 156 | } |
| 157 | |
| 158 | static const struct file_operations fops_dma = { |
| 159 | .read = read_file_dma, |
| 160 | .open = ath9k_debugfs_open, |
| 161 | .owner = THIS_MODULE |
| 162 | }; |
| 163 | |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 164 | |
| 165 | void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status) |
| 166 | { |
| 167 | if (status) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 168 | sc->debug.stats.istats.total++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 169 | if (status & ATH9K_INT_RX) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 170 | sc->debug.stats.istats.rxok++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 171 | if (status & ATH9K_INT_RXEOL) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 172 | sc->debug.stats.istats.rxeol++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 173 | if (status & ATH9K_INT_RXORN) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 174 | sc->debug.stats.istats.rxorn++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 175 | if (status & ATH9K_INT_TX) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 176 | sc->debug.stats.istats.txok++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 177 | if (status & ATH9K_INT_TXURN) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 178 | sc->debug.stats.istats.txurn++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 179 | if (status & ATH9K_INT_MIB) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 180 | sc->debug.stats.istats.mib++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 181 | if (status & ATH9K_INT_RXPHY) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 182 | sc->debug.stats.istats.rxphyerr++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 183 | if (status & ATH9K_INT_RXKCM) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 184 | sc->debug.stats.istats.rx_keycache_miss++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 185 | if (status & ATH9K_INT_SWBA) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 186 | sc->debug.stats.istats.swba++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 187 | if (status & ATH9K_INT_BMISS) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 188 | sc->debug.stats.istats.bmiss++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 189 | if (status & ATH9K_INT_BNR) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 190 | sc->debug.stats.istats.bnr++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 191 | if (status & ATH9K_INT_CST) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 192 | sc->debug.stats.istats.cst++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 193 | if (status & ATH9K_INT_GTT) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 194 | sc->debug.stats.istats.gtt++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 195 | if (status & ATH9K_INT_TIM) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 196 | sc->debug.stats.istats.tim++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 197 | if (status & ATH9K_INT_CABEND) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 198 | sc->debug.stats.istats.cabend++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 199 | if (status & ATH9K_INT_DTIMSYNC) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 200 | sc->debug.stats.istats.dtimsync++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 201 | if (status & ATH9K_INT_DTIM) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 202 | sc->debug.stats.istats.dtim++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 203 | } |
| 204 | |
| 205 | static ssize_t read_file_interrupt(struct file *file, char __user *user_buf, |
| 206 | size_t count, loff_t *ppos) |
| 207 | { |
| 208 | struct ath_softc *sc = file->private_data; |
| 209 | char buf[512]; |
| 210 | unsigned int len = 0; |
| 211 | |
| 212 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 213 | "%8s: %10u\n", "RX", sc->debug.stats.istats.rxok); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 214 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 215 | "%8s: %10u\n", "RXEOL", sc->debug.stats.istats.rxeol); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 216 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 217 | "%8s: %10u\n", "RXORN", sc->debug.stats.istats.rxorn); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 218 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 219 | "%8s: %10u\n", "TX", sc->debug.stats.istats.txok); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 220 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 221 | "%8s: %10u\n", "TXURN", sc->debug.stats.istats.txurn); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 222 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 223 | "%8s: %10u\n", "MIB", sc->debug.stats.istats.mib); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 224 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 225 | "%8s: %10u\n", "RXPHY", sc->debug.stats.istats.rxphyerr); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 226 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 227 | "%8s: %10u\n", "RXKCM", sc->debug.stats.istats.rx_keycache_miss); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 228 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 229 | "%8s: %10u\n", "SWBA", sc->debug.stats.istats.swba); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 230 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 231 | "%8s: %10u\n", "BMISS", sc->debug.stats.istats.bmiss); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 232 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 233 | "%8s: %10u\n", "BNR", sc->debug.stats.istats.bnr); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 234 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 235 | "%8s: %10u\n", "CST", sc->debug.stats.istats.cst); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 236 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 237 | "%8s: %10u\n", "GTT", sc->debug.stats.istats.gtt); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 238 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 239 | "%8s: %10u\n", "TIM", sc->debug.stats.istats.tim); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 240 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 241 | "%8s: %10u\n", "CABEND", sc->debug.stats.istats.cabend); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 242 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 243 | "%8s: %10u\n", "DTIMSYNC", sc->debug.stats.istats.dtimsync); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 244 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 245 | "%8s: %10u\n", "DTIM", sc->debug.stats.istats.dtim); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 246 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 247 | "%8s: %10u\n", "TOTAL", sc->debug.stats.istats.total); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 248 | |
| 249 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 250 | } |
| 251 | |
| 252 | static const struct file_operations fops_interrupt = { |
| 253 | .read = read_file_interrupt, |
| 254 | .open = ath9k_debugfs_open, |
| 255 | .owner = THIS_MODULE |
| 256 | }; |
| 257 | |
Felix Fietkau | 545750d | 2009-11-23 22:21:01 +0100 | [diff] [blame] | 258 | void ath_debug_stat_rc(struct ath_softc *sc, int final_rate) |
Sujith | 7a7dec6 | 2009-01-30 14:32:09 +0530 | [diff] [blame] | 259 | { |
Jeff Hansen | bedf087 | 2009-05-27 12:48:28 +0000 | [diff] [blame] | 260 | struct ath_rc_stats *stats; |
Sujith | 7a7dec6 | 2009-01-30 14:32:09 +0530 | [diff] [blame] | 261 | |
Felix Fietkau | 545750d | 2009-11-23 22:21:01 +0100 | [diff] [blame] | 262 | stats = &sc->debug.stats.rcstats[final_rate]; |
Jeff Hansen | bedf087 | 2009-05-27 12:48:28 +0000 | [diff] [blame] | 263 | stats->success++; |
Sujith | 7a7dec6 | 2009-01-30 14:32:09 +0530 | [diff] [blame] | 264 | } |
| 265 | |
Sujith | 029bc43 | 2009-02-04 08:10:26 +0530 | [diff] [blame] | 266 | void ath_debug_stat_retries(struct ath_softc *sc, int rix, |
Sujith | 9e71279 | 2009-02-20 15:13:20 +0530 | [diff] [blame] | 267 | int xretries, int retries, u8 per) |
Sujith | 029bc43 | 2009-02-04 08:10:26 +0530 | [diff] [blame] | 268 | { |
Jeff Hansen | bedf087 | 2009-05-27 12:48:28 +0000 | [diff] [blame] | 269 | struct ath_rc_stats *stats = &sc->debug.stats.rcstats[rix]; |
Sujith | 029bc43 | 2009-02-04 08:10:26 +0530 | [diff] [blame] | 270 | |
Jeff Hansen | bedf087 | 2009-05-27 12:48:28 +0000 | [diff] [blame] | 271 | stats->xretries += xretries; |
| 272 | stats->retries += retries; |
| 273 | stats->per = per; |
Sujith | 7a7dec6 | 2009-01-30 14:32:09 +0530 | [diff] [blame] | 274 | } |
| 275 | |
| 276 | static ssize_t read_file_rcstat(struct file *file, char __user *user_buf, |
| 277 | size_t count, loff_t *ppos) |
| 278 | { |
| 279 | struct ath_softc *sc = file->private_data; |
Jeff Hansen | bedf087 | 2009-05-27 12:48:28 +0000 | [diff] [blame] | 280 | char *buf; |
| 281 | unsigned int len = 0, max; |
| 282 | int i = 0; |
| 283 | ssize_t retval; |
Sujith | 7a7dec6 | 2009-01-30 14:32:09 +0530 | [diff] [blame] | 284 | |
Sujith | 62b4fb6 | 2009-03-09 09:32:01 +0530 | [diff] [blame] | 285 | if (sc->cur_rate_table == NULL) |
| 286 | return 0; |
| 287 | |
Jeff Hansen | bedf087 | 2009-05-27 12:48:28 +0000 | [diff] [blame] | 288 | max = 80 + sc->cur_rate_table->rate_cnt * 64; |
| 289 | buf = kmalloc(max + 1, GFP_KERNEL); |
| 290 | if (buf == NULL) |
| 291 | return 0; |
| 292 | buf[max] = 0; |
| 293 | |
| 294 | len += sprintf(buf, "%5s %15s %8s %9s %3s\n\n", "Rate", "Success", |
| 295 | "Retries", "XRetries", "PER"); |
| 296 | |
| 297 | for (i = 0; i < sc->cur_rate_table->rate_cnt; i++) { |
| 298 | u32 ratekbps = sc->cur_rate_table->info[i].ratekbps; |
| 299 | struct ath_rc_stats *stats = &sc->debug.stats.rcstats[i]; |
| 300 | |
| 301 | len += snprintf(buf + len, max - len, |
| 302 | "%3u.%d: %8u %8u %8u %8u\n", ratekbps / 1000, |
| 303 | (ratekbps % 1000) / 100, stats->success, |
| 304 | stats->retries, stats->xretries, |
| 305 | stats->per); |
| 306 | } |
| 307 | |
| 308 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 309 | kfree(buf); |
| 310 | return retval; |
Sujith | 7a7dec6 | 2009-01-30 14:32:09 +0530 | [diff] [blame] | 311 | } |
| 312 | |
| 313 | static const struct file_operations fops_rcstat = { |
| 314 | .read = read_file_rcstat, |
| 315 | .open = ath9k_debugfs_open, |
| 316 | .owner = THIS_MODULE |
| 317 | }; |
Alina Friedrichsen | 27abe06 | 2009-01-23 05:44:21 +0100 | [diff] [blame] | 318 | |
Jouni Malinen | 39d89cd | 2009-03-03 19:23:40 +0200 | [diff] [blame] | 319 | static const char * ath_wiphy_state_str(enum ath_wiphy_state state) |
| 320 | { |
| 321 | switch (state) { |
| 322 | case ATH_WIPHY_INACTIVE: |
| 323 | return "INACTIVE"; |
| 324 | case ATH_WIPHY_ACTIVE: |
| 325 | return "ACTIVE"; |
| 326 | case ATH_WIPHY_PAUSING: |
| 327 | return "PAUSING"; |
| 328 | case ATH_WIPHY_PAUSED: |
| 329 | return "PAUSED"; |
| 330 | case ATH_WIPHY_SCAN: |
| 331 | return "SCAN"; |
| 332 | } |
| 333 | return "?"; |
| 334 | } |
| 335 | |
| 336 | static ssize_t read_file_wiphy(struct file *file, char __user *user_buf, |
| 337 | size_t count, loff_t *ppos) |
| 338 | { |
| 339 | struct ath_softc *sc = file->private_data; |
| 340 | char buf[512]; |
| 341 | unsigned int len = 0; |
| 342 | int i; |
| 343 | u8 addr[ETH_ALEN]; |
| 344 | |
| 345 | len += snprintf(buf + len, sizeof(buf) - len, |
| 346 | "primary: %s (%s chan=%d ht=%d)\n", |
| 347 | wiphy_name(sc->pri_wiphy->hw->wiphy), |
| 348 | ath_wiphy_state_str(sc->pri_wiphy->state), |
| 349 | sc->pri_wiphy->chan_idx, sc->pri_wiphy->chan_is_ht); |
| 350 | for (i = 0; i < sc->num_sec_wiphy; i++) { |
| 351 | struct ath_wiphy *aphy = sc->sec_wiphy[i]; |
| 352 | if (aphy == NULL) |
| 353 | continue; |
| 354 | len += snprintf(buf + len, sizeof(buf) - len, |
| 355 | "secondary: %s (%s chan=%d ht=%d)\n", |
| 356 | wiphy_name(aphy->hw->wiphy), |
| 357 | ath_wiphy_state_str(aphy->state), |
| 358 | aphy->chan_idx, aphy->chan_is_ht); |
| 359 | } |
| 360 | |
Luis R. Rodriguez | 475a6e4 | 2009-09-23 23:06:59 -0400 | [diff] [blame] | 361 | put_unaligned_le32(REG_READ_D(sc->sc_ah, AR_STA_ID0), addr); |
| 362 | put_unaligned_le16(REG_READ_D(sc->sc_ah, AR_STA_ID1) & 0xffff, addr + 4); |
Jouni Malinen | 39d89cd | 2009-03-03 19:23:40 +0200 | [diff] [blame] | 363 | len += snprintf(buf + len, sizeof(buf) - len, |
| 364 | "addr: %pM\n", addr); |
Luis R. Rodriguez | 475a6e4 | 2009-09-23 23:06:59 -0400 | [diff] [blame] | 365 | put_unaligned_le32(REG_READ_D(sc->sc_ah, AR_BSSMSKL), addr); |
| 366 | put_unaligned_le16(REG_READ_D(sc->sc_ah, AR_BSSMSKU) & 0xffff, addr + 4); |
Jouni Malinen | 39d89cd | 2009-03-03 19:23:40 +0200 | [diff] [blame] | 367 | len += snprintf(buf + len, sizeof(buf) - len, |
| 368 | "addrmask: %pM\n", addr); |
| 369 | |
| 370 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 371 | } |
| 372 | |
| 373 | static struct ath_wiphy * get_wiphy(struct ath_softc *sc, const char *name) |
| 374 | { |
| 375 | int i; |
| 376 | if (strcmp(name, wiphy_name(sc->pri_wiphy->hw->wiphy)) == 0) |
| 377 | return sc->pri_wiphy; |
| 378 | for (i = 0; i < sc->num_sec_wiphy; i++) { |
| 379 | struct ath_wiphy *aphy = sc->sec_wiphy[i]; |
| 380 | if (aphy && strcmp(name, wiphy_name(aphy->hw->wiphy)) == 0) |
| 381 | return aphy; |
| 382 | } |
| 383 | return NULL; |
| 384 | } |
| 385 | |
| 386 | static int del_wiphy(struct ath_softc *sc, const char *name) |
| 387 | { |
| 388 | struct ath_wiphy *aphy = get_wiphy(sc, name); |
| 389 | if (!aphy) |
| 390 | return -ENOENT; |
| 391 | return ath9k_wiphy_del(aphy); |
| 392 | } |
| 393 | |
| 394 | static int pause_wiphy(struct ath_softc *sc, const char *name) |
| 395 | { |
| 396 | struct ath_wiphy *aphy = get_wiphy(sc, name); |
| 397 | if (!aphy) |
| 398 | return -ENOENT; |
| 399 | return ath9k_wiphy_pause(aphy); |
| 400 | } |
| 401 | |
| 402 | static int unpause_wiphy(struct ath_softc *sc, const char *name) |
| 403 | { |
| 404 | struct ath_wiphy *aphy = get_wiphy(sc, name); |
| 405 | if (!aphy) |
| 406 | return -ENOENT; |
| 407 | return ath9k_wiphy_unpause(aphy); |
| 408 | } |
| 409 | |
| 410 | static int select_wiphy(struct ath_softc *sc, const char *name) |
| 411 | { |
| 412 | struct ath_wiphy *aphy = get_wiphy(sc, name); |
| 413 | if (!aphy) |
| 414 | return -ENOENT; |
| 415 | return ath9k_wiphy_select(aphy); |
| 416 | } |
| 417 | |
| 418 | static int schedule_wiphy(struct ath_softc *sc, const char *msec) |
| 419 | { |
| 420 | ath9k_wiphy_set_scheduler(sc, simple_strtoul(msec, NULL, 0)); |
| 421 | return 0; |
| 422 | } |
| 423 | |
| 424 | static ssize_t write_file_wiphy(struct file *file, const char __user *user_buf, |
| 425 | size_t count, loff_t *ppos) |
| 426 | { |
| 427 | struct ath_softc *sc = file->private_data; |
| 428 | char buf[50]; |
| 429 | size_t len; |
| 430 | |
| 431 | len = min(count, sizeof(buf) - 1); |
| 432 | if (copy_from_user(buf, user_buf, len)) |
| 433 | return -EFAULT; |
| 434 | buf[len] = '\0'; |
| 435 | if (len > 0 && buf[len - 1] == '\n') |
| 436 | buf[len - 1] = '\0'; |
| 437 | |
| 438 | if (strncmp(buf, "add", 3) == 0) { |
| 439 | int res = ath9k_wiphy_add(sc); |
| 440 | if (res < 0) |
| 441 | return res; |
| 442 | } else if (strncmp(buf, "del=", 4) == 0) { |
| 443 | int res = del_wiphy(sc, buf + 4); |
| 444 | if (res < 0) |
| 445 | return res; |
| 446 | } else if (strncmp(buf, "pause=", 6) == 0) { |
| 447 | int res = pause_wiphy(sc, buf + 6); |
| 448 | if (res < 0) |
| 449 | return res; |
| 450 | } else if (strncmp(buf, "unpause=", 8) == 0) { |
| 451 | int res = unpause_wiphy(sc, buf + 8); |
| 452 | if (res < 0) |
| 453 | return res; |
| 454 | } else if (strncmp(buf, "select=", 7) == 0) { |
| 455 | int res = select_wiphy(sc, buf + 7); |
| 456 | if (res < 0) |
| 457 | return res; |
| 458 | } else if (strncmp(buf, "schedule=", 9) == 0) { |
| 459 | int res = schedule_wiphy(sc, buf + 9); |
| 460 | if (res < 0) |
| 461 | return res; |
| 462 | } else |
| 463 | return -EOPNOTSUPP; |
| 464 | |
| 465 | return count; |
| 466 | } |
| 467 | |
| 468 | static const struct file_operations fops_wiphy = { |
| 469 | .read = read_file_wiphy, |
| 470 | .write = write_file_wiphy, |
| 471 | .open = ath9k_debugfs_open, |
| 472 | .owner = THIS_MODULE |
| 473 | }; |
| 474 | |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 475 | #define PR(str, elem) \ |
| 476 | do { \ |
| 477 | len += snprintf(buf + len, size - len, \ |
| 478 | "%s%13u%11u%10u%10u\n", str, \ |
| 479 | sc->debug.stats.txstats[sc->tx.hwq_map[ATH9K_WME_AC_BE]].elem, \ |
| 480 | sc->debug.stats.txstats[sc->tx.hwq_map[ATH9K_WME_AC_BK]].elem, \ |
| 481 | sc->debug.stats.txstats[sc->tx.hwq_map[ATH9K_WME_AC_VI]].elem, \ |
| 482 | sc->debug.stats.txstats[sc->tx.hwq_map[ATH9K_WME_AC_VO]].elem); \ |
| 483 | } while(0) |
| 484 | |
| 485 | static ssize_t read_file_xmit(struct file *file, char __user *user_buf, |
| 486 | size_t count, loff_t *ppos) |
| 487 | { |
| 488 | struct ath_softc *sc = file->private_data; |
| 489 | char *buf; |
| 490 | unsigned int len = 0, size = 2048; |
| 491 | ssize_t retval = 0; |
| 492 | |
| 493 | buf = kzalloc(size, GFP_KERNEL); |
| 494 | if (buf == NULL) |
| 495 | return 0; |
| 496 | |
| 497 | len += sprintf(buf, "%30s %10s%10s%10s\n\n", "BE", "BK", "VI", "VO"); |
| 498 | |
| 499 | PR("MPDUs Queued: ", queued); |
| 500 | PR("MPDUs Completed: ", completed); |
| 501 | PR("Aggregates: ", a_aggr); |
| 502 | PR("AMPDUs Queued: ", a_queued); |
| 503 | PR("AMPDUs Completed:", a_completed); |
| 504 | PR("AMPDUs Retried: ", a_retries); |
| 505 | PR("AMPDUs XRetried: ", a_xretries); |
| 506 | PR("FIFO Underrun: ", fifo_underrun); |
| 507 | PR("TXOP Exceeded: ", xtxop); |
| 508 | PR("TXTIMER Expiry: ", timer_exp); |
| 509 | PR("DESC CFG Error: ", desc_cfg_err); |
| 510 | PR("DATA Underrun: ", data_underrun); |
| 511 | PR("DELIM Underrun: ", delim_underrun); |
| 512 | |
| 513 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 514 | kfree(buf); |
| 515 | |
| 516 | return retval; |
| 517 | } |
| 518 | |
| 519 | void ath_debug_stat_tx(struct ath_softc *sc, struct ath_txq *txq, |
| 520 | struct ath_buf *bf) |
| 521 | { |
| 522 | struct ath_desc *ds = bf->bf_desc; |
| 523 | |
| 524 | if (bf_isampdu(bf)) { |
| 525 | if (bf_isxretried(bf)) |
| 526 | TX_STAT_INC(txq->axq_qnum, a_xretries); |
| 527 | else |
| 528 | TX_STAT_INC(txq->axq_qnum, a_completed); |
| 529 | } else { |
| 530 | TX_STAT_INC(txq->axq_qnum, completed); |
| 531 | } |
| 532 | |
| 533 | if (ds->ds_txstat.ts_status & ATH9K_TXERR_FIFO) |
| 534 | TX_STAT_INC(txq->axq_qnum, fifo_underrun); |
| 535 | if (ds->ds_txstat.ts_status & ATH9K_TXERR_XTXOP) |
| 536 | TX_STAT_INC(txq->axq_qnum, xtxop); |
| 537 | if (ds->ds_txstat.ts_status & ATH9K_TXERR_TIMER_EXPIRED) |
| 538 | TX_STAT_INC(txq->axq_qnum, timer_exp); |
| 539 | if (ds->ds_txstat.ts_flags & ATH9K_TX_DESC_CFG_ERR) |
| 540 | TX_STAT_INC(txq->axq_qnum, desc_cfg_err); |
| 541 | if (ds->ds_txstat.ts_flags & ATH9K_TX_DATA_UNDERRUN) |
| 542 | TX_STAT_INC(txq->axq_qnum, data_underrun); |
| 543 | if (ds->ds_txstat.ts_flags & ATH9K_TX_DELIM_UNDERRUN) |
| 544 | TX_STAT_INC(txq->axq_qnum, delim_underrun); |
| 545 | } |
| 546 | |
| 547 | static const struct file_operations fops_xmit = { |
| 548 | .read = read_file_xmit, |
| 549 | .open = ath9k_debugfs_open, |
| 550 | .owner = THIS_MODULE |
| 551 | }; |
Jouni Malinen | 39d89cd | 2009-03-03 19:23:40 +0200 | [diff] [blame] | 552 | |
Luis R. Rodriguez | 4d6b228 | 2009-09-07 04:52:26 -0700 | [diff] [blame] | 553 | int ath9k_init_debug(struct ath_hw *ah) |
Sujith | 88b126a | 2008-11-28 22:19:02 +0530 | [diff] [blame] | 554 | { |
Luis R. Rodriguez | bc974f4 | 2009-09-28 02:54:40 -0400 | [diff] [blame] | 555 | struct ath_common *common = ath9k_hw_common(ah); |
| 556 | struct ath_softc *sc = (struct ath_softc *) common->priv; |
Luis R. Rodriguez | 4d6b228 | 2009-09-07 04:52:26 -0700 | [diff] [blame] | 557 | |
Sujith | 7dd5874 | 2009-03-30 15:28:42 +0530 | [diff] [blame] | 558 | if (!ath9k_debugfs_root) |
| 559 | return -ENOENT; |
| 560 | |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 561 | sc->debug.debugfs_phy = debugfs_create_dir(wiphy_name(sc->hw->wiphy), |
Gabor Juhos | 19d8bc2 | 2009-03-05 16:55:18 +0100 | [diff] [blame] | 562 | ath9k_debugfs_root); |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 563 | if (!sc->debug.debugfs_phy) |
Sujith | 826d268 | 2008-11-28 22:20:23 +0530 | [diff] [blame] | 564 | goto err; |
| 565 | |
Jeff Hansen | 2493928 | 2009-05-27 12:48:29 +0000 | [diff] [blame] | 566 | sc->debug.debugfs_debug = debugfs_create_file("debug", |
Jiri Slaby | 9d49e86 | 2009-06-28 23:25:28 +0200 | [diff] [blame] | 567 | S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc, &fops_debug); |
Jeff Hansen | 2493928 | 2009-05-27 12:48:29 +0000 | [diff] [blame] | 568 | if (!sc->debug.debugfs_debug) |
| 569 | goto err; |
| 570 | |
Jiri Slaby | 9d49e86 | 2009-06-28 23:25:28 +0200 | [diff] [blame] | 571 | sc->debug.debugfs_dma = debugfs_create_file("dma", S_IRUSR, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 572 | sc->debug.debugfs_phy, sc, &fops_dma); |
| 573 | if (!sc->debug.debugfs_dma) |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 574 | goto err; |
| 575 | |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 576 | sc->debug.debugfs_interrupt = debugfs_create_file("interrupt", |
Jiri Slaby | 9d49e86 | 2009-06-28 23:25:28 +0200 | [diff] [blame] | 577 | S_IRUSR, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 578 | sc->debug.debugfs_phy, |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 579 | sc, &fops_interrupt); |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 580 | if (!sc->debug.debugfs_interrupt) |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 581 | goto err; |
| 582 | |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 583 | sc->debug.debugfs_rcstat = debugfs_create_file("rcstat", |
Jiri Slaby | 9d49e86 | 2009-06-28 23:25:28 +0200 | [diff] [blame] | 584 | S_IRUSR, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 585 | sc->debug.debugfs_phy, |
Sujith | 7a7dec6 | 2009-01-30 14:32:09 +0530 | [diff] [blame] | 586 | sc, &fops_rcstat); |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 587 | if (!sc->debug.debugfs_rcstat) |
Sujith | 7a7dec6 | 2009-01-30 14:32:09 +0530 | [diff] [blame] | 588 | goto err; |
| 589 | |
Jouni Malinen | 39d89cd | 2009-03-03 19:23:40 +0200 | [diff] [blame] | 590 | sc->debug.debugfs_wiphy = debugfs_create_file( |
Jiri Slaby | 9d49e86 | 2009-06-28 23:25:28 +0200 | [diff] [blame] | 591 | "wiphy", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc, |
Jouni Malinen | 39d89cd | 2009-03-03 19:23:40 +0200 | [diff] [blame] | 592 | &fops_wiphy); |
| 593 | if (!sc->debug.debugfs_wiphy) |
| 594 | goto err; |
| 595 | |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 596 | sc->debug.debugfs_xmit = debugfs_create_file("xmit", |
| 597 | S_IRUSR, |
| 598 | sc->debug.debugfs_phy, |
| 599 | sc, &fops_xmit); |
| 600 | if (!sc->debug.debugfs_xmit) |
| 601 | goto err; |
| 602 | |
Sujith | 826d268 | 2008-11-28 22:20:23 +0530 | [diff] [blame] | 603 | return 0; |
| 604 | err: |
Luis R. Rodriguez | 4d6b228 | 2009-09-07 04:52:26 -0700 | [diff] [blame] | 605 | ath9k_exit_debug(ah); |
Sujith | 826d268 | 2008-11-28 22:20:23 +0530 | [diff] [blame] | 606 | return -ENOMEM; |
| 607 | } |
| 608 | |
Luis R. Rodriguez | 4d6b228 | 2009-09-07 04:52:26 -0700 | [diff] [blame] | 609 | void ath9k_exit_debug(struct ath_hw *ah) |
Sujith | 826d268 | 2008-11-28 22:20:23 +0530 | [diff] [blame] | 610 | { |
Luis R. Rodriguez | bc974f4 | 2009-09-28 02:54:40 -0400 | [diff] [blame] | 611 | struct ath_common *common = ath9k_hw_common(ah); |
| 612 | struct ath_softc *sc = (struct ath_softc *) common->priv; |
Luis R. Rodriguez | 4d6b228 | 2009-09-07 04:52:26 -0700 | [diff] [blame] | 613 | |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 614 | debugfs_remove(sc->debug.debugfs_xmit); |
Jouni Malinen | 39d89cd | 2009-03-03 19:23:40 +0200 | [diff] [blame] | 615 | debugfs_remove(sc->debug.debugfs_wiphy); |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 616 | debugfs_remove(sc->debug.debugfs_rcstat); |
| 617 | debugfs_remove(sc->debug.debugfs_interrupt); |
| 618 | debugfs_remove(sc->debug.debugfs_dma); |
Jeff Hansen | 2493928 | 2009-05-27 12:48:29 +0000 | [diff] [blame] | 619 | debugfs_remove(sc->debug.debugfs_debug); |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 620 | debugfs_remove(sc->debug.debugfs_phy); |
Gabor Juhos | 19d8bc2 | 2009-03-05 16:55:18 +0100 | [diff] [blame] | 621 | } |
| 622 | |
| 623 | int ath9k_debug_create_root(void) |
| 624 | { |
| 625 | ath9k_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL); |
| 626 | if (!ath9k_debugfs_root) |
| 627 | return -ENOENT; |
| 628 | |
| 629 | return 0; |
| 630 | } |
| 631 | |
| 632 | void ath9k_debug_remove_root(void) |
| 633 | { |
| 634 | debugfs_remove(ath9k_debugfs_root); |
| 635 | ath9k_debugfs_root = NULL; |
Sujith | 88b126a | 2008-11-28 22:19:02 +0530 | [diff] [blame] | 636 | } |