Commit | Line | Data |
---|---|---|
88b126af | 1 | /* |
5b68138e | 2 | * Copyright (c) 2008-2011 Atheros Communications Inc. |
88b126af S |
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 | ||
5a0e3ad6 | 17 | #include <linux/slab.h> |
582d0064 | 18 | #include <linux/vmalloc.h> |
ee40fa06 | 19 | #include <linux/export.h> |
e93d083f | 20 | #include <linux/relay.h> |
52103115 GJ |
21 | #include <asm/unaligned.h> |
22 | ||
394cf0a1 | 23 | #include "ath9k.h" |
88b126af | 24 | |
475a6e4d LR |
25 | #define REG_WRITE_D(_ah, _reg, _val) \ |
26 | ath9k_hw_common(_ah)->ops->write((_ah), (_val), (_reg)) | |
27 | #define REG_READ_D(_ah, _reg) \ | |
28 | ath9k_hw_common(_ah)->ops->read((_ah), (_reg)) | |
29 | ||
2a163c6d | 30 | |
582d0064 VT |
31 | static ssize_t ath9k_debugfs_read_buf(struct file *file, char __user *user_buf, |
32 | size_t count, loff_t *ppos) | |
33 | { | |
34 | u8 *buf = file->private_data; | |
35 | return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf)); | |
36 | } | |
37 | ||
38 | static int ath9k_debugfs_release_buf(struct inode *inode, struct file *file) | |
39 | { | |
40 | vfree(file->private_data); | |
41 | return 0; | |
42 | } | |
43 | ||
a830df07 FF |
44 | #ifdef CONFIG_ATH_DEBUG |
45 | ||
2493928e JH |
46 | static ssize_t read_file_debug(struct file *file, char __user *user_buf, |
47 | size_t count, loff_t *ppos) | |
48 | { | |
49 | struct ath_softc *sc = file->private_data; | |
c46917bb | 50 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
2493928e | 51 | char buf[32]; |
581f725c VT |
52 | unsigned int len; |
53 | ||
2b87f3aa | 54 | len = sprintf(buf, "0x%08x\n", common->debug_mask); |
2493928e JH |
55 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
56 | } | |
57 | ||
58 | static ssize_t write_file_debug(struct file *file, const char __user *user_buf, | |
59 | size_t count, loff_t *ppos) | |
60 | { | |
61 | struct ath_softc *sc = file->private_data; | |
c46917bb | 62 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
2493928e JH |
63 | unsigned long mask; |
64 | char buf[32]; | |
581f725c VT |
65 | ssize_t len; |
66 | ||
67 | len = min(count, sizeof(buf) - 1); | |
68 | if (copy_from_user(buf, user_buf, len)) | |
04236066 | 69 | return -EFAULT; |
581f725c VT |
70 | |
71 | buf[len] = '\0'; | |
27d7f477 | 72 | if (kstrtoul(buf, 0, &mask)) |
581f725c VT |
73 | return -EINVAL; |
74 | ||
c46917bb | 75 | common->debug_mask = mask; |
2493928e JH |
76 | return count; |
77 | } | |
78 | ||
79 | static const struct file_operations fops_debug = { | |
80 | .read = read_file_debug, | |
81 | .write = write_file_debug, | |
234e3405 | 82 | .open = simple_open, |
6038f373 AB |
83 | .owner = THIS_MODULE, |
84 | .llseek = default_llseek, | |
2493928e JH |
85 | }; |
86 | ||
a830df07 FF |
87 | #endif |
88 | ||
991a0987 PR |
89 | #define DMA_BUF_LEN 1024 |
90 | ||
15340694 FF |
91 | static ssize_t read_file_tx_chainmask(struct file *file, char __user *user_buf, |
92 | size_t count, loff_t *ppos) | |
93 | { | |
94 | struct ath_softc *sc = file->private_data; | |
82b2d334 | 95 | struct ath_hw *ah = sc->sc_ah; |
15340694 FF |
96 | char buf[32]; |
97 | unsigned int len; | |
98 | ||
82b2d334 | 99 | len = sprintf(buf, "0x%08x\n", ah->txchainmask); |
15340694 FF |
100 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
101 | } | |
102 | ||
103 | static ssize_t write_file_tx_chainmask(struct file *file, const char __user *user_buf, | |
104 | size_t count, loff_t *ppos) | |
105 | { | |
106 | struct ath_softc *sc = file->private_data; | |
82b2d334 | 107 | struct ath_hw *ah = sc->sc_ah; |
15340694 FF |
108 | unsigned long mask; |
109 | char buf[32]; | |
110 | ssize_t len; | |
111 | ||
112 | len = min(count, sizeof(buf) - 1); | |
113 | if (copy_from_user(buf, user_buf, len)) | |
04236066 | 114 | return -EFAULT; |
15340694 FF |
115 | |
116 | buf[len] = '\0'; | |
27d7f477 | 117 | if (kstrtoul(buf, 0, &mask)) |
15340694 FF |
118 | return -EINVAL; |
119 | ||
82b2d334 FF |
120 | ah->txchainmask = mask; |
121 | ah->caps.tx_chainmask = mask; | |
15340694 FF |
122 | return count; |
123 | } | |
124 | ||
125 | static const struct file_operations fops_tx_chainmask = { | |
126 | .read = read_file_tx_chainmask, | |
127 | .write = write_file_tx_chainmask, | |
234e3405 | 128 | .open = simple_open, |
6038f373 AB |
129 | .owner = THIS_MODULE, |
130 | .llseek = default_llseek, | |
15340694 FF |
131 | }; |
132 | ||
133 | ||
134 | static ssize_t read_file_rx_chainmask(struct file *file, char __user *user_buf, | |
135 | size_t count, loff_t *ppos) | |
136 | { | |
137 | struct ath_softc *sc = file->private_data; | |
82b2d334 | 138 | struct ath_hw *ah = sc->sc_ah; |
15340694 FF |
139 | char buf[32]; |
140 | unsigned int len; | |
141 | ||
82b2d334 | 142 | len = sprintf(buf, "0x%08x\n", ah->rxchainmask); |
15340694 FF |
143 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
144 | } | |
145 | ||
146 | static ssize_t write_file_rx_chainmask(struct file *file, const char __user *user_buf, | |
147 | size_t count, loff_t *ppos) | |
148 | { | |
149 | struct ath_softc *sc = file->private_data; | |
82b2d334 | 150 | struct ath_hw *ah = sc->sc_ah; |
15340694 FF |
151 | unsigned long mask; |
152 | char buf[32]; | |
153 | ssize_t len; | |
154 | ||
155 | len = min(count, sizeof(buf) - 1); | |
156 | if (copy_from_user(buf, user_buf, len)) | |
04236066 | 157 | return -EFAULT; |
15340694 FF |
158 | |
159 | buf[len] = '\0'; | |
27d7f477 | 160 | if (kstrtoul(buf, 0, &mask)) |
15340694 FF |
161 | return -EINVAL; |
162 | ||
82b2d334 FF |
163 | ah->rxchainmask = mask; |
164 | ah->caps.rx_chainmask = mask; | |
15340694 FF |
165 | return count; |
166 | } | |
167 | ||
168 | static const struct file_operations fops_rx_chainmask = { | |
169 | .read = read_file_rx_chainmask, | |
170 | .write = write_file_rx_chainmask, | |
234e3405 | 171 | .open = simple_open, |
6038f373 AB |
172 | .owner = THIS_MODULE, |
173 | .llseek = default_llseek, | |
15340694 FF |
174 | }; |
175 | ||
6e4d291e | 176 | static ssize_t read_file_ani(struct file *file, char __user *user_buf, |
05c0be2f MSS |
177 | size_t count, loff_t *ppos) |
178 | { | |
179 | struct ath_softc *sc = file->private_data; | |
180 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | |
6e4d291e SM |
181 | struct ath_hw *ah = sc->sc_ah; |
182 | unsigned int len = 0, size = 1024; | |
183 | ssize_t retval = 0; | |
184 | char *buf; | |
05c0be2f | 185 | |
6e4d291e SM |
186 | buf = kzalloc(size, GFP_KERNEL); |
187 | if (buf == NULL) | |
188 | return -ENOMEM; | |
189 | ||
190 | if (common->disable_ani) { | |
191 | len += snprintf(buf + len, size - len, "%s: %s\n", | |
192 | "ANI", "DISABLED"); | |
193 | goto exit; | |
194 | } | |
195 | ||
196 | len += snprintf(buf + len, size - len, "%15s: %s\n", | |
197 | "ANI", "ENABLED"); | |
198 | len += snprintf(buf + len, size - len, "%15s: %u\n", | |
199 | "ANI RESET", ah->stats.ast_ani_reset); | |
200 | len += snprintf(buf + len, size - len, "%15s: %u\n", | |
201 | "SPUR UP", ah->stats.ast_ani_spurup); | |
202 | len += snprintf(buf + len, size - len, "%15s: %u\n", | |
203 | "SPUR DOWN", ah->stats.ast_ani_spurup); | |
204 | len += snprintf(buf + len, size - len, "%15s: %u\n", | |
205 | "OFDM WS-DET ON", ah->stats.ast_ani_ofdmon); | |
206 | len += snprintf(buf + len, size - len, "%15s: %u\n", | |
207 | "OFDM WS-DET OFF", ah->stats.ast_ani_ofdmoff); | |
208 | len += snprintf(buf + len, size - len, "%15s: %u\n", | |
209 | "MRC-CCK ON", ah->stats.ast_ani_ccklow); | |
210 | len += snprintf(buf + len, size - len, "%15s: %u\n", | |
211 | "MRC-CCK OFF", ah->stats.ast_ani_cckhigh); | |
212 | len += snprintf(buf + len, size - len, "%15s: %u\n", | |
213 | "FIR-STEP UP", ah->stats.ast_ani_stepup); | |
214 | len += snprintf(buf + len, size - len, "%15s: %u\n", | |
215 | "FIR-STEP DOWN", ah->stats.ast_ani_stepdown); | |
216 | len += snprintf(buf + len, size - len, "%15s: %u\n", | |
217 | "INV LISTENTIME", ah->stats.ast_ani_lneg_or_lzero); | |
218 | len += snprintf(buf + len, size - len, "%15s: %u\n", | |
219 | "OFDM ERRORS", ah->stats.ast_ani_ofdmerrs); | |
220 | len += snprintf(buf + len, size - len, "%15s: %u\n", | |
221 | "CCK ERRORS", ah->stats.ast_ani_cckerrs); | |
222 | exit: | |
223 | if (len > size) | |
224 | len = size; | |
225 | ||
226 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | |
227 | kfree(buf); | |
228 | ||
229 | return retval; | |
05c0be2f MSS |
230 | } |
231 | ||
6e4d291e SM |
232 | static ssize_t write_file_ani(struct file *file, |
233 | const char __user *user_buf, | |
234 | size_t count, loff_t *ppos) | |
05c0be2f MSS |
235 | { |
236 | struct ath_softc *sc = file->private_data; | |
237 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | |
6e4d291e | 238 | unsigned long ani; |
05c0be2f MSS |
239 | char buf[32]; |
240 | ssize_t len; | |
241 | ||
242 | len = min(count, sizeof(buf) - 1); | |
243 | if (copy_from_user(buf, user_buf, len)) | |
244 | return -EFAULT; | |
245 | ||
246 | buf[len] = '\0'; | |
3899ba90 | 247 | if (kstrtoul(buf, 0, &ani)) |
05c0be2f MSS |
248 | return -EINVAL; |
249 | ||
6e4d291e | 250 | if (ani < 0 || ani > 1) |
05c0be2f MSS |
251 | return -EINVAL; |
252 | ||
6e4d291e | 253 | common->disable_ani = !ani; |
05c0be2f | 254 | |
6e4d291e | 255 | if (common->disable_ani) { |
781b14a3 | 256 | clear_bit(SC_OP_ANI_RUN, &sc->sc_flags); |
da0d45f7 | 257 | ath_stop_ani(sc); |
05c0be2f | 258 | } else { |
da0d45f7 | 259 | ath_check_ani(sc); |
05c0be2f MSS |
260 | } |
261 | ||
262 | return count; | |
263 | } | |
264 | ||
6e4d291e SM |
265 | static const struct file_operations fops_ani = { |
266 | .read = read_file_ani, | |
267 | .write = write_file_ani, | |
234e3405 | 268 | .open = simple_open, |
05c0be2f MSS |
269 | .owner = THIS_MODULE, |
270 | .llseek = default_llseek, | |
271 | }; | |
15340694 | 272 | |
302a3c3a SM |
273 | static ssize_t read_file_ant_diversity(struct file *file, char __user *user_buf, |
274 | size_t count, loff_t *ppos) | |
275 | { | |
276 | struct ath_softc *sc = file->private_data; | |
277 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | |
278 | char buf[32]; | |
279 | unsigned int len; | |
280 | ||
281 | len = sprintf(buf, "%d\n", common->antenna_diversity); | |
282 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | |
283 | } | |
284 | ||
285 | static ssize_t write_file_ant_diversity(struct file *file, | |
286 | const char __user *user_buf, | |
287 | size_t count, loff_t *ppos) | |
288 | { | |
289 | struct ath_softc *sc = file->private_data; | |
290 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | |
291 | unsigned long antenna_diversity; | |
292 | char buf[32]; | |
293 | ssize_t len; | |
294 | ||
295 | len = min(count, sizeof(buf) - 1); | |
296 | if (copy_from_user(buf, user_buf, len)) | |
297 | return -EFAULT; | |
298 | ||
299 | if (!AR_SREV_9565(sc->sc_ah)) | |
300 | goto exit; | |
301 | ||
302 | buf[len] = '\0'; | |
27d7f477 | 303 | if (kstrtoul(buf, 0, &antenna_diversity)) |
302a3c3a SM |
304 | return -EINVAL; |
305 | ||
306 | common->antenna_diversity = !!antenna_diversity; | |
307 | ath9k_ps_wakeup(sc); | |
308 | ath_ant_comb_update(sc); | |
309 | ath_dbg(common, CONFIG, "Antenna diversity: %d\n", | |
310 | common->antenna_diversity); | |
311 | ath9k_ps_restore(sc); | |
312 | exit: | |
313 | return count; | |
314 | } | |
315 | ||
316 | static const struct file_operations fops_ant_diversity = { | |
317 | .read = read_file_ant_diversity, | |
318 | .write = write_file_ant_diversity, | |
319 | .open = simple_open, | |
320 | .owner = THIS_MODULE, | |
321 | .llseek = default_llseek, | |
322 | }; | |
323 | ||
2a163c6d S |
324 | static ssize_t read_file_dma(struct file *file, char __user *user_buf, |
325 | size_t count, loff_t *ppos) | |
326 | { | |
327 | struct ath_softc *sc = file->private_data; | |
cbe61d8a | 328 | struct ath_hw *ah = sc->sc_ah; |
991a0987 PR |
329 | char *buf; |
330 | int retval; | |
2a163c6d S |
331 | unsigned int len = 0; |
332 | u32 val[ATH9K_NUM_DMA_DEBUG_REGS]; | |
333 | int i, qcuOffset = 0, dcuOffset = 0; | |
334 | u32 *qcuBase = &val[0], *dcuBase = &val[4]; | |
335 | ||
991a0987 PR |
336 | buf = kmalloc(DMA_BUF_LEN, GFP_KERNEL); |
337 | if (!buf) | |
04236066 | 338 | return -ENOMEM; |
991a0987 | 339 | |
7cf4a2e7 S |
340 | ath9k_ps_wakeup(sc); |
341 | ||
475a6e4d | 342 | REG_WRITE_D(ah, AR_MACMISC, |
2a163c6d S |
343 | ((AR_MACMISC_DMA_OBS_LINE_8 << AR_MACMISC_DMA_OBS_S) | |
344 | (AR_MACMISC_MISC_OBS_BUS_1 << | |
345 | AR_MACMISC_MISC_OBS_BUS_MSB_S))); | |
346 | ||
991a0987 | 347 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
2a163c6d S |
348 | "Raw DMA Debug values:\n"); |
349 | ||
350 | for (i = 0; i < ATH9K_NUM_DMA_DEBUG_REGS; i++) { | |
351 | if (i % 4 == 0) | |
991a0987 | 352 | len += snprintf(buf + len, DMA_BUF_LEN - len, "\n"); |
2a163c6d | 353 | |
475a6e4d | 354 | val[i] = REG_READ_D(ah, AR_DMADBG_0 + (i * sizeof(u32))); |
991a0987 | 355 | len += snprintf(buf + len, DMA_BUF_LEN - len, "%d: %08x ", |
2a163c6d S |
356 | i, val[i]); |
357 | } | |
358 | ||
991a0987 PR |
359 | len += snprintf(buf + len, DMA_BUF_LEN - len, "\n\n"); |
360 | len += snprintf(buf + len, DMA_BUF_LEN - len, | |
2a163c6d S |
361 | "Num QCU: chain_st fsp_ok fsp_st DCU: chain_st\n"); |
362 | ||
363 | for (i = 0; i < ATH9K_NUM_QUEUES; i++, qcuOffset += 4, dcuOffset += 5) { | |
364 | if (i == 8) { | |
365 | qcuOffset = 0; | |
366 | qcuBase++; | |
367 | } | |
368 | ||
369 | if (i == 6) { | |
370 | dcuOffset = 0; | |
371 | dcuBase++; | |
372 | } | |
373 | ||
991a0987 | 374 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
2a163c6d S |
375 | "%2d %2x %1x %2x %2x\n", |
376 | i, (*qcuBase & (0x7 << qcuOffset)) >> qcuOffset, | |
377 | (*qcuBase & (0x8 << qcuOffset)) >> (qcuOffset + 3), | |
378 | val[2] & (0x7 << (i * 3)) >> (i * 3), | |
379 | (*dcuBase & (0x1f << dcuOffset)) >> dcuOffset); | |
380 | } | |
381 | ||
991a0987 | 382 | len += snprintf(buf + len, DMA_BUF_LEN - len, "\n"); |
2a163c6d | 383 | |
991a0987 | 384 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
2a163c6d S |
385 | "qcu_stitch state: %2x qcu_fetch state: %2x\n", |
386 | (val[3] & 0x003c0000) >> 18, (val[3] & 0x03c00000) >> 22); | |
991a0987 | 387 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
2a163c6d S |
388 | "qcu_complete state: %2x dcu_complete state: %2x\n", |
389 | (val[3] & 0x1c000000) >> 26, (val[6] & 0x3)); | |
991a0987 | 390 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
2a163c6d S |
391 | "dcu_arb state: %2x dcu_fp state: %2x\n", |
392 | (val[5] & 0x06000000) >> 25, (val[5] & 0x38000000) >> 27); | |
991a0987 | 393 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
2a163c6d S |
394 | "chan_idle_dur: %3d chan_idle_dur_valid: %1d\n", |
395 | (val[6] & 0x000003fc) >> 2, (val[6] & 0x00000400) >> 10); | |
991a0987 | 396 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
2a163c6d S |
397 | "txfifo_valid_0: %1d txfifo_valid_1: %1d\n", |
398 | (val[6] & 0x00000800) >> 11, (val[6] & 0x00001000) >> 12); | |
991a0987 | 399 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
2a163c6d S |
400 | "txfifo_dcu_num_0: %2d txfifo_dcu_num_1: %2d\n", |
401 | (val[6] & 0x0001e000) >> 13, (val[6] & 0x001e0000) >> 17); | |
402 | ||
60ece404 | 403 | len += snprintf(buf + len, DMA_BUF_LEN - len, "pcu observe: 0x%x\n", |
475a6e4d | 404 | REG_READ_D(ah, AR_OBS_BUS_1)); |
991a0987 | 405 | len += snprintf(buf + len, DMA_BUF_LEN - len, |
60ece404 | 406 | "AR_CR: 0x%x\n", REG_READ_D(ah, AR_CR)); |
2a163c6d | 407 | |
7cf4a2e7 S |
408 | ath9k_ps_restore(sc); |
409 | ||
2b87f3aa DC |
410 | if (len > DMA_BUF_LEN) |
411 | len = DMA_BUF_LEN; | |
412 | ||
991a0987 PR |
413 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); |
414 | kfree(buf); | |
415 | return retval; | |
2a163c6d S |
416 | } |
417 | ||
418 | static const struct file_operations fops_dma = { | |
419 | .read = read_file_dma, | |
234e3405 | 420 | .open = simple_open, |
6038f373 AB |
421 | .owner = THIS_MODULE, |
422 | .llseek = default_llseek, | |
2a163c6d S |
423 | }; |
424 | ||
817e11de S |
425 | |
426 | void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status) | |
427 | { | |
428 | if (status) | |
17d7904d | 429 | sc->debug.stats.istats.total++; |
a9616f41 LR |
430 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { |
431 | if (status & ATH9K_INT_RXLP) | |
432 | sc->debug.stats.istats.rxlp++; | |
433 | if (status & ATH9K_INT_RXHP) | |
434 | sc->debug.stats.istats.rxhp++; | |
08578b8f LR |
435 | if (status & ATH9K_INT_BB_WATCHDOG) |
436 | sc->debug.stats.istats.bb_watchdog++; | |
a9616f41 LR |
437 | } else { |
438 | if (status & ATH9K_INT_RX) | |
439 | sc->debug.stats.istats.rxok++; | |
440 | } | |
817e11de | 441 | if (status & ATH9K_INT_RXEOL) |
17d7904d | 442 | sc->debug.stats.istats.rxeol++; |
817e11de | 443 | if (status & ATH9K_INT_RXORN) |
17d7904d | 444 | sc->debug.stats.istats.rxorn++; |
817e11de | 445 | if (status & ATH9K_INT_TX) |
17d7904d | 446 | sc->debug.stats.istats.txok++; |
817e11de | 447 | if (status & ATH9K_INT_TXURN) |
17d7904d | 448 | sc->debug.stats.istats.txurn++; |
817e11de | 449 | if (status & ATH9K_INT_RXPHY) |
17d7904d | 450 | sc->debug.stats.istats.rxphyerr++; |
817e11de | 451 | if (status & ATH9K_INT_RXKCM) |
17d7904d | 452 | sc->debug.stats.istats.rx_keycache_miss++; |
817e11de | 453 | if (status & ATH9K_INT_SWBA) |
17d7904d | 454 | sc->debug.stats.istats.swba++; |
817e11de | 455 | if (status & ATH9K_INT_BMISS) |
17d7904d | 456 | sc->debug.stats.istats.bmiss++; |
817e11de | 457 | if (status & ATH9K_INT_BNR) |
17d7904d | 458 | sc->debug.stats.istats.bnr++; |
817e11de | 459 | if (status & ATH9K_INT_CST) |
17d7904d | 460 | sc->debug.stats.istats.cst++; |
817e11de | 461 | if (status & ATH9K_INT_GTT) |
17d7904d | 462 | sc->debug.stats.istats.gtt++; |
817e11de | 463 | if (status & ATH9K_INT_TIM) |
17d7904d | 464 | sc->debug.stats.istats.tim++; |
817e11de | 465 | if (status & ATH9K_INT_CABEND) |
17d7904d | 466 | sc->debug.stats.istats.cabend++; |
817e11de | 467 | if (status & ATH9K_INT_DTIMSYNC) |
17d7904d | 468 | sc->debug.stats.istats.dtimsync++; |
817e11de | 469 | if (status & ATH9K_INT_DTIM) |
17d7904d | 470 | sc->debug.stats.istats.dtim++; |
6dde1aab MSS |
471 | if (status & ATH9K_INT_TSFOOR) |
472 | sc->debug.stats.istats.tsfoor++; | |
97ba515a SM |
473 | if (status & ATH9K_INT_MCI) |
474 | sc->debug.stats.istats.mci++; | |
c9e6e980 MSS |
475 | if (status & ATH9K_INT_GENTIMER) |
476 | sc->debug.stats.istats.gen_timer++; | |
817e11de S |
477 | } |
478 | ||
479 | static ssize_t read_file_interrupt(struct file *file, char __user *user_buf, | |
480 | size_t count, loff_t *ppos) | |
481 | { | |
482 | struct ath_softc *sc = file->private_data; | |
817e11de | 483 | unsigned int len = 0; |
462e58f2 BG |
484 | int rv; |
485 | int mxlen = 4000; | |
486 | char *buf = kmalloc(mxlen, GFP_KERNEL); | |
487 | if (!buf) | |
488 | return -ENOMEM; | |
489 | ||
490 | #define PR_IS(a, s) \ | |
491 | do { \ | |
492 | len += snprintf(buf + len, mxlen - len, \ | |
493 | "%21s: %10u\n", a, \ | |
494 | sc->debug.stats.istats.s); \ | |
495 | } while (0) | |
817e11de | 496 | |
a9616f41 | 497 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { |
462e58f2 BG |
498 | PR_IS("RXLP", rxlp); |
499 | PR_IS("RXHP", rxhp); | |
500 | PR_IS("WATHDOG", bb_watchdog); | |
a9616f41 | 501 | } else { |
462e58f2 | 502 | PR_IS("RX", rxok); |
a9616f41 | 503 | } |
462e58f2 BG |
504 | PR_IS("RXEOL", rxeol); |
505 | PR_IS("RXORN", rxorn); | |
506 | PR_IS("TX", txok); | |
507 | PR_IS("TXURN", txurn); | |
508 | PR_IS("MIB", mib); | |
509 | PR_IS("RXPHY", rxphyerr); | |
510 | PR_IS("RXKCM", rx_keycache_miss); | |
511 | PR_IS("SWBA", swba); | |
512 | PR_IS("BMISS", bmiss); | |
513 | PR_IS("BNR", bnr); | |
514 | PR_IS("CST", cst); | |
515 | PR_IS("GTT", gtt); | |
516 | PR_IS("TIM", tim); | |
517 | PR_IS("CABEND", cabend); | |
518 | PR_IS("DTIMSYNC", dtimsync); | |
519 | PR_IS("DTIM", dtim); | |
520 | PR_IS("TSFOOR", tsfoor); | |
97ba515a | 521 | PR_IS("MCI", mci); |
c9e6e980 | 522 | PR_IS("GENTIMER", gen_timer); |
462e58f2 BG |
523 | PR_IS("TOTAL", total); |
524 | ||
525 | len += snprintf(buf + len, mxlen - len, | |
526 | "SYNC_CAUSE stats:\n"); | |
527 | ||
528 | PR_IS("Sync-All", sync_cause_all); | |
529 | PR_IS("RTC-IRQ", sync_rtc_irq); | |
530 | PR_IS("MAC-IRQ", sync_mac_irq); | |
531 | PR_IS("EEPROM-Illegal-Access", eeprom_illegal_access); | |
532 | PR_IS("APB-Timeout", apb_timeout); | |
533 | PR_IS("PCI-Mode-Conflict", pci_mode_conflict); | |
534 | PR_IS("HOST1-Fatal", host1_fatal); | |
535 | PR_IS("HOST1-Perr", host1_perr); | |
536 | PR_IS("TRCV-FIFO-Perr", trcv_fifo_perr); | |
537 | PR_IS("RADM-CPL-EP", radm_cpl_ep); | |
538 | PR_IS("RADM-CPL-DLLP-Abort", radm_cpl_dllp_abort); | |
539 | PR_IS("RADM-CPL-TLP-Abort", radm_cpl_tlp_abort); | |
540 | PR_IS("RADM-CPL-ECRC-Err", radm_cpl_ecrc_err); | |
541 | PR_IS("RADM-CPL-Timeout", radm_cpl_timeout); | |
542 | PR_IS("Local-Bus-Timeout", local_timeout); | |
543 | PR_IS("PM-Access", pm_access); | |
544 | PR_IS("MAC-Awake", mac_awake); | |
545 | PR_IS("MAC-Asleep", mac_asleep); | |
546 | PR_IS("MAC-Sleep-Access", mac_sleep_access); | |
547 | ||
548 | if (len > mxlen) | |
549 | len = mxlen; | |
550 | ||
551 | rv = simple_read_from_buffer(user_buf, count, ppos, buf, len); | |
552 | kfree(buf); | |
553 | return rv; | |
817e11de S |
554 | } |
555 | ||
556 | static const struct file_operations fops_interrupt = { | |
557 | .read = read_file_interrupt, | |
234e3405 | 558 | .open = simple_open, |
6038f373 AB |
559 | .owner = THIS_MODULE, |
560 | .llseek = default_llseek, | |
817e11de S |
561 | }; |
562 | ||
fec247c0 S |
563 | static ssize_t read_file_xmit(struct file *file, char __user *user_buf, |
564 | size_t count, loff_t *ppos) | |
565 | { | |
566 | struct ath_softc *sc = file->private_data; | |
567 | char *buf; | |
78ef731c | 568 | unsigned int len = 0, size = 2048; |
fec247c0 S |
569 | ssize_t retval = 0; |
570 | ||
571 | buf = kzalloc(size, GFP_KERNEL); | |
572 | if (buf == NULL) | |
04236066 | 573 | return -ENOMEM; |
fec247c0 | 574 | |
78ef731c | 575 | len += sprintf(buf, "%30s %10s%10s%10s\n\n", |
7f010c93 | 576 | "BE", "BK", "VI", "VO"); |
fec247c0 S |
577 | |
578 | PR("MPDUs Queued: ", queued); | |
579 | PR("MPDUs Completed: ", completed); | |
5a6f78af | 580 | PR("MPDUs XRetried: ", xretries); |
fec247c0 | 581 | PR("Aggregates: ", a_aggr); |
bda8adda BG |
582 | PR("AMPDUs Queued HW:", a_queued_hw); |
583 | PR("AMPDUs Queued SW:", a_queued_sw); | |
fec247c0 S |
584 | PR("AMPDUs Completed:", a_completed); |
585 | PR("AMPDUs Retried: ", a_retries); | |
586 | PR("AMPDUs XRetried: ", a_xretries); | |
4d900389 | 587 | PR("TXERR Filtered: ", txerr_filtered); |
fec247c0 S |
588 | PR("FIFO Underrun: ", fifo_underrun); |
589 | PR("TXOP Exceeded: ", xtxop); | |
590 | PR("TXTIMER Expiry: ", timer_exp); | |
591 | PR("DESC CFG Error: ", desc_cfg_err); | |
592 | PR("DATA Underrun: ", data_underrun); | |
593 | PR("DELIM Underrun: ", delim_underrun); | |
99c15bf5 BG |
594 | PR("TX-Pkts-All: ", tx_pkts_all); |
595 | PR("TX-Bytes-All: ", tx_bytes_all); | |
78ef731c SM |
596 | PR("HW-put-tx-buf: ", puttxbuf); |
597 | PR("HW-tx-start: ", txstart); | |
598 | PR("HW-tx-proc-desc: ", txprocdesc); | |
a5a0bca1 | 599 | PR("TX-Failed: ", txfailed); |
71e025a5 | 600 | |
7f010c93 BG |
601 | if (len > size) |
602 | len = size; | |
603 | ||
604 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | |
605 | kfree(buf); | |
606 | ||
607 | return retval; | |
608 | } | |
609 | ||
c0b74876 SM |
610 | static ssize_t read_file_queues(struct file *file, char __user *user_buf, |
611 | size_t count, loff_t *ppos) | |
612 | { | |
613 | struct ath_softc *sc = file->private_data; | |
614 | struct ath_txq *txq; | |
615 | char *buf; | |
616 | unsigned int len = 0, size = 1024; | |
617 | ssize_t retval = 0; | |
618 | int i; | |
619 | char *qname[4] = {"VO", "VI", "BE", "BK"}; | |
620 | ||
621 | buf = kzalloc(size, GFP_KERNEL); | |
622 | if (buf == NULL) | |
623 | return -ENOMEM; | |
624 | ||
625 | for (i = 0; i < IEEE80211_NUM_ACS; i++) { | |
626 | txq = sc->tx.txq_map[i]; | |
627 | len += snprintf(buf + len, size - len, "(%s): ", qname[i]); | |
628 | ||
629 | ath_txq_lock(sc, txq); | |
630 | ||
631 | len += snprintf(buf + len, size - len, "%s: %d ", | |
632 | "qnum", txq->axq_qnum); | |
633 | len += snprintf(buf + len, size - len, "%s: %2d ", | |
634 | "qdepth", txq->axq_depth); | |
635 | len += snprintf(buf + len, size - len, "%s: %2d ", | |
636 | "ampdu-depth", txq->axq_ampdu_depth); | |
637 | len += snprintf(buf + len, size - len, "%s: %3d ", | |
638 | "pending", txq->pending_frames); | |
639 | len += snprintf(buf + len, size - len, "%s: %d\n", | |
640 | "stopped", txq->stopped); | |
641 | ||
642 | ath_txq_unlock(sc, txq); | |
643 | } | |
644 | ||
645 | if (len > size) | |
646 | len = size; | |
647 | ||
648 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | |
649 | kfree(buf); | |
650 | ||
651 | return retval; | |
652 | } | |
653 | ||
55f6d0ff BG |
654 | static ssize_t read_file_misc(struct file *file, char __user *user_buf, |
655 | size_t count, loff_t *ppos) | |
656 | { | |
657 | struct ath_softc *sc = file->private_data; | |
658 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | |
55f6d0ff | 659 | struct ieee80211_hw *hw = sc->hw; |
6bcf6f64 SM |
660 | struct ath9k_vif_iter_data iter_data; |
661 | char buf[512]; | |
662 | unsigned int len = 0; | |
55f6d0ff | 663 | ssize_t retval = 0; |
55f6d0ff | 664 | unsigned int reg; |
6bcf6f64 | 665 | u32 rxfilter; |
55f6d0ff | 666 | |
6bcf6f64 SM |
667 | len += snprintf(buf + len, sizeof(buf) - len, |
668 | "BSSID: %pM\n", common->curbssid); | |
669 | len += snprintf(buf + len, sizeof(buf) - len, | |
670 | "BSSID-MASK: %pM\n", common->bssidmask); | |
671 | len += snprintf(buf + len, sizeof(buf) - len, | |
672 | "OPMODE: %s\n", ath_opmode_to_string(sc->sc_ah->opmode)); | |
55f6d0ff | 673 | |
79d2b157 | 674 | ath9k_ps_wakeup(sc); |
6bcf6f64 | 675 | rxfilter = ath9k_hw_getrxfilter(sc->sc_ah); |
79d2b157 | 676 | ath9k_ps_restore(sc); |
6bcf6f64 SM |
677 | |
678 | len += snprintf(buf + len, sizeof(buf) - len, | |
679 | "RXFILTER: 0x%x", rxfilter); | |
680 | ||
681 | if (rxfilter & ATH9K_RX_FILTER_UCAST) | |
682 | len += snprintf(buf + len, sizeof(buf) - len, " UCAST"); | |
683 | if (rxfilter & ATH9K_RX_FILTER_MCAST) | |
684 | len += snprintf(buf + len, sizeof(buf) - len, " MCAST"); | |
685 | if (rxfilter & ATH9K_RX_FILTER_BCAST) | |
686 | len += snprintf(buf + len, sizeof(buf) - len, " BCAST"); | |
687 | if (rxfilter & ATH9K_RX_FILTER_CONTROL) | |
688 | len += snprintf(buf + len, sizeof(buf) - len, " CONTROL"); | |
689 | if (rxfilter & ATH9K_RX_FILTER_BEACON) | |
690 | len += snprintf(buf + len, sizeof(buf) - len, " BEACON"); | |
691 | if (rxfilter & ATH9K_RX_FILTER_PROM) | |
692 | len += snprintf(buf + len, sizeof(buf) - len, " PROM"); | |
693 | if (rxfilter & ATH9K_RX_FILTER_PROBEREQ) | |
694 | len += snprintf(buf + len, sizeof(buf) - len, " PROBEREQ"); | |
695 | if (rxfilter & ATH9K_RX_FILTER_PHYERR) | |
696 | len += snprintf(buf + len, sizeof(buf) - len, " PHYERR"); | |
697 | if (rxfilter & ATH9K_RX_FILTER_MYBEACON) | |
698 | len += snprintf(buf + len, sizeof(buf) - len, " MYBEACON"); | |
699 | if (rxfilter & ATH9K_RX_FILTER_COMP_BAR) | |
700 | len += snprintf(buf + len, sizeof(buf) - len, " COMP_BAR"); | |
701 | if (rxfilter & ATH9K_RX_FILTER_PSPOLL) | |
702 | len += snprintf(buf + len, sizeof(buf) - len, " PSPOLL"); | |
703 | if (rxfilter & ATH9K_RX_FILTER_PHYRADAR) | |
704 | len += snprintf(buf + len, sizeof(buf) - len, " PHYRADAR"); | |
705 | if (rxfilter & ATH9K_RX_FILTER_MCAST_BCAST_ALL) | |
706 | len += snprintf(buf + len, sizeof(buf) - len, " MCAST_BCAST_ALL"); | |
707 | if (rxfilter & ATH9K_RX_FILTER_CONTROL_WRAPPER) | |
708 | len += snprintf(buf + len, sizeof(buf) - len, " CONTROL_WRAPPER"); | |
709 | ||
710 | len += snprintf(buf + len, sizeof(buf) - len, "\n"); | |
55f6d0ff BG |
711 | |
712 | reg = sc->sc_ah->imask; | |
6bcf6f64 SM |
713 | |
714 | len += snprintf(buf + len, sizeof(buf) - len, "INTERRUPT-MASK: 0x%x", reg); | |
715 | ||
55f6d0ff | 716 | if (reg & ATH9K_INT_SWBA) |
6bcf6f64 | 717 | len += snprintf(buf + len, sizeof(buf) - len, " SWBA"); |
55f6d0ff | 718 | if (reg & ATH9K_INT_BMISS) |
6bcf6f64 | 719 | len += snprintf(buf + len, sizeof(buf) - len, " BMISS"); |
55f6d0ff | 720 | if (reg & ATH9K_INT_CST) |
6bcf6f64 | 721 | len += snprintf(buf + len, sizeof(buf) - len, " CST"); |
55f6d0ff | 722 | if (reg & ATH9K_INT_RX) |
6bcf6f64 | 723 | len += snprintf(buf + len, sizeof(buf) - len, " RX"); |
55f6d0ff | 724 | if (reg & ATH9K_INT_RXHP) |
6bcf6f64 | 725 | len += snprintf(buf + len, sizeof(buf) - len, " RXHP"); |
55f6d0ff | 726 | if (reg & ATH9K_INT_RXLP) |
6bcf6f64 | 727 | len += snprintf(buf + len, sizeof(buf) - len, " RXLP"); |
55f6d0ff | 728 | if (reg & ATH9K_INT_BB_WATCHDOG) |
6bcf6f64 | 729 | len += snprintf(buf + len, sizeof(buf) - len, " BB_WATCHDOG"); |
55f6d0ff | 730 | |
6bcf6f64 SM |
731 | len += snprintf(buf + len, sizeof(buf) - len, "\n"); |
732 | ||
733 | ath9k_calculate_iter_data(hw, NULL, &iter_data); | |
734 | ||
735 | len += snprintf(buf + len, sizeof(buf) - len, | |
736 | "VIF-COUNTS: AP: %i STA: %i MESH: %i WDS: %i" | |
bcf6f96e | 737 | " ADHOC: %i TOTAL: %hi BEACON-VIF: %hi\n", |
55f6d0ff | 738 | iter_data.naps, iter_data.nstations, iter_data.nmeshes, |
bcf6f96e | 739 | iter_data.nwds, iter_data.nadhocs, |
55f6d0ff BG |
740 | sc->nvifs, sc->nbcnvifs); |
741 | ||
6bcf6f64 SM |
742 | if (len > sizeof(buf)) |
743 | len = sizeof(buf); | |
55f6d0ff BG |
744 | |
745 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | |
55f6d0ff BG |
746 | return retval; |
747 | } | |
748 | ||
f8b815dc SM |
749 | static ssize_t read_file_reset(struct file *file, char __user *user_buf, |
750 | size_t count, loff_t *ppos) | |
751 | { | |
752 | struct ath_softc *sc = file->private_data; | |
753 | char buf[512]; | |
754 | unsigned int len = 0; | |
755 | ||
756 | len += snprintf(buf + len, sizeof(buf) - len, | |
757 | "%17s: %2d\n", "Baseband Hang", | |
758 | sc->debug.stats.reset[RESET_TYPE_BB_HANG]); | |
759 | len += snprintf(buf + len, sizeof(buf) - len, | |
760 | "%17s: %2d\n", "Baseband Watchdog", | |
761 | sc->debug.stats.reset[RESET_TYPE_BB_WATCHDOG]); | |
762 | len += snprintf(buf + len, sizeof(buf) - len, | |
763 | "%17s: %2d\n", "Fatal HW Error", | |
764 | sc->debug.stats.reset[RESET_TYPE_FATAL_INT]); | |
765 | len += snprintf(buf + len, sizeof(buf) - len, | |
766 | "%17s: %2d\n", "TX HW error", | |
767 | sc->debug.stats.reset[RESET_TYPE_TX_ERROR]); | |
768 | len += snprintf(buf + len, sizeof(buf) - len, | |
769 | "%17s: %2d\n", "TX Path Hang", | |
770 | sc->debug.stats.reset[RESET_TYPE_TX_HANG]); | |
771 | len += snprintf(buf + len, sizeof(buf) - len, | |
772 | "%17s: %2d\n", "PLL RX Hang", | |
773 | sc->debug.stats.reset[RESET_TYPE_PLL_HANG]); | |
b88083bf RM |
774 | len += snprintf(buf + len, sizeof(buf) - len, |
775 | "%17s: %2d\n", "MCI Reset", | |
776 | sc->debug.stats.reset[RESET_TYPE_MCI]); | |
f8b815dc SM |
777 | |
778 | if (len > sizeof(buf)) | |
779 | len = sizeof(buf); | |
780 | ||
781 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | |
782 | } | |
783 | ||
066dae93 | 784 | void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf, |
55797b1a FF |
785 | struct ath_tx_status *ts, struct ath_txq *txq, |
786 | unsigned int flags) | |
fec247c0 | 787 | { |
5bec3e5a | 788 | int qnum = txq->axq_qnum; |
066dae93 FF |
789 | |
790 | TX_STAT_INC(qnum, tx_pkts_all); | |
791 | sc->debug.stats.txstats[qnum].tx_bytes_all += bf->bf_mpdu->len; | |
99c15bf5 | 792 | |
fec247c0 | 793 | if (bf_isampdu(bf)) { |
156369fa | 794 | if (flags & ATH_TX_ERROR) |
066dae93 | 795 | TX_STAT_INC(qnum, a_xretries); |
fec247c0 | 796 | else |
066dae93 | 797 | TX_STAT_INC(qnum, a_completed); |
fec247c0 | 798 | } else { |
55797b1a | 799 | if (ts->ts_status & ATH9K_TXERR_XRETRY) |
5a6f78af FF |
800 | TX_STAT_INC(qnum, xretries); |
801 | else | |
802 | TX_STAT_INC(qnum, completed); | |
fec247c0 S |
803 | } |
804 | ||
4d900389 BG |
805 | if (ts->ts_status & ATH9K_TXERR_FILT) |
806 | TX_STAT_INC(qnum, txerr_filtered); | |
db1a052b | 807 | if (ts->ts_status & ATH9K_TXERR_FIFO) |
066dae93 | 808 | TX_STAT_INC(qnum, fifo_underrun); |
db1a052b | 809 | if (ts->ts_status & ATH9K_TXERR_XTXOP) |
066dae93 | 810 | TX_STAT_INC(qnum, xtxop); |
db1a052b | 811 | if (ts->ts_status & ATH9K_TXERR_TIMER_EXPIRED) |
066dae93 | 812 | TX_STAT_INC(qnum, timer_exp); |
db1a052b | 813 | if (ts->ts_flags & ATH9K_TX_DESC_CFG_ERR) |
066dae93 | 814 | TX_STAT_INC(qnum, desc_cfg_err); |
db1a052b | 815 | if (ts->ts_flags & ATH9K_TX_DATA_UNDERRUN) |
066dae93 | 816 | TX_STAT_INC(qnum, data_underrun); |
db1a052b | 817 | if (ts->ts_flags & ATH9K_TX_DELIM_UNDERRUN) |
066dae93 | 818 | TX_STAT_INC(qnum, delim_underrun); |
fec247c0 S |
819 | } |
820 | ||
821 | static const struct file_operations fops_xmit = { | |
822 | .read = read_file_xmit, | |
234e3405 | 823 | .open = simple_open, |
6038f373 AB |
824 | .owner = THIS_MODULE, |
825 | .llseek = default_llseek, | |
fec247c0 | 826 | }; |
39d89cd3 | 827 | |
c0b74876 SM |
828 | static const struct file_operations fops_queues = { |
829 | .read = read_file_queues, | |
830 | .open = simple_open, | |
831 | .owner = THIS_MODULE, | |
832 | .llseek = default_llseek, | |
833 | }; | |
834 | ||
55f6d0ff BG |
835 | static const struct file_operations fops_misc = { |
836 | .read = read_file_misc, | |
234e3405 | 837 | .open = simple_open, |
55f6d0ff BG |
838 | .owner = THIS_MODULE, |
839 | .llseek = default_llseek, | |
840 | }; | |
841 | ||
f8b815dc SM |
842 | static const struct file_operations fops_reset = { |
843 | .read = read_file_reset, | |
234e3405 | 844 | .open = simple_open, |
f8b815dc SM |
845 | .owner = THIS_MODULE, |
846 | .llseek = default_llseek, | |
847 | }; | |
848 | ||
1395d3f0 S |
849 | static ssize_t read_file_recv(struct file *file, char __user *user_buf, |
850 | size_t count, loff_t *ppos) | |
851 | { | |
852 | #define PHY_ERR(s, p) \ | |
4203214e | 853 | len += snprintf(buf + len, size - len, "%22s : %10u\n", s, \ |
1395d3f0 S |
854 | sc->debug.stats.rxstats.phy_err_stats[p]); |
855 | ||
24a0731e BG |
856 | #define RXS_ERR(s, e) \ |
857 | do { \ | |
858 | len += snprintf(buf + len, size - len, \ | |
859 | "%22s : %10u\n", s, \ | |
860 | sc->debug.stats.rxstats.e); \ | |
861 | } while (0) | |
862 | ||
1395d3f0 S |
863 | struct ath_softc *sc = file->private_data; |
864 | char *buf; | |
4203214e | 865 | unsigned int len = 0, size = 1600; |
1395d3f0 S |
866 | ssize_t retval = 0; |
867 | ||
868 | buf = kzalloc(size, GFP_KERNEL); | |
869 | if (buf == NULL) | |
04236066 | 870 | return -ENOMEM; |
1395d3f0 | 871 | |
24a0731e BG |
872 | RXS_ERR("CRC ERR", crc_err); |
873 | RXS_ERR("DECRYPT CRC ERR", decrypt_crc_err); | |
874 | RXS_ERR("PHY ERR", phy_err); | |
875 | RXS_ERR("MIC ERR", mic_err); | |
876 | RXS_ERR("PRE-DELIM CRC ERR", pre_delim_crc_err); | |
877 | RXS_ERR("POST-DELIM CRC ERR", post_delim_crc_err); | |
878 | RXS_ERR("DECRYPT BUSY ERR", decrypt_busy_err); | |
879 | RXS_ERR("RX-LENGTH-ERR", rx_len_err); | |
880 | RXS_ERR("RX-OOM-ERR", rx_oom_err); | |
881 | RXS_ERR("RX-RATE-ERR", rx_rate_err); | |
24a0731e | 882 | RXS_ERR("RX-TOO-MANY-FRAGS", rx_too_many_frags_err); |
1395d3f0 | 883 | |
4203214e SM |
884 | PHY_ERR("UNDERRUN ERR", ATH9K_PHYERR_UNDERRUN); |
885 | PHY_ERR("TIMING ERR", ATH9K_PHYERR_TIMING); | |
886 | PHY_ERR("PARITY ERR", ATH9K_PHYERR_PARITY); | |
887 | PHY_ERR("RATE ERR", ATH9K_PHYERR_RATE); | |
888 | PHY_ERR("LENGTH ERR", ATH9K_PHYERR_LENGTH); | |
889 | PHY_ERR("RADAR ERR", ATH9K_PHYERR_RADAR); | |
890 | PHY_ERR("SERVICE ERR", ATH9K_PHYERR_SERVICE); | |
891 | PHY_ERR("TOR ERR", ATH9K_PHYERR_TOR); | |
892 | PHY_ERR("OFDM-TIMING ERR", ATH9K_PHYERR_OFDM_TIMING); | |
893 | PHY_ERR("OFDM-SIGNAL-PARITY ERR", ATH9K_PHYERR_OFDM_SIGNAL_PARITY); | |
894 | PHY_ERR("OFDM-RATE ERR", ATH9K_PHYERR_OFDM_RATE_ILLEGAL); | |
895 | PHY_ERR("OFDM-LENGTH ERR", ATH9K_PHYERR_OFDM_LENGTH_ILLEGAL); | |
896 | PHY_ERR("OFDM-POWER-DROP ERR", ATH9K_PHYERR_OFDM_POWER_DROP); | |
897 | PHY_ERR("OFDM-SERVICE ERR", ATH9K_PHYERR_OFDM_SERVICE); | |
898 | PHY_ERR("OFDM-RESTART ERR", ATH9K_PHYERR_OFDM_RESTART); | |
899 | PHY_ERR("FALSE-RADAR-EXT ERR", ATH9K_PHYERR_FALSE_RADAR_EXT); | |
900 | PHY_ERR("CCK-TIMING ERR", ATH9K_PHYERR_CCK_TIMING); | |
901 | PHY_ERR("CCK-HEADER-CRC ERR", ATH9K_PHYERR_CCK_HEADER_CRC); | |
902 | PHY_ERR("CCK-RATE ERR", ATH9K_PHYERR_CCK_RATE_ILLEGAL); | |
903 | PHY_ERR("CCK-SERVICE ERR", ATH9K_PHYERR_CCK_SERVICE); | |
904 | PHY_ERR("CCK-RESTART ERR", ATH9K_PHYERR_CCK_RESTART); | |
905 | PHY_ERR("CCK-LENGTH ERR", ATH9K_PHYERR_CCK_LENGTH_ILLEGAL); | |
906 | PHY_ERR("CCK-POWER-DROP ERR", ATH9K_PHYERR_CCK_POWER_DROP); | |
907 | PHY_ERR("HT-CRC ERR", ATH9K_PHYERR_HT_CRC_ERROR); | |
908 | PHY_ERR("HT-LENGTH ERR", ATH9K_PHYERR_HT_LENGTH_ILLEGAL); | |
909 | PHY_ERR("HT-RATE ERR", ATH9K_PHYERR_HT_RATE_ILLEGAL); | |
910 | ||
24a0731e BG |
911 | RXS_ERR("RX-Pkts-All", rx_pkts_all); |
912 | RXS_ERR("RX-Bytes-All", rx_bytes_all); | |
913 | RXS_ERR("RX-Beacons", rx_beacons); | |
914 | RXS_ERR("RX-Frags", rx_frags); | |
9b99e665 | 915 | RXS_ERR("RX-Spectral", rx_spectral); |
99c15bf5 | 916 | |
2b87f3aa DC |
917 | if (len > size) |
918 | len = size; | |
919 | ||
1395d3f0 S |
920 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); |
921 | kfree(buf); | |
922 | ||
923 | return retval; | |
924 | ||
24a0731e | 925 | #undef RXS_ERR |
1395d3f0 S |
926 | #undef PHY_ERR |
927 | } | |
928 | ||
8e6f5aa2 | 929 | void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs) |
1395d3f0 | 930 | { |
1395d3f0 S |
931 | #define RX_PHY_ERR_INC(c) sc->debug.stats.rxstats.phy_err_stats[c]++ |
932 | ||
99c15bf5 BG |
933 | RX_STAT_INC(rx_pkts_all); |
934 | sc->debug.stats.rxstats.rx_bytes_all += rs->rs_datalen; | |
935 | ||
8e6f5aa2 | 936 | if (rs->rs_status & ATH9K_RXERR_CRC) |
1395d3f0 | 937 | RX_STAT_INC(crc_err); |
8e6f5aa2 | 938 | if (rs->rs_status & ATH9K_RXERR_DECRYPT) |
1395d3f0 | 939 | RX_STAT_INC(decrypt_crc_err); |
8e6f5aa2 | 940 | if (rs->rs_status & ATH9K_RXERR_MIC) |
1395d3f0 | 941 | RX_STAT_INC(mic_err); |
8e6f5aa2 | 942 | if (rs->rs_status & ATH9K_RX_DELIM_CRC_PRE) |
1395d3f0 | 943 | RX_STAT_INC(pre_delim_crc_err); |
8e6f5aa2 | 944 | if (rs->rs_status & ATH9K_RX_DELIM_CRC_POST) |
1395d3f0 | 945 | RX_STAT_INC(post_delim_crc_err); |
8e6f5aa2 | 946 | if (rs->rs_status & ATH9K_RX_DECRYPT_BUSY) |
1395d3f0 S |
947 | RX_STAT_INC(decrypt_busy_err); |
948 | ||
8e6f5aa2 | 949 | if (rs->rs_status & ATH9K_RXERR_PHY) { |
1395d3f0 | 950 | RX_STAT_INC(phy_err); |
dbb07f00 SM |
951 | if (rs->rs_phyerr < ATH9K_PHYERR_MAX) |
952 | RX_PHY_ERR_INC(rs->rs_phyerr); | |
1395d3f0 S |
953 | } |
954 | ||
1395d3f0 S |
955 | #undef RX_PHY_ERR_INC |
956 | } | |
957 | ||
958 | static const struct file_operations fops_recv = { | |
959 | .read = read_file_recv, | |
234e3405 | 960 | .open = simple_open, |
6038f373 AB |
961 | .owner = THIS_MODULE, |
962 | .llseek = default_llseek, | |
1395d3f0 S |
963 | }; |
964 | ||
e93d083f SW |
965 | static ssize_t read_file_spec_scan_ctl(struct file *file, char __user *user_buf, |
966 | size_t count, loff_t *ppos) | |
967 | { | |
968 | struct ath_softc *sc = file->private_data; | |
969 | char *mode = ""; | |
970 | unsigned int len; | |
971 | ||
972 | switch (sc->spectral_mode) { | |
973 | case SPECTRAL_DISABLED: | |
974 | mode = "disable"; | |
975 | break; | |
976 | case SPECTRAL_BACKGROUND: | |
977 | mode = "background"; | |
978 | break; | |
979 | case SPECTRAL_CHANSCAN: | |
980 | mode = "chanscan"; | |
981 | break; | |
982 | case SPECTRAL_MANUAL: | |
983 | mode = "manual"; | |
984 | break; | |
985 | } | |
986 | len = strlen(mode); | |
987 | return simple_read_from_buffer(user_buf, count, ppos, mode, len); | |
988 | } | |
989 | ||
990 | static ssize_t write_file_spec_scan_ctl(struct file *file, | |
991 | const char __user *user_buf, | |
992 | size_t count, loff_t *ppos) | |
993 | { | |
994 | struct ath_softc *sc = file->private_data; | |
995 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | |
996 | char buf[32]; | |
997 | ssize_t len; | |
998 | ||
999 | len = min(count, sizeof(buf) - 1); | |
1000 | if (copy_from_user(buf, user_buf, len)) | |
1001 | return -EFAULT; | |
1002 | ||
1003 | buf[len] = '\0'; | |
1004 | ||
1005 | if (strncmp("trigger", buf, 7) == 0) { | |
1006 | ath9k_spectral_scan_trigger(sc->hw); | |
1007 | } else if (strncmp("background", buf, 9) == 0) { | |
1008 | ath9k_spectral_scan_config(sc->hw, SPECTRAL_BACKGROUND); | |
1009 | ath_dbg(common, CONFIG, "spectral scan: background mode enabled\n"); | |
1010 | } else if (strncmp("chanscan", buf, 8) == 0) { | |
1011 | ath9k_spectral_scan_config(sc->hw, SPECTRAL_CHANSCAN); | |
1012 | ath_dbg(common, CONFIG, "spectral scan: channel scan mode enabled\n"); | |
1013 | } else if (strncmp("manual", buf, 6) == 0) { | |
1014 | ath9k_spectral_scan_config(sc->hw, SPECTRAL_MANUAL); | |
1015 | ath_dbg(common, CONFIG, "spectral scan: manual mode enabled\n"); | |
1016 | } else if (strncmp("disable", buf, 7) == 0) { | |
1017 | ath9k_spectral_scan_config(sc->hw, SPECTRAL_DISABLED); | |
1018 | ath_dbg(common, CONFIG, "spectral scan: disabled\n"); | |
1019 | } else { | |
1020 | return -EINVAL; | |
1021 | } | |
1022 | ||
1023 | return count; | |
1024 | } | |
1025 | ||
1026 | static const struct file_operations fops_spec_scan_ctl = { | |
1027 | .read = read_file_spec_scan_ctl, | |
1028 | .write = write_file_spec_scan_ctl, | |
1029 | .open = simple_open, | |
1030 | .owner = THIS_MODULE, | |
1031 | .llseek = default_llseek, | |
1032 | }; | |
1033 | ||
04ccd4a1 SW |
1034 | static ssize_t read_file_spectral_short_repeat(struct file *file, |
1035 | char __user *user_buf, | |
1036 | size_t count, loff_t *ppos) | |
1037 | { | |
1038 | struct ath_softc *sc = file->private_data; | |
1039 | char buf[32]; | |
1040 | unsigned int len; | |
1041 | ||
1042 | len = sprintf(buf, "%d\n", sc->spec_config.short_repeat); | |
1043 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | |
1044 | } | |
1045 | ||
1046 | static ssize_t write_file_spectral_short_repeat(struct file *file, | |
1047 | const char __user *user_buf, | |
1048 | size_t count, loff_t *ppos) | |
1049 | { | |
1050 | struct ath_softc *sc = file->private_data; | |
1051 | unsigned long val; | |
1052 | char buf[32]; | |
1053 | ssize_t len; | |
1054 | ||
1055 | len = min(count, sizeof(buf) - 1); | |
1056 | if (copy_from_user(buf, user_buf, len)) | |
1057 | return -EFAULT; | |
1058 | ||
1059 | buf[len] = '\0'; | |
1060 | if (kstrtoul(buf, 0, &val)) | |
1061 | return -EINVAL; | |
1062 | ||
1063 | if (val < 0 || val > 1) | |
1064 | return -EINVAL; | |
1065 | ||
1066 | sc->spec_config.short_repeat = val; | |
1067 | return count; | |
1068 | } | |
1069 | ||
1070 | static const struct file_operations fops_spectral_short_repeat = { | |
1071 | .read = read_file_spectral_short_repeat, | |
1072 | .write = write_file_spectral_short_repeat, | |
1073 | .open = simple_open, | |
1074 | .owner = THIS_MODULE, | |
1075 | .llseek = default_llseek, | |
1076 | }; | |
1077 | ||
1078 | static ssize_t read_file_spectral_count(struct file *file, | |
1079 | char __user *user_buf, | |
1080 | size_t count, loff_t *ppos) | |
1081 | { | |
1082 | struct ath_softc *sc = file->private_data; | |
1083 | char buf[32]; | |
1084 | unsigned int len; | |
1085 | ||
1086 | len = sprintf(buf, "%d\n", sc->spec_config.count); | |
1087 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | |
1088 | } | |
1089 | ||
1090 | static ssize_t write_file_spectral_count(struct file *file, | |
1091 | const char __user *user_buf, | |
1092 | size_t count, loff_t *ppos) | |
1093 | { | |
1094 | struct ath_softc *sc = file->private_data; | |
1095 | unsigned long val; | |
1096 | char buf[32]; | |
1097 | ssize_t len; | |
1098 | ||
1099 | len = min(count, sizeof(buf) - 1); | |
1100 | if (copy_from_user(buf, user_buf, len)) | |
1101 | return -EFAULT; | |
1102 | ||
1103 | buf[len] = '\0'; | |
1104 | if (kstrtoul(buf, 0, &val)) | |
1105 | return -EINVAL; | |
1106 | ||
1107 | if (val < 0 || val > 255) | |
1108 | return -EINVAL; | |
1109 | ||
1110 | sc->spec_config.count = val; | |
1111 | return count; | |
1112 | } | |
1113 | ||
1114 | static const struct file_operations fops_spectral_count = { | |
1115 | .read = read_file_spectral_count, | |
1116 | .write = write_file_spectral_count, | |
1117 | .open = simple_open, | |
1118 | .owner = THIS_MODULE, | |
1119 | .llseek = default_llseek, | |
1120 | }; | |
1121 | ||
1122 | static ssize_t read_file_spectral_period(struct file *file, | |
1123 | char __user *user_buf, | |
1124 | size_t count, loff_t *ppos) | |
1125 | { | |
1126 | struct ath_softc *sc = file->private_data; | |
1127 | char buf[32]; | |
1128 | unsigned int len; | |
1129 | ||
1130 | len = sprintf(buf, "%d\n", sc->spec_config.period); | |
1131 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | |
1132 | } | |
1133 | ||
1134 | static ssize_t write_file_spectral_period(struct file *file, | |
1135 | const char __user *user_buf, | |
1136 | size_t count, loff_t *ppos) | |
1137 | { | |
1138 | struct ath_softc *sc = file->private_data; | |
1139 | unsigned long val; | |
1140 | char buf[32]; | |
1141 | ssize_t len; | |
1142 | ||
1143 | len = min(count, sizeof(buf) - 1); | |
1144 | if (copy_from_user(buf, user_buf, len)) | |
1145 | return -EFAULT; | |
1146 | ||
1147 | buf[len] = '\0'; | |
1148 | if (kstrtoul(buf, 0, &val)) | |
1149 | return -EINVAL; | |
1150 | ||
1151 | if (val < 0 || val > 255) | |
1152 | return -EINVAL; | |
1153 | ||
1154 | sc->spec_config.period = val; | |
1155 | return count; | |
1156 | } | |
1157 | ||
1158 | static const struct file_operations fops_spectral_period = { | |
1159 | .read = read_file_spectral_period, | |
1160 | .write = write_file_spectral_period, | |
1161 | .open = simple_open, | |
1162 | .owner = THIS_MODULE, | |
1163 | .llseek = default_llseek, | |
1164 | }; | |
1165 | ||
1166 | static ssize_t read_file_spectral_fft_period(struct file *file, | |
1167 | char __user *user_buf, | |
1168 | size_t count, loff_t *ppos) | |
1169 | { | |
1170 | struct ath_softc *sc = file->private_data; | |
1171 | char buf[32]; | |
1172 | unsigned int len; | |
1173 | ||
1174 | len = sprintf(buf, "%d\n", sc->spec_config.fft_period); | |
1175 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | |
1176 | } | |
1177 | ||
1178 | static ssize_t write_file_spectral_fft_period(struct file *file, | |
1179 | const char __user *user_buf, | |
1180 | size_t count, loff_t *ppos) | |
1181 | { | |
1182 | struct ath_softc *sc = file->private_data; | |
1183 | unsigned long val; | |
1184 | char buf[32]; | |
1185 | ssize_t len; | |
1186 | ||
1187 | len = min(count, sizeof(buf) - 1); | |
1188 | if (copy_from_user(buf, user_buf, len)) | |
1189 | return -EFAULT; | |
1190 | ||
1191 | buf[len] = '\0'; | |
1192 | if (kstrtoul(buf, 0, &val)) | |
1193 | return -EINVAL; | |
1194 | ||
1195 | if (val < 0 || val > 15) | |
1196 | return -EINVAL; | |
1197 | ||
1198 | sc->spec_config.fft_period = val; | |
1199 | return count; | |
1200 | } | |
1201 | ||
1202 | static const struct file_operations fops_spectral_fft_period = { | |
1203 | .read = read_file_spectral_fft_period, | |
1204 | .write = write_file_spectral_fft_period, | |
1205 | .open = simple_open, | |
1206 | .owner = THIS_MODULE, | |
1207 | .llseek = default_llseek, | |
1208 | }; | |
1209 | ||
e93d083f SW |
1210 | static struct dentry *create_buf_file_handler(const char *filename, |
1211 | struct dentry *parent, | |
1212 | umode_t mode, | |
1213 | struct rchan_buf *buf, | |
1214 | int *is_global) | |
1215 | { | |
1216 | struct dentry *buf_file; | |
1217 | ||
1218 | buf_file = debugfs_create_file(filename, mode, parent, buf, | |
1219 | &relay_file_operations); | |
1220 | *is_global = 1; | |
1221 | return buf_file; | |
1222 | } | |
1223 | ||
1224 | static int remove_buf_file_handler(struct dentry *dentry) | |
1225 | { | |
1226 | debugfs_remove(dentry); | |
1227 | ||
1228 | return 0; | |
1229 | } | |
1230 | ||
1231 | void ath_debug_send_fft_sample(struct ath_softc *sc, | |
1232 | struct fft_sample_tlv *fft_sample_tlv) | |
1233 | { | |
4ab0b0aa | 1234 | int length; |
e93d083f SW |
1235 | if (!sc->rfs_chan_spec_scan) |
1236 | return; | |
1237 | ||
4ab0b0aa SE |
1238 | length = __be16_to_cpu(fft_sample_tlv->length) + |
1239 | sizeof(*fft_sample_tlv); | |
1240 | relay_write(sc->rfs_chan_spec_scan, fft_sample_tlv, length); | |
e93d083f SW |
1241 | } |
1242 | ||
1243 | static struct rchan_callbacks rfs_spec_scan_cb = { | |
1244 | .create_buf_file = create_buf_file_handler, | |
1245 | .remove_buf_file = remove_buf_file_handler, | |
1246 | }; | |
1247 | ||
1248 | ||
9bff0bc4 FF |
1249 | static ssize_t read_file_regidx(struct file *file, char __user *user_buf, |
1250 | size_t count, loff_t *ppos) | |
1251 | { | |
1252 | struct ath_softc *sc = file->private_data; | |
1253 | char buf[32]; | |
1254 | unsigned int len; | |
1255 | ||
2b87f3aa | 1256 | len = sprintf(buf, "0x%08x\n", sc->debug.regidx); |
9bff0bc4 FF |
1257 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
1258 | } | |
1259 | ||
1260 | static ssize_t write_file_regidx(struct file *file, const char __user *user_buf, | |
1261 | size_t count, loff_t *ppos) | |
1262 | { | |
1263 | struct ath_softc *sc = file->private_data; | |
1264 | unsigned long regidx; | |
1265 | char buf[32]; | |
1266 | ssize_t len; | |
1267 | ||
1268 | len = min(count, sizeof(buf) - 1); | |
1269 | if (copy_from_user(buf, user_buf, len)) | |
04236066 | 1270 | return -EFAULT; |
9bff0bc4 FF |
1271 | |
1272 | buf[len] = '\0'; | |
27d7f477 | 1273 | if (kstrtoul(buf, 0, ®idx)) |
9bff0bc4 FF |
1274 | return -EINVAL; |
1275 | ||
1276 | sc->debug.regidx = regidx; | |
1277 | return count; | |
1278 | } | |
1279 | ||
1280 | static const struct file_operations fops_regidx = { | |
1281 | .read = read_file_regidx, | |
1282 | .write = write_file_regidx, | |
234e3405 | 1283 | .open = simple_open, |
6038f373 AB |
1284 | .owner = THIS_MODULE, |
1285 | .llseek = default_llseek, | |
9bff0bc4 FF |
1286 | }; |
1287 | ||
1288 | static ssize_t read_file_regval(struct file *file, char __user *user_buf, | |
1289 | size_t count, loff_t *ppos) | |
1290 | { | |
1291 | struct ath_softc *sc = file->private_data; | |
1292 | struct ath_hw *ah = sc->sc_ah; | |
1293 | char buf[32]; | |
1294 | unsigned int len; | |
1295 | u32 regval; | |
1296 | ||
79d2b157 | 1297 | ath9k_ps_wakeup(sc); |
9bff0bc4 | 1298 | regval = REG_READ_D(ah, sc->debug.regidx); |
79d2b157 | 1299 | ath9k_ps_restore(sc); |
2b87f3aa | 1300 | len = sprintf(buf, "0x%08x\n", regval); |
9bff0bc4 FF |
1301 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
1302 | } | |
1303 | ||
1304 | static ssize_t write_file_regval(struct file *file, const char __user *user_buf, | |
1305 | size_t count, loff_t *ppos) | |
1306 | { | |
1307 | struct ath_softc *sc = file->private_data; | |
1308 | struct ath_hw *ah = sc->sc_ah; | |
1309 | unsigned long regval; | |
1310 | char buf[32]; | |
1311 | ssize_t len; | |
1312 | ||
1313 | len = min(count, sizeof(buf) - 1); | |
1314 | if (copy_from_user(buf, user_buf, len)) | |
04236066 | 1315 | return -EFAULT; |
9bff0bc4 FF |
1316 | |
1317 | buf[len] = '\0'; | |
27d7f477 | 1318 | if (kstrtoul(buf, 0, ®val)) |
9bff0bc4 FF |
1319 | return -EINVAL; |
1320 | ||
79d2b157 | 1321 | ath9k_ps_wakeup(sc); |
9bff0bc4 | 1322 | REG_WRITE_D(ah, sc->debug.regidx, regval); |
79d2b157 | 1323 | ath9k_ps_restore(sc); |
9bff0bc4 FF |
1324 | return count; |
1325 | } | |
1326 | ||
1327 | static const struct file_operations fops_regval = { | |
1328 | .read = read_file_regval, | |
1329 | .write = write_file_regval, | |
234e3405 | 1330 | .open = simple_open, |
6038f373 AB |
1331 | .owner = THIS_MODULE, |
1332 | .llseek = default_llseek, | |
9bff0bc4 FF |
1333 | }; |
1334 | ||
582d0064 VT |
1335 | #define REGDUMP_LINE_SIZE 20 |
1336 | ||
1337 | static int open_file_regdump(struct inode *inode, struct file *file) | |
1338 | { | |
1339 | struct ath_softc *sc = inode->i_private; | |
1340 | unsigned int len = 0; | |
1341 | u8 *buf; | |
1342 | int i; | |
1343 | unsigned long num_regs, regdump_len, max_reg_offset; | |
1344 | ||
1345 | max_reg_offset = AR_SREV_9300_20_OR_LATER(sc->sc_ah) ? 0x16bd4 : 0xb500; | |
1346 | num_regs = max_reg_offset / 4 + 1; | |
1347 | regdump_len = num_regs * REGDUMP_LINE_SIZE + 1; | |
1348 | buf = vmalloc(regdump_len); | |
1349 | if (!buf) | |
1350 | return -ENOMEM; | |
1351 | ||
1352 | ath9k_ps_wakeup(sc); | |
1353 | for (i = 0; i < num_regs; i++) | |
1354 | len += scnprintf(buf + len, regdump_len - len, | |
1355 | "0x%06x 0x%08x\n", i << 2, REG_READ(sc->sc_ah, i << 2)); | |
1356 | ath9k_ps_restore(sc); | |
1357 | ||
1358 | file->private_data = buf; | |
1359 | ||
1360 | return 0; | |
1361 | } | |
1362 | ||
1363 | static const struct file_operations fops_regdump = { | |
1364 | .open = open_file_regdump, | |
1365 | .read = ath9k_debugfs_read_buf, | |
1366 | .release = ath9k_debugfs_release_buf, | |
1367 | .owner = THIS_MODULE, | |
1368 | .llseek = default_llseek,/* read accesses f_pos */ | |
1369 | }; | |
1370 | ||
d069a46b RM |
1371 | static ssize_t read_file_dump_nfcal(struct file *file, char __user *user_buf, |
1372 | size_t count, loff_t *ppos) | |
1373 | { | |
1374 | struct ath_softc *sc = file->private_data; | |
1375 | struct ath_hw *ah = sc->sc_ah; | |
1376 | struct ath9k_nfcal_hist *h = sc->caldata.nfCalHist; | |
1377 | struct ath_common *common = ath9k_hw_common(ah); | |
1378 | struct ieee80211_conf *conf = &common->hw->conf; | |
1379 | u32 len = 0, size = 1500; | |
1380 | u32 i, j; | |
1381 | ssize_t retval = 0; | |
1382 | char *buf; | |
1383 | u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask; | |
1384 | u8 nread; | |
1385 | ||
1386 | buf = kzalloc(size, GFP_KERNEL); | |
1387 | if (!buf) | |
1388 | return -ENOMEM; | |
1389 | ||
1390 | len += snprintf(buf + len, size - len, | |
1391 | "Channel Noise Floor : %d\n", ah->noise); | |
1392 | len += snprintf(buf + len, size - len, | |
1393 | "Chain | privNF | # Readings | NF Readings\n"); | |
1394 | for (i = 0; i < NUM_NF_READINGS; i++) { | |
1395 | if (!(chainmask & (1 << i)) || | |
1396 | ((i >= AR5416_MAX_CHAINS) && !conf_is_ht40(conf))) | |
1397 | continue; | |
1398 | ||
1399 | nread = AR_PHY_CCA_FILTERWINDOW_LENGTH - h[i].invalidNFcount; | |
1400 | len += snprintf(buf + len, size - len, " %d\t %d\t %d\t\t", | |
1401 | i, h[i].privNF, nread); | |
1402 | for (j = 0; j < nread; j++) | |
1403 | len += snprintf(buf + len, size - len, | |
1404 | " %d", h[i].nfCalBuffer[j]); | |
1405 | len += snprintf(buf + len, size - len, "\n"); | |
1406 | } | |
1407 | ||
1408 | if (len > size) | |
1409 | len = size; | |
1410 | ||
1411 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | |
1412 | kfree(buf); | |
1413 | ||
1414 | return retval; | |
1415 | } | |
1416 | ||
1417 | static const struct file_operations fops_dump_nfcal = { | |
1418 | .read = read_file_dump_nfcal, | |
234e3405 | 1419 | .open = simple_open, |
d069a46b RM |
1420 | .owner = THIS_MODULE, |
1421 | .llseek = default_llseek, | |
1422 | }; | |
1423 | ||
580f010f RM |
1424 | static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf, |
1425 | size_t count, loff_t *ppos) | |
1426 | { | |
1427 | struct ath_softc *sc = file->private_data; | |
1428 | struct ath_hw *ah = sc->sc_ah; | |
1429 | u32 len = 0, size = 1500; | |
1430 | ssize_t retval = 0; | |
1431 | char *buf; | |
1432 | ||
1433 | buf = kzalloc(size, GFP_KERNEL); | |
1434 | if (!buf) | |
1435 | return -ENOMEM; | |
1436 | ||
1437 | len = ah->eep_ops->dump_eeprom(ah, true, buf, len, size); | |
1438 | ||
1439 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | |
1440 | kfree(buf); | |
1441 | ||
1442 | return retval; | |
1443 | } | |
1444 | ||
1445 | static const struct file_operations fops_base_eeprom = { | |
1446 | .read = read_file_base_eeprom, | |
234e3405 | 1447 | .open = simple_open, |
580f010f RM |
1448 | .owner = THIS_MODULE, |
1449 | .llseek = default_llseek, | |
1450 | }; | |
1451 | ||
3f4c4bdd RM |
1452 | static ssize_t read_file_modal_eeprom(struct file *file, char __user *user_buf, |
1453 | size_t count, loff_t *ppos) | |
1454 | { | |
1455 | struct ath_softc *sc = file->private_data; | |
1456 | struct ath_hw *ah = sc->sc_ah; | |
1457 | u32 len = 0, size = 6000; | |
1458 | char *buf; | |
1459 | size_t retval; | |
1460 | ||
1461 | buf = kzalloc(size, GFP_KERNEL); | |
1462 | if (buf == NULL) | |
1463 | return -ENOMEM; | |
1464 | ||
1465 | len = ah->eep_ops->dump_eeprom(ah, false, buf, len, size); | |
1466 | ||
1467 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | |
1468 | kfree(buf); | |
1469 | ||
1470 | return retval; | |
1471 | } | |
1472 | ||
1473 | static const struct file_operations fops_modal_eeprom = { | |
1474 | .read = read_file_modal_eeprom, | |
234e3405 | 1475 | .open = simple_open, |
3f4c4bdd RM |
1476 | .owner = THIS_MODULE, |
1477 | .llseek = default_llseek, | |
1478 | }; | |
1479 | ||
4df50ca8 RM |
1480 | #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT |
1481 | static ssize_t read_file_btcoex(struct file *file, char __user *user_buf, | |
1482 | size_t count, loff_t *ppos) | |
1483 | { | |
1484 | struct ath_softc *sc = file->private_data; | |
1485 | u32 len = 0, size = 1500; | |
1486 | char *buf; | |
1487 | size_t retval; | |
1488 | ||
1489 | buf = kzalloc(size, GFP_KERNEL); | |
1490 | if (buf == NULL) | |
1491 | return -ENOMEM; | |
1492 | ||
ac46ba43 SM |
1493 | if (!sc->sc_ah->common.btcoex_enabled) { |
1494 | len = snprintf(buf, size, "%s\n", | |
1495 | "BTCOEX is disabled"); | |
1496 | goto exit; | |
1497 | } | |
4df50ca8 | 1498 | |
ac46ba43 SM |
1499 | len = ath9k_dump_btcoex(sc, buf, size); |
1500 | exit: | |
4df50ca8 RM |
1501 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); |
1502 | kfree(buf); | |
1503 | ||
1504 | return retval; | |
1505 | } | |
1506 | ||
1507 | static const struct file_operations fops_btcoex = { | |
1508 | .read = read_file_btcoex, | |
1509 | .open = simple_open, | |
1510 | .owner = THIS_MODULE, | |
1511 | .llseek = default_llseek, | |
1512 | }; | |
1513 | #endif | |
1514 | ||
a145daf7 SM |
1515 | static ssize_t read_file_node_stat(struct file *file, char __user *user_buf, |
1516 | size_t count, loff_t *ppos) | |
1517 | { | |
1518 | struct ath_node *an = file->private_data; | |
1519 | struct ath_softc *sc = an->sc; | |
1520 | struct ath_atx_tid *tid; | |
1521 | struct ath_atx_ac *ac; | |
1522 | struct ath_txq *txq; | |
1523 | u32 len = 0, size = 4096; | |
1524 | char *buf; | |
1525 | size_t retval; | |
1526 | int tidno, acno; | |
1527 | ||
1528 | buf = kzalloc(size, GFP_KERNEL); | |
1529 | if (buf == NULL) | |
1530 | return -ENOMEM; | |
1531 | ||
1532 | if (!an->sta->ht_cap.ht_supported) { | |
1533 | len = snprintf(buf, size, "%s\n", | |
1534 | "HT not supported"); | |
1535 | goto exit; | |
1536 | } | |
1537 | ||
1538 | len = snprintf(buf, size, "Max-AMPDU: %d\n", | |
1539 | an->maxampdu); | |
1540 | len += snprintf(buf + len, size - len, "MPDU Density: %d\n\n", | |
1541 | an->mpdudensity); | |
1542 | ||
1543 | len += snprintf(buf + len, size - len, | |
1544 | "%2s%7s\n", "AC", "SCHED"); | |
1545 | ||
1546 | for (acno = 0, ac = &an->ac[acno]; | |
1547 | acno < IEEE80211_NUM_ACS; acno++, ac++) { | |
1548 | txq = ac->txq; | |
1549 | ath_txq_lock(sc, txq); | |
1550 | len += snprintf(buf + len, size - len, | |
1551 | "%2d%7d\n", | |
1552 | acno, ac->sched); | |
1553 | ath_txq_unlock(sc, txq); | |
1554 | } | |
1555 | ||
1556 | len += snprintf(buf + len, size - len, | |
1557 | "\n%3s%11s%10s%10s%10s%10s%9s%6s%8s\n", | |
1558 | "TID", "SEQ_START", "SEQ_NEXT", "BAW_SIZE", | |
1559 | "BAW_HEAD", "BAW_TAIL", "BAR_IDX", "SCHED", "PAUSED"); | |
1560 | ||
1561 | for (tidno = 0, tid = &an->tid[tidno]; | |
1562 | tidno < IEEE80211_NUM_TIDS; tidno++, tid++) { | |
1563 | txq = tid->ac->txq; | |
1564 | ath_txq_lock(sc, txq); | |
1565 | len += snprintf(buf + len, size - len, | |
1566 | "%3d%11d%10d%10d%10d%10d%9d%6d%8d\n", | |
1567 | tid->tidno, tid->seq_start, tid->seq_next, | |
1568 | tid->baw_size, tid->baw_head, tid->baw_tail, | |
1569 | tid->bar_index, tid->sched, tid->paused); | |
1570 | ath_txq_unlock(sc, txq); | |
1571 | } | |
1572 | exit: | |
1573 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | |
1574 | kfree(buf); | |
1575 | ||
1576 | return retval; | |
1577 | } | |
1578 | ||
1579 | static const struct file_operations fops_node_stat = { | |
1580 | .read = read_file_node_stat, | |
1581 | .open = simple_open, | |
1582 | .owner = THIS_MODULE, | |
1583 | .llseek = default_llseek, | |
1584 | }; | |
1585 | ||
1586 | void ath9k_sta_add_debugfs(struct ieee80211_hw *hw, | |
1587 | struct ieee80211_vif *vif, | |
1588 | struct ieee80211_sta *sta, | |
1589 | struct dentry *dir) | |
1590 | { | |
1591 | struct ath_node *an = (struct ath_node *)sta->drv_priv; | |
1592 | an->node_stat = debugfs_create_file("node_stat", S_IRUGO, | |
1593 | dir, an, &fops_node_stat); | |
1594 | } | |
1595 | ||
1596 | void ath9k_sta_remove_debugfs(struct ieee80211_hw *hw, | |
1597 | struct ieee80211_vif *vif, | |
1598 | struct ieee80211_sta *sta, | |
1599 | struct dentry *dir) | |
1600 | { | |
1601 | struct ath_node *an = (struct ath_node *)sta->drv_priv; | |
1602 | debugfs_remove(an->node_stat); | |
1603 | } | |
1604 | ||
c175db87 SM |
1605 | /* Ethtool support for get-stats */ |
1606 | ||
1607 | #define AMKSTR(nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO" | |
1608 | static const char ath9k_gstrings_stats[][ETH_GSTRING_LEN] = { | |
1609 | "tx_pkts_nic", | |
1610 | "tx_bytes_nic", | |
1611 | "rx_pkts_nic", | |
1612 | "rx_bytes_nic", | |
1613 | AMKSTR(d_tx_pkts), | |
1614 | AMKSTR(d_tx_bytes), | |
1615 | AMKSTR(d_tx_mpdus_queued), | |
1616 | AMKSTR(d_tx_mpdus_completed), | |
1617 | AMKSTR(d_tx_mpdu_xretries), | |
1618 | AMKSTR(d_tx_aggregates), | |
1619 | AMKSTR(d_tx_ampdus_queued_hw), | |
1620 | AMKSTR(d_tx_ampdus_queued_sw), | |
1621 | AMKSTR(d_tx_ampdus_completed), | |
1622 | AMKSTR(d_tx_ampdu_retries), | |
1623 | AMKSTR(d_tx_ampdu_xretries), | |
1624 | AMKSTR(d_tx_fifo_underrun), | |
1625 | AMKSTR(d_tx_op_exceeded), | |
1626 | AMKSTR(d_tx_timer_expiry), | |
1627 | AMKSTR(d_tx_desc_cfg_err), | |
1628 | AMKSTR(d_tx_data_underrun), | |
1629 | AMKSTR(d_tx_delim_underrun), | |
18c45b10 | 1630 | "d_rx_crc_err", |
c175db87 SM |
1631 | "d_rx_decrypt_crc_err", |
1632 | "d_rx_phy_err", | |
1633 | "d_rx_mic_err", | |
1634 | "d_rx_pre_delim_crc_err", | |
1635 | "d_rx_post_delim_crc_err", | |
1636 | "d_rx_decrypt_busy_err", | |
1637 | ||
1638 | "d_rx_phyerr_radar", | |
1639 | "d_rx_phyerr_ofdm_timing", | |
1640 | "d_rx_phyerr_cck_timing", | |
1641 | ||
1642 | }; | |
1643 | #define ATH9K_SSTATS_LEN ARRAY_SIZE(ath9k_gstrings_stats) | |
1644 | ||
1645 | void ath9k_get_et_strings(struct ieee80211_hw *hw, | |
1646 | struct ieee80211_vif *vif, | |
1647 | u32 sset, u8 *data) | |
1648 | { | |
1649 | if (sset == ETH_SS_STATS) | |
1650 | memcpy(data, *ath9k_gstrings_stats, | |
1651 | sizeof(ath9k_gstrings_stats)); | |
1652 | } | |
1653 | ||
1654 | int ath9k_get_et_sset_count(struct ieee80211_hw *hw, | |
1655 | struct ieee80211_vif *vif, int sset) | |
1656 | { | |
1657 | if (sset == ETH_SS_STATS) | |
1658 | return ATH9K_SSTATS_LEN; | |
1659 | return 0; | |
1660 | } | |
1661 | ||
1662 | #define AWDATA(elem) \ | |
1663 | do { \ | |
1664 | data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].elem; \ | |
1665 | data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BK)].elem; \ | |
1666 | data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VI)].elem; \ | |
1667 | data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VO)].elem; \ | |
1668 | } while (0) | |
1669 | ||
1670 | #define AWDATA_RX(elem) \ | |
1671 | do { \ | |
1672 | data[i++] = sc->debug.stats.rxstats.elem; \ | |
1673 | } while (0) | |
1674 | ||
1675 | void ath9k_get_et_stats(struct ieee80211_hw *hw, | |
1676 | struct ieee80211_vif *vif, | |
1677 | struct ethtool_stats *stats, u64 *data) | |
1678 | { | |
1679 | struct ath_softc *sc = hw->priv; | |
1680 | int i = 0; | |
1681 | ||
1682 | data[i++] = (sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].tx_pkts_all + | |
1683 | sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BK)].tx_pkts_all + | |
1684 | sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VI)].tx_pkts_all + | |
1685 | sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VO)].tx_pkts_all); | |
1686 | data[i++] = (sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].tx_bytes_all + | |
1687 | sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BK)].tx_bytes_all + | |
1688 | sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VI)].tx_bytes_all + | |
1689 | sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VO)].tx_bytes_all); | |
1690 | AWDATA_RX(rx_pkts_all); | |
1691 | AWDATA_RX(rx_bytes_all); | |
1692 | ||
1693 | AWDATA(tx_pkts_all); | |
1694 | AWDATA(tx_bytes_all); | |
1695 | AWDATA(queued); | |
1696 | AWDATA(completed); | |
1697 | AWDATA(xretries); | |
1698 | AWDATA(a_aggr); | |
1699 | AWDATA(a_queued_hw); | |
1700 | AWDATA(a_queued_sw); | |
1701 | AWDATA(a_completed); | |
1702 | AWDATA(a_retries); | |
1703 | AWDATA(a_xretries); | |
1704 | AWDATA(fifo_underrun); | |
1705 | AWDATA(xtxop); | |
1706 | AWDATA(timer_exp); | |
1707 | AWDATA(desc_cfg_err); | |
1708 | AWDATA(data_underrun); | |
1709 | AWDATA(delim_underrun); | |
1710 | ||
18c45b10 | 1711 | AWDATA_RX(crc_err); |
c175db87 SM |
1712 | AWDATA_RX(decrypt_crc_err); |
1713 | AWDATA_RX(phy_err); | |
1714 | AWDATA_RX(mic_err); | |
1715 | AWDATA_RX(pre_delim_crc_err); | |
1716 | AWDATA_RX(post_delim_crc_err); | |
1717 | AWDATA_RX(decrypt_busy_err); | |
1718 | ||
1719 | AWDATA_RX(phy_err_stats[ATH9K_PHYERR_RADAR]); | |
1720 | AWDATA_RX(phy_err_stats[ATH9K_PHYERR_OFDM_TIMING]); | |
1721 | AWDATA_RX(phy_err_stats[ATH9K_PHYERR_CCK_TIMING]); | |
1722 | ||
1723 | WARN_ON(i != ATH9K_SSTATS_LEN); | |
1724 | } | |
1725 | ||
af690092 SM |
1726 | void ath9k_deinit_debug(struct ath_softc *sc) |
1727 | { | |
1728 | if (config_enabled(CONFIG_ATH9K_DEBUGFS) && sc->rfs_chan_spec_scan) { | |
1729 | relay_close(sc->rfs_chan_spec_scan); | |
1730 | sc->rfs_chan_spec_scan = NULL; | |
1731 | } | |
1732 | } | |
1733 | ||
4d6b228d | 1734 | int ath9k_init_debug(struct ath_hw *ah) |
88b126af | 1735 | { |
bc974f4a LR |
1736 | struct ath_common *common = ath9k_hw_common(ah); |
1737 | struct ath_softc *sc = (struct ath_softc *) common->priv; | |
4d6b228d | 1738 | |
eb272441 BG |
1739 | sc->debug.debugfs_phy = debugfs_create_dir("ath9k", |
1740 | sc->hw->wiphy->debugfsdir); | |
17d7904d | 1741 | if (!sc->debug.debugfs_phy) |
c8a72c00 | 1742 | return -ENOMEM; |
826d2680 | 1743 | |
a830df07 | 1744 | #ifdef CONFIG_ATH_DEBUG |
c70cab1a FF |
1745 | debugfs_create_file("debug", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, |
1746 | sc, &fops_debug); | |
a830df07 | 1747 | #endif |
29942bc1 ZK |
1748 | |
1749 | ath9k_dfs_init_debug(sc); | |
1750 | ||
c70cab1a FF |
1751 | debugfs_create_file("dma", S_IRUSR, sc->debug.debugfs_phy, sc, |
1752 | &fops_dma); | |
1753 | debugfs_create_file("interrupt", S_IRUSR, sc->debug.debugfs_phy, sc, | |
1754 | &fops_interrupt); | |
c70cab1a FF |
1755 | debugfs_create_file("xmit", S_IRUSR, sc->debug.debugfs_phy, sc, |
1756 | &fops_xmit); | |
c0b74876 SM |
1757 | debugfs_create_file("queues", S_IRUSR, sc->debug.debugfs_phy, sc, |
1758 | &fops_queues); | |
7702e788 | 1759 | debugfs_create_u32("qlen_bk", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, |
bea843c7 | 1760 | &sc->tx.txq_max_pending[IEEE80211_AC_BK]); |
7702e788 | 1761 | debugfs_create_u32("qlen_be", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, |
bea843c7 | 1762 | &sc->tx.txq_max_pending[IEEE80211_AC_BE]); |
7702e788 | 1763 | debugfs_create_u32("qlen_vi", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, |
bea843c7 | 1764 | &sc->tx.txq_max_pending[IEEE80211_AC_VI]); |
7702e788 | 1765 | debugfs_create_u32("qlen_vo", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, |
bea843c7 | 1766 | &sc->tx.txq_max_pending[IEEE80211_AC_VO]); |
c70cab1a FF |
1767 | debugfs_create_file("misc", S_IRUSR, sc->debug.debugfs_phy, sc, |
1768 | &fops_misc); | |
f8b815dc SM |
1769 | debugfs_create_file("reset", S_IRUSR, sc->debug.debugfs_phy, sc, |
1770 | &fops_reset); | |
c70cab1a FF |
1771 | debugfs_create_file("recv", S_IRUSR, sc->debug.debugfs_phy, sc, |
1772 | &fops_recv); | |
1773 | debugfs_create_file("rx_chainmask", S_IRUSR | S_IWUSR, | |
1774 | sc->debug.debugfs_phy, sc, &fops_rx_chainmask); | |
1775 | debugfs_create_file("tx_chainmask", S_IRUSR | S_IWUSR, | |
1776 | sc->debug.debugfs_phy, sc, &fops_tx_chainmask); | |
6e4d291e SM |
1777 | debugfs_create_file("ani", S_IRUSR | S_IWUSR, |
1778 | sc->debug.debugfs_phy, sc, &fops_ani); | |
74673db9 FF |
1779 | debugfs_create_bool("paprd", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, |
1780 | &sc->sc_ah->config.enable_paprd); | |
c70cab1a FF |
1781 | debugfs_create_file("regidx", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, |
1782 | sc, &fops_regidx); | |
1783 | debugfs_create_file("regval", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, | |
1784 | sc, &fops_regval); | |
1785 | debugfs_create_bool("ignore_extcca", S_IRUSR | S_IWUSR, | |
1786 | sc->debug.debugfs_phy, | |
1787 | &ah->config.cwm_ignore_extcca); | |
1788 | debugfs_create_file("regdump", S_IRUSR, sc->debug.debugfs_phy, sc, | |
1789 | &fops_regdump); | |
d069a46b RM |
1790 | debugfs_create_file("dump_nfcal", S_IRUSR, sc->debug.debugfs_phy, sc, |
1791 | &fops_dump_nfcal); | |
580f010f RM |
1792 | debugfs_create_file("base_eeprom", S_IRUSR, sc->debug.debugfs_phy, sc, |
1793 | &fops_base_eeprom); | |
3f4c4bdd RM |
1794 | debugfs_create_file("modal_eeprom", S_IRUSR, sc->debug.debugfs_phy, sc, |
1795 | &fops_modal_eeprom); | |
e93d083f SW |
1796 | sc->rfs_chan_spec_scan = relay_open("spectral_scan", |
1797 | sc->debug.debugfs_phy, | |
55f39e67 | 1798 | 1024, 256, &rfs_spec_scan_cb, |
e93d083f SW |
1799 | NULL); |
1800 | debugfs_create_file("spectral_scan_ctl", S_IRUSR | S_IWUSR, | |
1801 | sc->debug.debugfs_phy, sc, | |
1802 | &fops_spec_scan_ctl); | |
04ccd4a1 SW |
1803 | debugfs_create_file("spectral_short_repeat", S_IRUSR | S_IWUSR, |
1804 | sc->debug.debugfs_phy, sc, | |
1805 | &fops_spectral_short_repeat); | |
1806 | debugfs_create_file("spectral_count", S_IRUSR | S_IWUSR, | |
1807 | sc->debug.debugfs_phy, sc, &fops_spectral_count); | |
1808 | debugfs_create_file("spectral_period", S_IRUSR | S_IWUSR, | |
1809 | sc->debug.debugfs_phy, sc, &fops_spectral_period); | |
1810 | debugfs_create_file("spectral_fft_period", S_IRUSR | S_IWUSR, | |
1811 | sc->debug.debugfs_phy, sc, | |
1812 | &fops_spectral_fft_period); | |
691680b8 FF |
1813 | debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR, |
1814 | sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask); | |
691680b8 FF |
1815 | debugfs_create_u32("gpio_val", S_IRUSR | S_IWUSR, |
1816 | sc->debug.debugfs_phy, &sc->sc_ah->gpio_val); | |
302a3c3a SM |
1817 | debugfs_create_file("diversity", S_IRUSR | S_IWUSR, |
1818 | sc->debug.debugfs_phy, sc, &fops_ant_diversity); | |
4df50ca8 RM |
1819 | #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT |
1820 | debugfs_create_file("btcoex", S_IRUSR, sc->debug.debugfs_phy, sc, | |
1821 | &fops_btcoex); | |
1822 | #endif | |
826d2680 | 1823 | return 0; |
88b126af | 1824 | } |