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