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 | |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 17 | #include <linux/slab.h> |
Gabor Juhos | 5210311 | 2009-03-06 09:57:39 +0100 | [diff] [blame] | 18 | #include <asm/unaligned.h> |
| 19 | |
Sujith | 394cf0a | 2009-02-09 13:26:54 +0530 | [diff] [blame] | 20 | #include "ath9k.h" |
Sujith | 88b126a | 2008-11-28 22:19:02 +0530 | [diff] [blame] | 21 | |
Luis R. Rodriguez | 475a6e4 | 2009-09-23 23:06:59 -0400 | [diff] [blame] | 22 | #define REG_WRITE_D(_ah, _reg, _val) \ |
| 23 | ath9k_hw_common(_ah)->ops->write((_ah), (_val), (_reg)) |
| 24 | #define REG_READ_D(_ah, _reg) \ |
| 25 | ath9k_hw_common(_ah)->ops->read((_ah), (_reg)) |
| 26 | |
Gabor Juhos | 19d8bc2 | 2009-03-05 16:55:18 +0100 | [diff] [blame] | 27 | static struct dentry *ath9k_debugfs_root; |
| 28 | |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 29 | static int ath9k_debugfs_open(struct inode *inode, struct file *file) |
| 30 | { |
| 31 | file->private_data = inode->i_private; |
| 32 | return 0; |
| 33 | } |
| 34 | |
Felix Fietkau | a830df0 | 2009-11-23 22:33:27 +0100 | [diff] [blame] | 35 | #ifdef CONFIG_ATH_DEBUG |
| 36 | |
Jeff Hansen | 2493928 | 2009-05-27 12:48:29 +0000 | [diff] [blame] | 37 | static ssize_t read_file_debug(struct file *file, char __user *user_buf, |
| 38 | size_t count, loff_t *ppos) |
| 39 | { |
| 40 | struct ath_softc *sc = file->private_data; |
Luis R. Rodriguez | c46917b | 2009-09-13 02:42:02 -0700 | [diff] [blame] | 41 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
Jeff Hansen | 2493928 | 2009-05-27 12:48:29 +0000 | [diff] [blame] | 42 | char buf[32]; |
Vasanthakumar Thiagarajan | 581f725 | 2009-06-02 19:28:55 +0530 | [diff] [blame] | 43 | unsigned int len; |
| 44 | |
Luis R. Rodriguez | c46917b | 2009-09-13 02:42:02 -0700 | [diff] [blame] | 45 | len = snprintf(buf, sizeof(buf), "0x%08x\n", common->debug_mask); |
Jeff Hansen | 2493928 | 2009-05-27 12:48:29 +0000 | [diff] [blame] | 46 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 47 | } |
| 48 | |
| 49 | static ssize_t write_file_debug(struct file *file, const char __user *user_buf, |
| 50 | size_t count, loff_t *ppos) |
| 51 | { |
| 52 | struct ath_softc *sc = file->private_data; |
Luis R. Rodriguez | c46917b | 2009-09-13 02:42:02 -0700 | [diff] [blame] | 53 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
Jeff Hansen | 2493928 | 2009-05-27 12:48:29 +0000 | [diff] [blame] | 54 | unsigned long mask; |
| 55 | char buf[32]; |
Vasanthakumar Thiagarajan | 581f725 | 2009-06-02 19:28:55 +0530 | [diff] [blame] | 56 | ssize_t len; |
| 57 | |
| 58 | len = min(count, sizeof(buf) - 1); |
| 59 | if (copy_from_user(buf, user_buf, len)) |
| 60 | return -EINVAL; |
| 61 | |
| 62 | buf[len] = '\0'; |
| 63 | if (strict_strtoul(buf, 0, &mask)) |
| 64 | return -EINVAL; |
| 65 | |
Luis R. Rodriguez | c46917b | 2009-09-13 02:42:02 -0700 | [diff] [blame] | 66 | common->debug_mask = mask; |
Jeff Hansen | 2493928 | 2009-05-27 12:48:29 +0000 | [diff] [blame] | 67 | return count; |
| 68 | } |
| 69 | |
| 70 | static const struct file_operations fops_debug = { |
| 71 | .read = read_file_debug, |
| 72 | .write = write_file_debug, |
| 73 | .open = ath9k_debugfs_open, |
| 74 | .owner = THIS_MODULE |
| 75 | }; |
| 76 | |
Felix Fietkau | a830df0 | 2009-11-23 22:33:27 +0100 | [diff] [blame] | 77 | #endif |
| 78 | |
Pavel Roskin | 991a098 | 2010-01-29 17:22:26 -0500 | [diff] [blame] | 79 | #define DMA_BUF_LEN 1024 |
| 80 | |
Felix Fietkau | 1534069 | 2010-05-11 17:23:01 +0200 | [diff] [blame] | 81 | static ssize_t read_file_tx_chainmask(struct file *file, char __user *user_buf, |
| 82 | size_t count, loff_t *ppos) |
| 83 | { |
| 84 | struct ath_softc *sc = file->private_data; |
| 85 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
| 86 | char buf[32]; |
| 87 | unsigned int len; |
| 88 | |
| 89 | len = snprintf(buf, sizeof(buf), "0x%08x\n", common->tx_chainmask); |
| 90 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 91 | } |
| 92 | |
| 93 | static ssize_t write_file_tx_chainmask(struct file *file, const char __user *user_buf, |
| 94 | size_t count, loff_t *ppos) |
| 95 | { |
| 96 | struct ath_softc *sc = file->private_data; |
| 97 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
| 98 | unsigned long mask; |
| 99 | char buf[32]; |
| 100 | ssize_t len; |
| 101 | |
| 102 | len = min(count, sizeof(buf) - 1); |
| 103 | if (copy_from_user(buf, user_buf, len)) |
| 104 | return -EINVAL; |
| 105 | |
| 106 | buf[len] = '\0'; |
| 107 | if (strict_strtoul(buf, 0, &mask)) |
| 108 | return -EINVAL; |
| 109 | |
| 110 | common->tx_chainmask = mask; |
| 111 | sc->sc_ah->caps.tx_chainmask = mask; |
| 112 | return count; |
| 113 | } |
| 114 | |
| 115 | static const struct file_operations fops_tx_chainmask = { |
| 116 | .read = read_file_tx_chainmask, |
| 117 | .write = write_file_tx_chainmask, |
| 118 | .open = ath9k_debugfs_open, |
| 119 | .owner = THIS_MODULE |
| 120 | }; |
| 121 | |
| 122 | |
| 123 | static ssize_t read_file_rx_chainmask(struct file *file, char __user *user_buf, |
| 124 | size_t count, loff_t *ppos) |
| 125 | { |
| 126 | struct ath_softc *sc = file->private_data; |
| 127 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
| 128 | char buf[32]; |
| 129 | unsigned int len; |
| 130 | |
| 131 | len = snprintf(buf, sizeof(buf), "0x%08x\n", common->rx_chainmask); |
| 132 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 133 | } |
| 134 | |
| 135 | static ssize_t write_file_rx_chainmask(struct file *file, const char __user *user_buf, |
| 136 | size_t count, loff_t *ppos) |
| 137 | { |
| 138 | struct ath_softc *sc = file->private_data; |
| 139 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
| 140 | unsigned long mask; |
| 141 | char buf[32]; |
| 142 | ssize_t len; |
| 143 | |
| 144 | len = min(count, sizeof(buf) - 1); |
| 145 | if (copy_from_user(buf, user_buf, len)) |
| 146 | return -EINVAL; |
| 147 | |
| 148 | buf[len] = '\0'; |
| 149 | if (strict_strtoul(buf, 0, &mask)) |
| 150 | return -EINVAL; |
| 151 | |
| 152 | common->rx_chainmask = mask; |
| 153 | sc->sc_ah->caps.rx_chainmask = mask; |
| 154 | return count; |
| 155 | } |
| 156 | |
| 157 | static const struct file_operations fops_rx_chainmask = { |
| 158 | .read = read_file_rx_chainmask, |
| 159 | .write = write_file_rx_chainmask, |
| 160 | .open = ath9k_debugfs_open, |
| 161 | .owner = THIS_MODULE |
| 162 | }; |
| 163 | |
| 164 | |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 165 | static ssize_t read_file_dma(struct file *file, char __user *user_buf, |
| 166 | size_t count, loff_t *ppos) |
| 167 | { |
| 168 | struct ath_softc *sc = file->private_data; |
Sujith | cbe61d8 | 2009-02-09 13:27:12 +0530 | [diff] [blame] | 169 | struct ath_hw *ah = sc->sc_ah; |
Pavel Roskin | 991a098 | 2010-01-29 17:22:26 -0500 | [diff] [blame] | 170 | char *buf; |
| 171 | int retval; |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 172 | unsigned int len = 0; |
| 173 | u32 val[ATH9K_NUM_DMA_DEBUG_REGS]; |
| 174 | int i, qcuOffset = 0, dcuOffset = 0; |
| 175 | u32 *qcuBase = &val[0], *dcuBase = &val[4]; |
| 176 | |
Pavel Roskin | 991a098 | 2010-01-29 17:22:26 -0500 | [diff] [blame] | 177 | buf = kmalloc(DMA_BUF_LEN, GFP_KERNEL); |
| 178 | if (!buf) |
| 179 | return 0; |
| 180 | |
Sujith | 7cf4a2e | 2009-08-26 11:11:57 +0530 | [diff] [blame] | 181 | ath9k_ps_wakeup(sc); |
| 182 | |
Luis R. Rodriguez | 475a6e4 | 2009-09-23 23:06:59 -0400 | [diff] [blame] | 183 | REG_WRITE_D(ah, AR_MACMISC, |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 184 | ((AR_MACMISC_DMA_OBS_LINE_8 << AR_MACMISC_DMA_OBS_S) | |
| 185 | (AR_MACMISC_MISC_OBS_BUS_1 << |
| 186 | AR_MACMISC_MISC_OBS_BUS_MSB_S))); |
| 187 | |
Pavel Roskin | 991a098 | 2010-01-29 17:22:26 -0500 | [diff] [blame] | 188 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 189 | "Raw DMA Debug values:\n"); |
| 190 | |
| 191 | for (i = 0; i < ATH9K_NUM_DMA_DEBUG_REGS; i++) { |
| 192 | if (i % 4 == 0) |
Pavel Roskin | 991a098 | 2010-01-29 17:22:26 -0500 | [diff] [blame] | 193 | len += snprintf(buf + len, DMA_BUF_LEN - len, "\n"); |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 194 | |
Luis R. Rodriguez | 475a6e4 | 2009-09-23 23:06:59 -0400 | [diff] [blame] | 195 | val[i] = REG_READ_D(ah, AR_DMADBG_0 + (i * sizeof(u32))); |
Pavel Roskin | 991a098 | 2010-01-29 17:22:26 -0500 | [diff] [blame] | 196 | len += snprintf(buf + len, DMA_BUF_LEN - len, "%d: %08x ", |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 197 | i, val[i]); |
| 198 | } |
| 199 | |
Pavel Roskin | 991a098 | 2010-01-29 17:22:26 -0500 | [diff] [blame] | 200 | len += snprintf(buf + len, DMA_BUF_LEN - len, "\n\n"); |
| 201 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 202 | "Num QCU: chain_st fsp_ok fsp_st DCU: chain_st\n"); |
| 203 | |
| 204 | for (i = 0; i < ATH9K_NUM_QUEUES; i++, qcuOffset += 4, dcuOffset += 5) { |
| 205 | if (i == 8) { |
| 206 | qcuOffset = 0; |
| 207 | qcuBase++; |
| 208 | } |
| 209 | |
| 210 | if (i == 6) { |
| 211 | dcuOffset = 0; |
| 212 | dcuBase++; |
| 213 | } |
| 214 | |
Pavel Roskin | 991a098 | 2010-01-29 17:22:26 -0500 | [diff] [blame] | 215 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 216 | "%2d %2x %1x %2x %2x\n", |
| 217 | i, (*qcuBase & (0x7 << qcuOffset)) >> qcuOffset, |
| 218 | (*qcuBase & (0x8 << qcuOffset)) >> (qcuOffset + 3), |
| 219 | val[2] & (0x7 << (i * 3)) >> (i * 3), |
| 220 | (*dcuBase & (0x1f << dcuOffset)) >> dcuOffset); |
| 221 | } |
| 222 | |
Pavel Roskin | 991a098 | 2010-01-29 17:22:26 -0500 | [diff] [blame] | 223 | len += snprintf(buf + len, DMA_BUF_LEN - len, "\n"); |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 224 | |
Pavel Roskin | 991a098 | 2010-01-29 17:22:26 -0500 | [diff] [blame] | 225 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 226 | "qcu_stitch state: %2x qcu_fetch state: %2x\n", |
| 227 | (val[3] & 0x003c0000) >> 18, (val[3] & 0x03c00000) >> 22); |
Pavel Roskin | 991a098 | 2010-01-29 17:22:26 -0500 | [diff] [blame] | 228 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 229 | "qcu_complete state: %2x dcu_complete state: %2x\n", |
| 230 | (val[3] & 0x1c000000) >> 26, (val[6] & 0x3)); |
Pavel Roskin | 991a098 | 2010-01-29 17:22:26 -0500 | [diff] [blame] | 231 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 232 | "dcu_arb state: %2x dcu_fp state: %2x\n", |
| 233 | (val[5] & 0x06000000) >> 25, (val[5] & 0x38000000) >> 27); |
Pavel Roskin | 991a098 | 2010-01-29 17:22:26 -0500 | [diff] [blame] | 234 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 235 | "chan_idle_dur: %3d chan_idle_dur_valid: %1d\n", |
| 236 | (val[6] & 0x000003fc) >> 2, (val[6] & 0x00000400) >> 10); |
Pavel Roskin | 991a098 | 2010-01-29 17:22:26 -0500 | [diff] [blame] | 237 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 238 | "txfifo_valid_0: %1d txfifo_valid_1: %1d\n", |
| 239 | (val[6] & 0x00000800) >> 11, (val[6] & 0x00001000) >> 12); |
Pavel Roskin | 991a098 | 2010-01-29 17:22:26 -0500 | [diff] [blame] | 240 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 241 | "txfifo_dcu_num_0: %2d txfifo_dcu_num_1: %2d\n", |
| 242 | (val[6] & 0x0001e000) >> 13, (val[6] & 0x001e0000) >> 17); |
| 243 | |
Frans Pop | 60ece40 | 2010-03-24 19:46:30 +0100 | [diff] [blame] | 244 | len += snprintf(buf + len, DMA_BUF_LEN - len, "pcu observe: 0x%x\n", |
Luis R. Rodriguez | 475a6e4 | 2009-09-23 23:06:59 -0400 | [diff] [blame] | 245 | REG_READ_D(ah, AR_OBS_BUS_1)); |
Pavel Roskin | 991a098 | 2010-01-29 17:22:26 -0500 | [diff] [blame] | 246 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
Frans Pop | 60ece40 | 2010-03-24 19:46:30 +0100 | [diff] [blame] | 247 | "AR_CR: 0x%x\n", REG_READ_D(ah, AR_CR)); |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 248 | |
Sujith | 7cf4a2e | 2009-08-26 11:11:57 +0530 | [diff] [blame] | 249 | ath9k_ps_restore(sc); |
| 250 | |
Pavel Roskin | 991a098 | 2010-01-29 17:22:26 -0500 | [diff] [blame] | 251 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 252 | kfree(buf); |
| 253 | return retval; |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 254 | } |
| 255 | |
| 256 | static const struct file_operations fops_dma = { |
| 257 | .read = read_file_dma, |
| 258 | .open = ath9k_debugfs_open, |
| 259 | .owner = THIS_MODULE |
| 260 | }; |
| 261 | |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 262 | |
| 263 | void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status) |
| 264 | { |
| 265 | if (status) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 266 | sc->debug.stats.istats.total++; |
Luis R. Rodriguez | a9616f4 | 2010-04-15 17:39:30 -0400 | [diff] [blame] | 267 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { |
| 268 | if (status & ATH9K_INT_RXLP) |
| 269 | sc->debug.stats.istats.rxlp++; |
| 270 | if (status & ATH9K_INT_RXHP) |
| 271 | sc->debug.stats.istats.rxhp++; |
| 272 | } else { |
| 273 | if (status & ATH9K_INT_RX) |
| 274 | sc->debug.stats.istats.rxok++; |
| 275 | } |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 276 | if (status & ATH9K_INT_RXEOL) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 277 | sc->debug.stats.istats.rxeol++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 278 | if (status & ATH9K_INT_RXORN) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 279 | sc->debug.stats.istats.rxorn++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 280 | if (status & ATH9K_INT_TX) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 281 | sc->debug.stats.istats.txok++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 282 | if (status & ATH9K_INT_TXURN) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 283 | sc->debug.stats.istats.txurn++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 284 | if (status & ATH9K_INT_MIB) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 285 | sc->debug.stats.istats.mib++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 286 | if (status & ATH9K_INT_RXPHY) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 287 | sc->debug.stats.istats.rxphyerr++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 288 | if (status & ATH9K_INT_RXKCM) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 289 | sc->debug.stats.istats.rx_keycache_miss++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 290 | if (status & ATH9K_INT_SWBA) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 291 | sc->debug.stats.istats.swba++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 292 | if (status & ATH9K_INT_BMISS) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 293 | sc->debug.stats.istats.bmiss++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 294 | if (status & ATH9K_INT_BNR) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 295 | sc->debug.stats.istats.bnr++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 296 | if (status & ATH9K_INT_CST) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 297 | sc->debug.stats.istats.cst++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 298 | if (status & ATH9K_INT_GTT) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 299 | sc->debug.stats.istats.gtt++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 300 | if (status & ATH9K_INT_TIM) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 301 | sc->debug.stats.istats.tim++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 302 | if (status & ATH9K_INT_CABEND) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 303 | sc->debug.stats.istats.cabend++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 304 | if (status & ATH9K_INT_DTIMSYNC) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 305 | sc->debug.stats.istats.dtimsync++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 306 | if (status & ATH9K_INT_DTIM) |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 307 | sc->debug.stats.istats.dtim++; |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 308 | } |
| 309 | |
| 310 | static ssize_t read_file_interrupt(struct file *file, char __user *user_buf, |
| 311 | size_t count, loff_t *ppos) |
| 312 | { |
| 313 | struct ath_softc *sc = file->private_data; |
| 314 | char buf[512]; |
| 315 | unsigned int len = 0; |
| 316 | |
Luis R. Rodriguez | a9616f4 | 2010-04-15 17:39:30 -0400 | [diff] [blame] | 317 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { |
| 318 | len += snprintf(buf + len, sizeof(buf) - len, |
| 319 | "%8s: %10u\n", "RXLP", sc->debug.stats.istats.rxlp); |
| 320 | len += snprintf(buf + len, sizeof(buf) - len, |
| 321 | "%8s: %10u\n", "RXHP", sc->debug.stats.istats.rxhp); |
| 322 | } else { |
| 323 | len += snprintf(buf + len, sizeof(buf) - len, |
| 324 | "%8s: %10u\n", "RX", sc->debug.stats.istats.rxok); |
| 325 | } |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 326 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 327 | "%8s: %10u\n", "RXEOL", sc->debug.stats.istats.rxeol); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 328 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 329 | "%8s: %10u\n", "RXORN", sc->debug.stats.istats.rxorn); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 330 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 331 | "%8s: %10u\n", "TX", sc->debug.stats.istats.txok); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 332 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 333 | "%8s: %10u\n", "TXURN", sc->debug.stats.istats.txurn); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 334 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 335 | "%8s: %10u\n", "MIB", sc->debug.stats.istats.mib); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 336 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 337 | "%8s: %10u\n", "RXPHY", sc->debug.stats.istats.rxphyerr); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 338 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 339 | "%8s: %10u\n", "RXKCM", sc->debug.stats.istats.rx_keycache_miss); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 340 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 341 | "%8s: %10u\n", "SWBA", sc->debug.stats.istats.swba); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 342 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 343 | "%8s: %10u\n", "BMISS", sc->debug.stats.istats.bmiss); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 344 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 345 | "%8s: %10u\n", "BNR", sc->debug.stats.istats.bnr); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 346 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 347 | "%8s: %10u\n", "CST", sc->debug.stats.istats.cst); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 348 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 349 | "%8s: %10u\n", "GTT", sc->debug.stats.istats.gtt); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 350 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 351 | "%8s: %10u\n", "TIM", sc->debug.stats.istats.tim); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 352 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 353 | "%8s: %10u\n", "CABEND", sc->debug.stats.istats.cabend); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 354 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 355 | "%8s: %10u\n", "DTIMSYNC", sc->debug.stats.istats.dtimsync); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 356 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 357 | "%8s: %10u\n", "DTIM", sc->debug.stats.istats.dtim); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 358 | len += snprintf(buf + len, sizeof(buf) - len, |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 359 | "%8s: %10u\n", "TOTAL", sc->debug.stats.istats.total); |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 360 | |
| 361 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 362 | } |
| 363 | |
| 364 | static const struct file_operations fops_interrupt = { |
| 365 | .read = read_file_interrupt, |
| 366 | .open = ath9k_debugfs_open, |
| 367 | .owner = THIS_MODULE |
| 368 | }; |
| 369 | |
Felix Fietkau | 545750d | 2009-11-23 22:21:01 +0100 | [diff] [blame] | 370 | void ath_debug_stat_rc(struct ath_softc *sc, int final_rate) |
Sujith | 7a7dec6 | 2009-01-30 14:32:09 +0530 | [diff] [blame] | 371 | { |
Jeff Hansen | bedf087 | 2009-05-27 12:48:28 +0000 | [diff] [blame] | 372 | struct ath_rc_stats *stats; |
Sujith | 7a7dec6 | 2009-01-30 14:32:09 +0530 | [diff] [blame] | 373 | |
Felix Fietkau | 545750d | 2009-11-23 22:21:01 +0100 | [diff] [blame] | 374 | stats = &sc->debug.stats.rcstats[final_rate]; |
Jeff Hansen | bedf087 | 2009-05-27 12:48:28 +0000 | [diff] [blame] | 375 | stats->success++; |
Sujith | 7a7dec6 | 2009-01-30 14:32:09 +0530 | [diff] [blame] | 376 | } |
| 377 | |
Sujith | 029bc43 | 2009-02-04 08:10:26 +0530 | [diff] [blame] | 378 | void ath_debug_stat_retries(struct ath_softc *sc, int rix, |
Sujith | 9e71279 | 2009-02-20 15:13:20 +0530 | [diff] [blame] | 379 | int xretries, int retries, u8 per) |
Sujith | 029bc43 | 2009-02-04 08:10:26 +0530 | [diff] [blame] | 380 | { |
Jeff Hansen | bedf087 | 2009-05-27 12:48:28 +0000 | [diff] [blame] | 381 | struct ath_rc_stats *stats = &sc->debug.stats.rcstats[rix]; |
Sujith | 029bc43 | 2009-02-04 08:10:26 +0530 | [diff] [blame] | 382 | |
Jeff Hansen | bedf087 | 2009-05-27 12:48:28 +0000 | [diff] [blame] | 383 | stats->xretries += xretries; |
| 384 | stats->retries += retries; |
| 385 | stats->per = per; |
Sujith | 7a7dec6 | 2009-01-30 14:32:09 +0530 | [diff] [blame] | 386 | } |
| 387 | |
| 388 | static ssize_t read_file_rcstat(struct file *file, char __user *user_buf, |
| 389 | size_t count, loff_t *ppos) |
| 390 | { |
| 391 | struct ath_softc *sc = file->private_data; |
Jeff Hansen | bedf087 | 2009-05-27 12:48:28 +0000 | [diff] [blame] | 392 | char *buf; |
| 393 | unsigned int len = 0, max; |
| 394 | int i = 0; |
| 395 | ssize_t retval; |
Sujith | 7a7dec6 | 2009-01-30 14:32:09 +0530 | [diff] [blame] | 396 | |
Sujith | 62b4fb6 | 2009-03-09 09:32:01 +0530 | [diff] [blame] | 397 | if (sc->cur_rate_table == NULL) |
| 398 | return 0; |
| 399 | |
Luis R. Rodriguez | c755ad3 | 2009-12-07 12:38:41 -0500 | [diff] [blame] | 400 | max = 80 + sc->cur_rate_table->rate_cnt * 1024; |
Jeff Hansen | bedf087 | 2009-05-27 12:48:28 +0000 | [diff] [blame] | 401 | buf = kmalloc(max + 1, GFP_KERNEL); |
| 402 | if (buf == NULL) |
| 403 | return 0; |
| 404 | buf[max] = 0; |
| 405 | |
Luis R. Rodriguez | c755ad3 | 2009-12-07 12:38:41 -0500 | [diff] [blame] | 406 | len += sprintf(buf, "%6s %6s %6s " |
| 407 | "%10s %10s %10s %10s\n", |
| 408 | "HT", "MCS", "Rate", |
| 409 | "Success", "Retries", "XRetries", "PER"); |
Jeff Hansen | bedf087 | 2009-05-27 12:48:28 +0000 | [diff] [blame] | 410 | |
| 411 | for (i = 0; i < sc->cur_rate_table->rate_cnt; i++) { |
| 412 | u32 ratekbps = sc->cur_rate_table->info[i].ratekbps; |
| 413 | struct ath_rc_stats *stats = &sc->debug.stats.rcstats[i]; |
Luis R. Rodriguez | c755ad3 | 2009-12-07 12:38:41 -0500 | [diff] [blame] | 414 | char mcs[5]; |
| 415 | char htmode[5]; |
| 416 | int used_mcs = 0, used_htmode = 0; |
| 417 | |
| 418 | if (WLAN_RC_PHY_HT(sc->cur_rate_table->info[i].phy)) { |
| 419 | used_mcs = snprintf(mcs, 5, "%d", |
| 420 | sc->cur_rate_table->info[i].ratecode); |
| 421 | |
| 422 | if (WLAN_RC_PHY_40(sc->cur_rate_table->info[i].phy)) |
| 423 | used_htmode = snprintf(htmode, 5, "HT40"); |
| 424 | else if (WLAN_RC_PHY_20(sc->cur_rate_table->info[i].phy)) |
| 425 | used_htmode = snprintf(htmode, 5, "HT20"); |
| 426 | else |
| 427 | used_htmode = snprintf(htmode, 5, "????"); |
| 428 | } |
| 429 | |
| 430 | mcs[used_mcs] = '\0'; |
| 431 | htmode[used_htmode] = '\0'; |
Jeff Hansen | bedf087 | 2009-05-27 12:48:28 +0000 | [diff] [blame] | 432 | |
| 433 | len += snprintf(buf + len, max - len, |
Luis R. Rodriguez | c755ad3 | 2009-12-07 12:38:41 -0500 | [diff] [blame] | 434 | "%6s %6s %3u.%d: " |
| 435 | "%10u %10u %10u %10u\n", |
| 436 | htmode, |
| 437 | mcs, |
| 438 | ratekbps / 1000, |
| 439 | (ratekbps % 1000) / 100, |
| 440 | stats->success, |
| 441 | stats->retries, |
| 442 | stats->xretries, |
Jeff Hansen | bedf087 | 2009-05-27 12:48:28 +0000 | [diff] [blame] | 443 | stats->per); |
| 444 | } |
| 445 | |
| 446 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 447 | kfree(buf); |
| 448 | return retval; |
Sujith | 7a7dec6 | 2009-01-30 14:32:09 +0530 | [diff] [blame] | 449 | } |
| 450 | |
| 451 | static const struct file_operations fops_rcstat = { |
| 452 | .read = read_file_rcstat, |
| 453 | .open = ath9k_debugfs_open, |
| 454 | .owner = THIS_MODULE |
| 455 | }; |
Alina Friedrichsen | 27abe06 | 2009-01-23 05:44:21 +0100 | [diff] [blame] | 456 | |
Jouni Malinen | 39d89cd | 2009-03-03 19:23:40 +0200 | [diff] [blame] | 457 | static const char * ath_wiphy_state_str(enum ath_wiphy_state state) |
| 458 | { |
| 459 | switch (state) { |
| 460 | case ATH_WIPHY_INACTIVE: |
| 461 | return "INACTIVE"; |
| 462 | case ATH_WIPHY_ACTIVE: |
| 463 | return "ACTIVE"; |
| 464 | case ATH_WIPHY_PAUSING: |
| 465 | return "PAUSING"; |
| 466 | case ATH_WIPHY_PAUSED: |
| 467 | return "PAUSED"; |
| 468 | case ATH_WIPHY_SCAN: |
| 469 | return "SCAN"; |
| 470 | } |
| 471 | return "?"; |
| 472 | } |
| 473 | |
| 474 | static ssize_t read_file_wiphy(struct file *file, char __user *user_buf, |
| 475 | size_t count, loff_t *ppos) |
| 476 | { |
| 477 | struct ath_softc *sc = file->private_data; |
| 478 | char buf[512]; |
| 479 | unsigned int len = 0; |
| 480 | int i; |
| 481 | u8 addr[ETH_ALEN]; |
| 482 | |
| 483 | len += snprintf(buf + len, sizeof(buf) - len, |
| 484 | "primary: %s (%s chan=%d ht=%d)\n", |
| 485 | wiphy_name(sc->pri_wiphy->hw->wiphy), |
| 486 | ath_wiphy_state_str(sc->pri_wiphy->state), |
| 487 | sc->pri_wiphy->chan_idx, sc->pri_wiphy->chan_is_ht); |
| 488 | for (i = 0; i < sc->num_sec_wiphy; i++) { |
| 489 | struct ath_wiphy *aphy = sc->sec_wiphy[i]; |
| 490 | if (aphy == NULL) |
| 491 | continue; |
| 492 | len += snprintf(buf + len, sizeof(buf) - len, |
| 493 | "secondary: %s (%s chan=%d ht=%d)\n", |
| 494 | wiphy_name(aphy->hw->wiphy), |
| 495 | ath_wiphy_state_str(aphy->state), |
| 496 | aphy->chan_idx, aphy->chan_is_ht); |
| 497 | } |
| 498 | |
Luis R. Rodriguez | 475a6e4 | 2009-09-23 23:06:59 -0400 | [diff] [blame] | 499 | put_unaligned_le32(REG_READ_D(sc->sc_ah, AR_STA_ID0), addr); |
| 500 | 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] | 501 | len += snprintf(buf + len, sizeof(buf) - len, |
| 502 | "addr: %pM\n", addr); |
Luis R. Rodriguez | 475a6e4 | 2009-09-23 23:06:59 -0400 | [diff] [blame] | 503 | put_unaligned_le32(REG_READ_D(sc->sc_ah, AR_BSSMSKL), addr); |
| 504 | 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] | 505 | len += snprintf(buf + len, sizeof(buf) - len, |
| 506 | "addrmask: %pM\n", addr); |
| 507 | |
| 508 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 509 | } |
| 510 | |
| 511 | static struct ath_wiphy * get_wiphy(struct ath_softc *sc, const char *name) |
| 512 | { |
| 513 | int i; |
| 514 | if (strcmp(name, wiphy_name(sc->pri_wiphy->hw->wiphy)) == 0) |
| 515 | return sc->pri_wiphy; |
| 516 | for (i = 0; i < sc->num_sec_wiphy; i++) { |
| 517 | struct ath_wiphy *aphy = sc->sec_wiphy[i]; |
| 518 | if (aphy && strcmp(name, wiphy_name(aphy->hw->wiphy)) == 0) |
| 519 | return aphy; |
| 520 | } |
| 521 | return NULL; |
| 522 | } |
| 523 | |
| 524 | static int del_wiphy(struct ath_softc *sc, const char *name) |
| 525 | { |
| 526 | struct ath_wiphy *aphy = get_wiphy(sc, name); |
| 527 | if (!aphy) |
| 528 | return -ENOENT; |
| 529 | return ath9k_wiphy_del(aphy); |
| 530 | } |
| 531 | |
| 532 | static int pause_wiphy(struct ath_softc *sc, const char *name) |
| 533 | { |
| 534 | struct ath_wiphy *aphy = get_wiphy(sc, name); |
| 535 | if (!aphy) |
| 536 | return -ENOENT; |
| 537 | return ath9k_wiphy_pause(aphy); |
| 538 | } |
| 539 | |
| 540 | static int unpause_wiphy(struct ath_softc *sc, const char *name) |
| 541 | { |
| 542 | struct ath_wiphy *aphy = get_wiphy(sc, name); |
| 543 | if (!aphy) |
| 544 | return -ENOENT; |
| 545 | return ath9k_wiphy_unpause(aphy); |
| 546 | } |
| 547 | |
| 548 | static int select_wiphy(struct ath_softc *sc, const char *name) |
| 549 | { |
| 550 | struct ath_wiphy *aphy = get_wiphy(sc, name); |
| 551 | if (!aphy) |
| 552 | return -ENOENT; |
| 553 | return ath9k_wiphy_select(aphy); |
| 554 | } |
| 555 | |
| 556 | static int schedule_wiphy(struct ath_softc *sc, const char *msec) |
| 557 | { |
| 558 | ath9k_wiphy_set_scheduler(sc, simple_strtoul(msec, NULL, 0)); |
| 559 | return 0; |
| 560 | } |
| 561 | |
| 562 | static ssize_t write_file_wiphy(struct file *file, const char __user *user_buf, |
| 563 | size_t count, loff_t *ppos) |
| 564 | { |
| 565 | struct ath_softc *sc = file->private_data; |
| 566 | char buf[50]; |
| 567 | size_t len; |
| 568 | |
| 569 | len = min(count, sizeof(buf) - 1); |
| 570 | if (copy_from_user(buf, user_buf, len)) |
| 571 | return -EFAULT; |
| 572 | buf[len] = '\0'; |
| 573 | if (len > 0 && buf[len - 1] == '\n') |
| 574 | buf[len - 1] = '\0'; |
| 575 | |
| 576 | if (strncmp(buf, "add", 3) == 0) { |
| 577 | int res = ath9k_wiphy_add(sc); |
| 578 | if (res < 0) |
| 579 | return res; |
| 580 | } else if (strncmp(buf, "del=", 4) == 0) { |
| 581 | int res = del_wiphy(sc, buf + 4); |
| 582 | if (res < 0) |
| 583 | return res; |
| 584 | } else if (strncmp(buf, "pause=", 6) == 0) { |
| 585 | int res = pause_wiphy(sc, buf + 6); |
| 586 | if (res < 0) |
| 587 | return res; |
| 588 | } else if (strncmp(buf, "unpause=", 8) == 0) { |
| 589 | int res = unpause_wiphy(sc, buf + 8); |
| 590 | if (res < 0) |
| 591 | return res; |
| 592 | } else if (strncmp(buf, "select=", 7) == 0) { |
| 593 | int res = select_wiphy(sc, buf + 7); |
| 594 | if (res < 0) |
| 595 | return res; |
| 596 | } else if (strncmp(buf, "schedule=", 9) == 0) { |
| 597 | int res = schedule_wiphy(sc, buf + 9); |
| 598 | if (res < 0) |
| 599 | return res; |
| 600 | } else |
| 601 | return -EOPNOTSUPP; |
| 602 | |
| 603 | return count; |
| 604 | } |
| 605 | |
| 606 | static const struct file_operations fops_wiphy = { |
| 607 | .read = read_file_wiphy, |
| 608 | .write = write_file_wiphy, |
| 609 | .open = ath9k_debugfs_open, |
| 610 | .owner = THIS_MODULE |
| 611 | }; |
| 612 | |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 613 | #define PR(str, elem) \ |
| 614 | do { \ |
| 615 | len += snprintf(buf + len, size - len, \ |
| 616 | "%s%13u%11u%10u%10u\n", str, \ |
| 617 | sc->debug.stats.txstats[sc->tx.hwq_map[ATH9K_WME_AC_BE]].elem, \ |
| 618 | sc->debug.stats.txstats[sc->tx.hwq_map[ATH9K_WME_AC_BK]].elem, \ |
| 619 | sc->debug.stats.txstats[sc->tx.hwq_map[ATH9K_WME_AC_VI]].elem, \ |
| 620 | sc->debug.stats.txstats[sc->tx.hwq_map[ATH9K_WME_AC_VO]].elem); \ |
| 621 | } while(0) |
| 622 | |
| 623 | static ssize_t read_file_xmit(struct file *file, char __user *user_buf, |
| 624 | size_t count, loff_t *ppos) |
| 625 | { |
| 626 | struct ath_softc *sc = file->private_data; |
| 627 | char *buf; |
| 628 | unsigned int len = 0, size = 2048; |
| 629 | ssize_t retval = 0; |
| 630 | |
| 631 | buf = kzalloc(size, GFP_KERNEL); |
| 632 | if (buf == NULL) |
| 633 | return 0; |
| 634 | |
| 635 | len += sprintf(buf, "%30s %10s%10s%10s\n\n", "BE", "BK", "VI", "VO"); |
| 636 | |
| 637 | PR("MPDUs Queued: ", queued); |
| 638 | PR("MPDUs Completed: ", completed); |
| 639 | PR("Aggregates: ", a_aggr); |
| 640 | PR("AMPDUs Queued: ", a_queued); |
| 641 | PR("AMPDUs Completed:", a_completed); |
| 642 | PR("AMPDUs Retried: ", a_retries); |
| 643 | PR("AMPDUs XRetried: ", a_xretries); |
| 644 | PR("FIFO Underrun: ", fifo_underrun); |
| 645 | PR("TXOP Exceeded: ", xtxop); |
| 646 | PR("TXTIMER Expiry: ", timer_exp); |
| 647 | PR("DESC CFG Error: ", desc_cfg_err); |
| 648 | PR("DATA Underrun: ", data_underrun); |
| 649 | PR("DELIM Underrun: ", delim_underrun); |
| 650 | |
| 651 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 652 | kfree(buf); |
| 653 | |
| 654 | return retval; |
| 655 | } |
| 656 | |
| 657 | void ath_debug_stat_tx(struct ath_softc *sc, struct ath_txq *txq, |
Felix Fietkau | db1a052 | 2010-03-29 20:07:11 -0700 | [diff] [blame] | 658 | struct ath_buf *bf, struct ath_tx_status *ts) |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 659 | { |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 660 | if (bf_isampdu(bf)) { |
| 661 | if (bf_isxretried(bf)) |
| 662 | TX_STAT_INC(txq->axq_qnum, a_xretries); |
| 663 | else |
| 664 | TX_STAT_INC(txq->axq_qnum, a_completed); |
| 665 | } else { |
| 666 | TX_STAT_INC(txq->axq_qnum, completed); |
| 667 | } |
| 668 | |
Felix Fietkau | db1a052 | 2010-03-29 20:07:11 -0700 | [diff] [blame] | 669 | if (ts->ts_status & ATH9K_TXERR_FIFO) |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 670 | TX_STAT_INC(txq->axq_qnum, fifo_underrun); |
Felix Fietkau | db1a052 | 2010-03-29 20:07:11 -0700 | [diff] [blame] | 671 | if (ts->ts_status & ATH9K_TXERR_XTXOP) |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 672 | TX_STAT_INC(txq->axq_qnum, xtxop); |
Felix Fietkau | db1a052 | 2010-03-29 20:07:11 -0700 | [diff] [blame] | 673 | if (ts->ts_status & ATH9K_TXERR_TIMER_EXPIRED) |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 674 | TX_STAT_INC(txq->axq_qnum, timer_exp); |
Felix Fietkau | db1a052 | 2010-03-29 20:07:11 -0700 | [diff] [blame] | 675 | if (ts->ts_flags & ATH9K_TX_DESC_CFG_ERR) |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 676 | TX_STAT_INC(txq->axq_qnum, desc_cfg_err); |
Felix Fietkau | db1a052 | 2010-03-29 20:07:11 -0700 | [diff] [blame] | 677 | if (ts->ts_flags & ATH9K_TX_DATA_UNDERRUN) |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 678 | TX_STAT_INC(txq->axq_qnum, data_underrun); |
Felix Fietkau | db1a052 | 2010-03-29 20:07:11 -0700 | [diff] [blame] | 679 | if (ts->ts_flags & ATH9K_TX_DELIM_UNDERRUN) |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 680 | TX_STAT_INC(txq->axq_qnum, delim_underrun); |
| 681 | } |
| 682 | |
| 683 | static const struct file_operations fops_xmit = { |
| 684 | .read = read_file_xmit, |
| 685 | .open = ath9k_debugfs_open, |
| 686 | .owner = THIS_MODULE |
| 687 | }; |
Jouni Malinen | 39d89cd | 2009-03-03 19:23:40 +0200 | [diff] [blame] | 688 | |
Sujith | 1395d3f | 2010-01-08 10:36:11 +0530 | [diff] [blame] | 689 | static ssize_t read_file_recv(struct file *file, char __user *user_buf, |
| 690 | size_t count, loff_t *ppos) |
| 691 | { |
| 692 | #define PHY_ERR(s, p) \ |
| 693 | len += snprintf(buf + len, size - len, "%18s : %10u\n", s, \ |
| 694 | sc->debug.stats.rxstats.phy_err_stats[p]); |
| 695 | |
| 696 | struct ath_softc *sc = file->private_data; |
| 697 | char *buf; |
| 698 | unsigned int len = 0, size = 1152; |
| 699 | ssize_t retval = 0; |
| 700 | |
| 701 | buf = kzalloc(size, GFP_KERNEL); |
| 702 | if (buf == NULL) |
| 703 | return 0; |
| 704 | |
| 705 | len += snprintf(buf + len, size - len, |
| 706 | "%18s : %10u\n", "CRC ERR", |
| 707 | sc->debug.stats.rxstats.crc_err); |
| 708 | len += snprintf(buf + len, size - len, |
| 709 | "%18s : %10u\n", "DECRYPT CRC ERR", |
| 710 | sc->debug.stats.rxstats.decrypt_crc_err); |
| 711 | len += snprintf(buf + len, size - len, |
| 712 | "%18s : %10u\n", "PHY ERR", |
| 713 | sc->debug.stats.rxstats.phy_err); |
| 714 | len += snprintf(buf + len, size - len, |
| 715 | "%18s : %10u\n", "MIC ERR", |
| 716 | sc->debug.stats.rxstats.mic_err); |
| 717 | len += snprintf(buf + len, size - len, |
| 718 | "%18s : %10u\n", "PRE-DELIM CRC ERR", |
| 719 | sc->debug.stats.rxstats.pre_delim_crc_err); |
| 720 | len += snprintf(buf + len, size - len, |
| 721 | "%18s : %10u\n", "POST-DELIM CRC ERR", |
| 722 | sc->debug.stats.rxstats.post_delim_crc_err); |
| 723 | len += snprintf(buf + len, size - len, |
| 724 | "%18s : %10u\n", "DECRYPT BUSY ERR", |
| 725 | sc->debug.stats.rxstats.decrypt_busy_err); |
| 726 | |
| 727 | PHY_ERR("UNDERRUN", ATH9K_PHYERR_UNDERRUN); |
| 728 | PHY_ERR("TIMING", ATH9K_PHYERR_TIMING); |
| 729 | PHY_ERR("PARITY", ATH9K_PHYERR_PARITY); |
| 730 | PHY_ERR("RATE", ATH9K_PHYERR_RATE); |
| 731 | PHY_ERR("LENGTH", ATH9K_PHYERR_LENGTH); |
| 732 | PHY_ERR("RADAR", ATH9K_PHYERR_RADAR); |
| 733 | PHY_ERR("SERVICE", ATH9K_PHYERR_SERVICE); |
| 734 | PHY_ERR("TOR", ATH9K_PHYERR_TOR); |
| 735 | PHY_ERR("OFDM-TIMING", ATH9K_PHYERR_OFDM_TIMING); |
| 736 | PHY_ERR("OFDM-SIGNAL-PARITY", ATH9K_PHYERR_OFDM_SIGNAL_PARITY); |
| 737 | PHY_ERR("OFDM-RATE", ATH9K_PHYERR_OFDM_RATE_ILLEGAL); |
| 738 | PHY_ERR("OFDM-LENGTH", ATH9K_PHYERR_OFDM_LENGTH_ILLEGAL); |
| 739 | PHY_ERR("OFDM-POWER-DROP", ATH9K_PHYERR_OFDM_POWER_DROP); |
| 740 | PHY_ERR("OFDM-SERVICE", ATH9K_PHYERR_OFDM_SERVICE); |
| 741 | PHY_ERR("OFDM-RESTART", ATH9K_PHYERR_OFDM_RESTART); |
| 742 | PHY_ERR("FALSE-RADAR-EXT", ATH9K_PHYERR_FALSE_RADAR_EXT); |
| 743 | PHY_ERR("CCK-TIMING", ATH9K_PHYERR_CCK_TIMING); |
| 744 | PHY_ERR("CCK-HEADER-CRC", ATH9K_PHYERR_CCK_HEADER_CRC); |
| 745 | PHY_ERR("CCK-RATE", ATH9K_PHYERR_CCK_RATE_ILLEGAL); |
| 746 | PHY_ERR("CCK-SERVICE", ATH9K_PHYERR_CCK_SERVICE); |
| 747 | PHY_ERR("CCK-RESTART", ATH9K_PHYERR_CCK_RESTART); |
| 748 | PHY_ERR("CCK-LENGTH", ATH9K_PHYERR_CCK_LENGTH_ILLEGAL); |
| 749 | PHY_ERR("CCK-POWER-DROP", ATH9K_PHYERR_CCK_POWER_DROP); |
| 750 | PHY_ERR("HT-CRC", ATH9K_PHYERR_HT_CRC_ERROR); |
| 751 | PHY_ERR("HT-LENGTH", ATH9K_PHYERR_HT_LENGTH_ILLEGAL); |
| 752 | PHY_ERR("HT-RATE", ATH9K_PHYERR_HT_RATE_ILLEGAL); |
| 753 | |
| 754 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 755 | kfree(buf); |
| 756 | |
| 757 | return retval; |
| 758 | |
| 759 | #undef PHY_ERR |
| 760 | } |
| 761 | |
Felix Fietkau | 8e6f5aa | 2010-03-29 20:09:27 -0700 | [diff] [blame] | 762 | void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs) |
Sujith | 1395d3f | 2010-01-08 10:36:11 +0530 | [diff] [blame] | 763 | { |
| 764 | #define RX_STAT_INC(c) sc->debug.stats.rxstats.c++ |
| 765 | #define RX_PHY_ERR_INC(c) sc->debug.stats.rxstats.phy_err_stats[c]++ |
| 766 | |
Sujith | 1395d3f | 2010-01-08 10:36:11 +0530 | [diff] [blame] | 767 | u32 phyerr; |
| 768 | |
Felix Fietkau | 8e6f5aa | 2010-03-29 20:09:27 -0700 | [diff] [blame] | 769 | if (rs->rs_status & ATH9K_RXERR_CRC) |
Sujith | 1395d3f | 2010-01-08 10:36:11 +0530 | [diff] [blame] | 770 | RX_STAT_INC(crc_err); |
Felix Fietkau | 8e6f5aa | 2010-03-29 20:09:27 -0700 | [diff] [blame] | 771 | if (rs->rs_status & ATH9K_RXERR_DECRYPT) |
Sujith | 1395d3f | 2010-01-08 10:36:11 +0530 | [diff] [blame] | 772 | RX_STAT_INC(decrypt_crc_err); |
Felix Fietkau | 8e6f5aa | 2010-03-29 20:09:27 -0700 | [diff] [blame] | 773 | if (rs->rs_status & ATH9K_RXERR_MIC) |
Sujith | 1395d3f | 2010-01-08 10:36:11 +0530 | [diff] [blame] | 774 | RX_STAT_INC(mic_err); |
Felix Fietkau | 8e6f5aa | 2010-03-29 20:09:27 -0700 | [diff] [blame] | 775 | if (rs->rs_status & ATH9K_RX_DELIM_CRC_PRE) |
Sujith | 1395d3f | 2010-01-08 10:36:11 +0530 | [diff] [blame] | 776 | RX_STAT_INC(pre_delim_crc_err); |
Felix Fietkau | 8e6f5aa | 2010-03-29 20:09:27 -0700 | [diff] [blame] | 777 | if (rs->rs_status & ATH9K_RX_DELIM_CRC_POST) |
Sujith | 1395d3f | 2010-01-08 10:36:11 +0530 | [diff] [blame] | 778 | RX_STAT_INC(post_delim_crc_err); |
Felix Fietkau | 8e6f5aa | 2010-03-29 20:09:27 -0700 | [diff] [blame] | 779 | if (rs->rs_status & ATH9K_RX_DECRYPT_BUSY) |
Sujith | 1395d3f | 2010-01-08 10:36:11 +0530 | [diff] [blame] | 780 | RX_STAT_INC(decrypt_busy_err); |
| 781 | |
Felix Fietkau | 8e6f5aa | 2010-03-29 20:09:27 -0700 | [diff] [blame] | 782 | if (rs->rs_status & ATH9K_RXERR_PHY) { |
Sujith | 1395d3f | 2010-01-08 10:36:11 +0530 | [diff] [blame] | 783 | RX_STAT_INC(phy_err); |
Felix Fietkau | 8e6f5aa | 2010-03-29 20:09:27 -0700 | [diff] [blame] | 784 | phyerr = rs->rs_phyerr & 0x24; |
Sujith | 1395d3f | 2010-01-08 10:36:11 +0530 | [diff] [blame] | 785 | RX_PHY_ERR_INC(phyerr); |
| 786 | } |
| 787 | |
| 788 | #undef RX_STAT_INC |
| 789 | #undef RX_PHY_ERR_INC |
| 790 | } |
| 791 | |
| 792 | static const struct file_operations fops_recv = { |
| 793 | .read = read_file_recv, |
| 794 | .open = ath9k_debugfs_open, |
| 795 | .owner = THIS_MODULE |
| 796 | }; |
| 797 | |
Felix Fietkau | 9bff0bc | 2010-05-11 17:23:02 +0200 | [diff] [blame] | 798 | static ssize_t read_file_regidx(struct file *file, char __user *user_buf, |
| 799 | size_t count, loff_t *ppos) |
| 800 | { |
| 801 | struct ath_softc *sc = file->private_data; |
| 802 | char buf[32]; |
| 803 | unsigned int len; |
| 804 | |
| 805 | len = snprintf(buf, sizeof(buf), "0x%08x\n", sc->debug.regidx); |
| 806 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 807 | } |
| 808 | |
| 809 | static ssize_t write_file_regidx(struct file *file, const char __user *user_buf, |
| 810 | size_t count, loff_t *ppos) |
| 811 | { |
| 812 | struct ath_softc *sc = file->private_data; |
| 813 | unsigned long regidx; |
| 814 | char buf[32]; |
| 815 | ssize_t len; |
| 816 | |
| 817 | len = min(count, sizeof(buf) - 1); |
| 818 | if (copy_from_user(buf, user_buf, len)) |
| 819 | return -EINVAL; |
| 820 | |
| 821 | buf[len] = '\0'; |
| 822 | if (strict_strtoul(buf, 0, ®idx)) |
| 823 | return -EINVAL; |
| 824 | |
| 825 | sc->debug.regidx = regidx; |
| 826 | return count; |
| 827 | } |
| 828 | |
| 829 | static const struct file_operations fops_regidx = { |
| 830 | .read = read_file_regidx, |
| 831 | .write = write_file_regidx, |
| 832 | .open = ath9k_debugfs_open, |
| 833 | .owner = THIS_MODULE |
| 834 | }; |
| 835 | |
| 836 | static ssize_t read_file_regval(struct file *file, char __user *user_buf, |
| 837 | size_t count, loff_t *ppos) |
| 838 | { |
| 839 | struct ath_softc *sc = file->private_data; |
| 840 | struct ath_hw *ah = sc->sc_ah; |
| 841 | char buf[32]; |
| 842 | unsigned int len; |
| 843 | u32 regval; |
| 844 | |
| 845 | regval = REG_READ_D(ah, sc->debug.regidx); |
| 846 | len = snprintf(buf, sizeof(buf), "0x%08x\n", regval); |
| 847 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 848 | } |
| 849 | |
| 850 | static ssize_t write_file_regval(struct file *file, const char __user *user_buf, |
| 851 | size_t count, loff_t *ppos) |
| 852 | { |
| 853 | struct ath_softc *sc = file->private_data; |
| 854 | struct ath_hw *ah = sc->sc_ah; |
| 855 | unsigned long regval; |
| 856 | char buf[32]; |
| 857 | ssize_t len; |
| 858 | |
| 859 | len = min(count, sizeof(buf) - 1); |
| 860 | if (copy_from_user(buf, user_buf, len)) |
| 861 | return -EINVAL; |
| 862 | |
| 863 | buf[len] = '\0'; |
| 864 | if (strict_strtoul(buf, 0, ®val)) |
| 865 | return -EINVAL; |
| 866 | |
| 867 | REG_WRITE_D(ah, sc->debug.regidx, regval); |
| 868 | return count; |
| 869 | } |
| 870 | |
| 871 | static const struct file_operations fops_regval = { |
| 872 | .read = read_file_regval, |
| 873 | .write = write_file_regval, |
| 874 | .open = ath9k_debugfs_open, |
| 875 | .owner = THIS_MODULE |
| 876 | }; |
| 877 | |
Luis R. Rodriguez | 4d6b228 | 2009-09-07 04:52:26 -0700 | [diff] [blame] | 878 | int ath9k_init_debug(struct ath_hw *ah) |
Sujith | 88b126a | 2008-11-28 22:19:02 +0530 | [diff] [blame] | 879 | { |
Luis R. Rodriguez | bc974f4 | 2009-09-28 02:54:40 -0400 | [diff] [blame] | 880 | struct ath_common *common = ath9k_hw_common(ah); |
| 881 | struct ath_softc *sc = (struct ath_softc *) common->priv; |
Luis R. Rodriguez | 4d6b228 | 2009-09-07 04:52:26 -0700 | [diff] [blame] | 882 | |
Sujith | 7dd5874 | 2009-03-30 15:28:42 +0530 | [diff] [blame] | 883 | if (!ath9k_debugfs_root) |
| 884 | return -ENOENT; |
| 885 | |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 886 | sc->debug.debugfs_phy = debugfs_create_dir(wiphy_name(sc->hw->wiphy), |
Gabor Juhos | 19d8bc2 | 2009-03-05 16:55:18 +0100 | [diff] [blame] | 887 | ath9k_debugfs_root); |
Sujith | 17d7904 | 2009-02-09 13:27:03 +0530 | [diff] [blame] | 888 | if (!sc->debug.debugfs_phy) |
Felix Fietkau | c8a72c0 | 2010-05-11 17:23:00 +0200 | [diff] [blame] | 889 | return -ENOMEM; |
Sujith | 826d268 | 2008-11-28 22:20:23 +0530 | [diff] [blame] | 890 | |
Felix Fietkau | a830df0 | 2009-11-23 22:33:27 +0100 | [diff] [blame] | 891 | #ifdef CONFIG_ATH_DEBUG |
Felix Fietkau | c8a72c0 | 2010-05-11 17:23:00 +0200 | [diff] [blame] | 892 | if (!debugfs_create_file("debug", S_IRUSR | S_IWUSR, |
| 893 | sc->debug.debugfs_phy, sc, &fops_debug)) |
Jeff Hansen | 2493928 | 2009-05-27 12:48:29 +0000 | [diff] [blame] | 894 | goto err; |
Felix Fietkau | a830df0 | 2009-11-23 22:33:27 +0100 | [diff] [blame] | 895 | #endif |
Jeff Hansen | 2493928 | 2009-05-27 12:48:29 +0000 | [diff] [blame] | 896 | |
Felix Fietkau | c8a72c0 | 2010-05-11 17:23:00 +0200 | [diff] [blame] | 897 | if (!debugfs_create_file("dma", S_IRUSR, sc->debug.debugfs_phy, |
| 898 | sc, &fops_dma)) |
Sujith | 2a163c6 | 2008-11-28 22:21:08 +0530 | [diff] [blame] | 899 | goto err; |
| 900 | |
Felix Fietkau | c8a72c0 | 2010-05-11 17:23:00 +0200 | [diff] [blame] | 901 | if (!debugfs_create_file("interrupt", S_IRUSR, sc->debug.debugfs_phy, |
| 902 | sc, &fops_interrupt)) |
Sujith | 817e11d | 2008-12-07 21:42:44 +0530 | [diff] [blame] | 903 | goto err; |
| 904 | |
Felix Fietkau | c8a72c0 | 2010-05-11 17:23:00 +0200 | [diff] [blame] | 905 | if (!debugfs_create_file("rcstat", S_IRUSR, sc->debug.debugfs_phy, |
| 906 | sc, &fops_rcstat)) |
Sujith | 7a7dec6 | 2009-01-30 14:32:09 +0530 | [diff] [blame] | 907 | goto err; |
| 908 | |
Felix Fietkau | c8a72c0 | 2010-05-11 17:23:00 +0200 | [diff] [blame] | 909 | if (!debugfs_create_file("wiphy", S_IRUSR | S_IWUSR, |
| 910 | sc->debug.debugfs_phy, sc, &fops_wiphy)) |
Jouni Malinen | 39d89cd | 2009-03-03 19:23:40 +0200 | [diff] [blame] | 911 | goto err; |
| 912 | |
Felix Fietkau | c8a72c0 | 2010-05-11 17:23:00 +0200 | [diff] [blame] | 913 | if (!debugfs_create_file("xmit", S_IRUSR, sc->debug.debugfs_phy, |
| 914 | sc, &fops_xmit)) |
Sujith | fec247c | 2009-07-27 12:08:16 +0530 | [diff] [blame] | 915 | goto err; |
| 916 | |
Felix Fietkau | c8a72c0 | 2010-05-11 17:23:00 +0200 | [diff] [blame] | 917 | if (!debugfs_create_file("recv", S_IRUSR, sc->debug.debugfs_phy, |
| 918 | sc, &fops_recv)) |
Sujith | 1395d3f | 2010-01-08 10:36:11 +0530 | [diff] [blame] | 919 | goto err; |
| 920 | |
Felix Fietkau | 1534069 | 2010-05-11 17:23:01 +0200 | [diff] [blame] | 921 | if (!debugfs_create_file("rx_chainmask", S_IRUSR | S_IWUSR, |
| 922 | sc->debug.debugfs_phy, sc, &fops_rx_chainmask)) |
| 923 | goto err; |
| 924 | |
| 925 | if (!debugfs_create_file("tx_chainmask", S_IRUSR | S_IWUSR, |
| 926 | sc->debug.debugfs_phy, sc, &fops_tx_chainmask)) |
| 927 | goto err; |
| 928 | |
Felix Fietkau | 9bff0bc | 2010-05-11 17:23:02 +0200 | [diff] [blame] | 929 | if (!debugfs_create_file("regidx", S_IRUSR | S_IWUSR, |
| 930 | sc->debug.debugfs_phy, sc, &fops_regidx)) |
| 931 | goto err; |
| 932 | |
| 933 | if (!debugfs_create_file("regval", S_IRUSR | S_IWUSR, |
| 934 | sc->debug.debugfs_phy, sc, &fops_regval)) |
| 935 | goto err; |
| 936 | |
| 937 | sc->debug.regidx = 0; |
Sujith | 826d268 | 2008-11-28 22:20:23 +0530 | [diff] [blame] | 938 | return 0; |
| 939 | err: |
Luis R. Rodriguez | 4d6b228 | 2009-09-07 04:52:26 -0700 | [diff] [blame] | 940 | ath9k_exit_debug(ah); |
Sujith | 826d268 | 2008-11-28 22:20:23 +0530 | [diff] [blame] | 941 | return -ENOMEM; |
| 942 | } |
| 943 | |
Luis R. Rodriguez | 4d6b228 | 2009-09-07 04:52:26 -0700 | [diff] [blame] | 944 | void ath9k_exit_debug(struct ath_hw *ah) |
Sujith | 826d268 | 2008-11-28 22:20:23 +0530 | [diff] [blame] | 945 | { |
Luis R. Rodriguez | bc974f4 | 2009-09-28 02:54:40 -0400 | [diff] [blame] | 946 | struct ath_common *common = ath9k_hw_common(ah); |
| 947 | struct ath_softc *sc = (struct ath_softc *) common->priv; |
Luis R. Rodriguez | 4d6b228 | 2009-09-07 04:52:26 -0700 | [diff] [blame] | 948 | |
Felix Fietkau | c8a72c0 | 2010-05-11 17:23:00 +0200 | [diff] [blame] | 949 | debugfs_remove_recursive(sc->debug.debugfs_phy); |
Gabor Juhos | 19d8bc2 | 2009-03-05 16:55:18 +0100 | [diff] [blame] | 950 | } |
| 951 | |
| 952 | int ath9k_debug_create_root(void) |
| 953 | { |
| 954 | ath9k_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL); |
| 955 | if (!ath9k_debugfs_root) |
| 956 | return -ENOENT; |
| 957 | |
| 958 | return 0; |
| 959 | } |
| 960 | |
| 961 | void ath9k_debug_remove_root(void) |
| 962 | { |
| 963 | debugfs_remove(ath9k_debugfs_root); |
| 964 | ath9k_debugfs_root = NULL; |
Sujith | 88b126a | 2008-11-28 22:19:02 +0530 | [diff] [blame] | 965 | } |