2 * Copyright (c) 2008-2011 Atheros Communications Inc.
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.
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.
17 #include <linux/slab.h>
18 #include <linux/vmalloc.h>
19 #include <linux/export.h>
20 #include <asm/unaligned.h>
24 #define REG_WRITE_D(_ah, _reg, _val) \
25 ath9k_hw_common(_ah)->ops->write((_ah), (_val), (_reg))
26 #define REG_READ_D(_ah, _reg) \
27 ath9k_hw_common(_ah)->ops->read((_ah), (_reg))
30 static ssize_t
ath9k_debugfs_read_buf(struct file
*file
, char __user
*user_buf
,
31 size_t count
, loff_t
*ppos
)
33 u8
*buf
= file
->private_data
;
34 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, strlen(buf
));
37 static int ath9k_debugfs_release_buf(struct inode
*inode
, struct file
*file
)
39 vfree(file
->private_data
);
43 #ifdef CONFIG_ATH_DEBUG
45 static ssize_t
read_file_debug(struct file
*file
, char __user
*user_buf
,
46 size_t count
, loff_t
*ppos
)
48 struct ath_softc
*sc
= file
->private_data
;
49 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
53 len
= sprintf(buf
, "0x%08x\n", common
->debug_mask
);
54 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
57 static ssize_t
write_file_debug(struct file
*file
, const char __user
*user_buf
,
58 size_t count
, loff_t
*ppos
)
60 struct ath_softc
*sc
= file
->private_data
;
61 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
66 len
= min(count
, sizeof(buf
) - 1);
67 if (copy_from_user(buf
, user_buf
, len
))
71 if (strict_strtoul(buf
, 0, &mask
))
74 common
->debug_mask
= mask
;
78 static const struct file_operations fops_debug
= {
79 .read
= read_file_debug
,
80 .write
= write_file_debug
,
83 .llseek
= default_llseek
,
88 #define DMA_BUF_LEN 1024
90 static ssize_t
read_file_tx_chainmask(struct file
*file
, char __user
*user_buf
,
91 size_t count
, loff_t
*ppos
)
93 struct ath_softc
*sc
= file
->private_data
;
94 struct ath_hw
*ah
= sc
->sc_ah
;
98 len
= sprintf(buf
, "0x%08x\n", ah
->txchainmask
);
99 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
102 static ssize_t
write_file_tx_chainmask(struct file
*file
, const char __user
*user_buf
,
103 size_t count
, loff_t
*ppos
)
105 struct ath_softc
*sc
= file
->private_data
;
106 struct ath_hw
*ah
= sc
->sc_ah
;
111 len
= min(count
, sizeof(buf
) - 1);
112 if (copy_from_user(buf
, user_buf
, len
))
116 if (strict_strtoul(buf
, 0, &mask
))
119 ah
->txchainmask
= mask
;
120 ah
->caps
.tx_chainmask
= mask
;
124 static const struct file_operations fops_tx_chainmask
= {
125 .read
= read_file_tx_chainmask
,
126 .write
= write_file_tx_chainmask
,
128 .owner
= THIS_MODULE
,
129 .llseek
= default_llseek
,
133 static ssize_t
read_file_rx_chainmask(struct file
*file
, char __user
*user_buf
,
134 size_t count
, loff_t
*ppos
)
136 struct ath_softc
*sc
= file
->private_data
;
137 struct ath_hw
*ah
= sc
->sc_ah
;
141 len
= sprintf(buf
, "0x%08x\n", ah
->rxchainmask
);
142 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
145 static ssize_t
write_file_rx_chainmask(struct file
*file
, const char __user
*user_buf
,
146 size_t count
, loff_t
*ppos
)
148 struct ath_softc
*sc
= file
->private_data
;
149 struct ath_hw
*ah
= sc
->sc_ah
;
154 len
= min(count
, sizeof(buf
) - 1);
155 if (copy_from_user(buf
, user_buf
, len
))
159 if (strict_strtoul(buf
, 0, &mask
))
162 ah
->rxchainmask
= mask
;
163 ah
->caps
.rx_chainmask
= mask
;
167 static const struct file_operations fops_rx_chainmask
= {
168 .read
= read_file_rx_chainmask
,
169 .write
= write_file_rx_chainmask
,
171 .owner
= THIS_MODULE
,
172 .llseek
= default_llseek
,
175 static ssize_t
read_file_disable_ani(struct file
*file
, char __user
*user_buf
,
176 size_t count
, loff_t
*ppos
)
178 struct ath_softc
*sc
= file
->private_data
;
179 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
183 len
= sprintf(buf
, "%d\n", common
->disable_ani
);
184 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
187 static ssize_t
write_file_disable_ani(struct file
*file
,
188 const char __user
*user_buf
,
189 size_t count
, loff_t
*ppos
)
191 struct ath_softc
*sc
= file
->private_data
;
192 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
193 unsigned long disable_ani
;
197 len
= min(count
, sizeof(buf
) - 1);
198 if (copy_from_user(buf
, user_buf
, len
))
202 if (strict_strtoul(buf
, 0, &disable_ani
))
205 common
->disable_ani
= !!disable_ani
;
208 clear_bit(SC_OP_ANI_RUN
, &sc
->sc_flags
);
217 static const struct file_operations fops_disable_ani
= {
218 .read
= read_file_disable_ani
,
219 .write
= write_file_disable_ani
,
221 .owner
= THIS_MODULE
,
222 .llseek
= default_llseek
,
225 static ssize_t
read_file_ant_diversity(struct file
*file
, char __user
*user_buf
,
226 size_t count
, loff_t
*ppos
)
228 struct ath_softc
*sc
= file
->private_data
;
229 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
233 len
= sprintf(buf
, "%d\n", common
->antenna_diversity
);
234 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
237 static ssize_t
write_file_ant_diversity(struct file
*file
,
238 const char __user
*user_buf
,
239 size_t count
, loff_t
*ppos
)
241 struct ath_softc
*sc
= file
->private_data
;
242 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
243 unsigned long antenna_diversity
;
247 len
= min(count
, sizeof(buf
) - 1);
248 if (copy_from_user(buf
, user_buf
, len
))
251 if (!AR_SREV_9565(sc
->sc_ah
))
255 if (strict_strtoul(buf
, 0, &antenna_diversity
))
258 common
->antenna_diversity
= !!antenna_diversity
;
260 ath_ant_comb_update(sc
);
261 ath_dbg(common
, CONFIG
, "Antenna diversity: %d\n",
262 common
->antenna_diversity
);
263 ath9k_ps_restore(sc
);
268 static const struct file_operations fops_ant_diversity
= {
269 .read
= read_file_ant_diversity
,
270 .write
= write_file_ant_diversity
,
272 .owner
= THIS_MODULE
,
273 .llseek
= default_llseek
,
276 static ssize_t
read_file_dma(struct file
*file
, char __user
*user_buf
,
277 size_t count
, loff_t
*ppos
)
279 struct ath_softc
*sc
= file
->private_data
;
280 struct ath_hw
*ah
= sc
->sc_ah
;
283 unsigned int len
= 0;
284 u32 val
[ATH9K_NUM_DMA_DEBUG_REGS
];
285 int i
, qcuOffset
= 0, dcuOffset
= 0;
286 u32
*qcuBase
= &val
[0], *dcuBase
= &val
[4];
288 buf
= kmalloc(DMA_BUF_LEN
, GFP_KERNEL
);
294 REG_WRITE_D(ah
, AR_MACMISC
,
295 ((AR_MACMISC_DMA_OBS_LINE_8
<< AR_MACMISC_DMA_OBS_S
) |
296 (AR_MACMISC_MISC_OBS_BUS_1
<<
297 AR_MACMISC_MISC_OBS_BUS_MSB_S
)));
299 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
,
300 "Raw DMA Debug values:\n");
302 for (i
= 0; i
< ATH9K_NUM_DMA_DEBUG_REGS
; i
++) {
304 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
, "\n");
306 val
[i
] = REG_READ_D(ah
, AR_DMADBG_0
+ (i
* sizeof(u32
)));
307 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
, "%d: %08x ",
311 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
, "\n\n");
312 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
,
313 "Num QCU: chain_st fsp_ok fsp_st DCU: chain_st\n");
315 for (i
= 0; i
< ATH9K_NUM_QUEUES
; i
++, qcuOffset
+= 4, dcuOffset
+= 5) {
326 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
,
327 "%2d %2x %1x %2x %2x\n",
328 i
, (*qcuBase
& (0x7 << qcuOffset
)) >> qcuOffset
,
329 (*qcuBase
& (0x8 << qcuOffset
)) >> (qcuOffset
+ 3),
330 val
[2] & (0x7 << (i
* 3)) >> (i
* 3),
331 (*dcuBase
& (0x1f << dcuOffset
)) >> dcuOffset
);
334 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
, "\n");
336 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
,
337 "qcu_stitch state: %2x qcu_fetch state: %2x\n",
338 (val
[3] & 0x003c0000) >> 18, (val
[3] & 0x03c00000) >> 22);
339 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
,
340 "qcu_complete state: %2x dcu_complete state: %2x\n",
341 (val
[3] & 0x1c000000) >> 26, (val
[6] & 0x3));
342 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
,
343 "dcu_arb state: %2x dcu_fp state: %2x\n",
344 (val
[5] & 0x06000000) >> 25, (val
[5] & 0x38000000) >> 27);
345 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
,
346 "chan_idle_dur: %3d chan_idle_dur_valid: %1d\n",
347 (val
[6] & 0x000003fc) >> 2, (val
[6] & 0x00000400) >> 10);
348 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
,
349 "txfifo_valid_0: %1d txfifo_valid_1: %1d\n",
350 (val
[6] & 0x00000800) >> 11, (val
[6] & 0x00001000) >> 12);
351 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
,
352 "txfifo_dcu_num_0: %2d txfifo_dcu_num_1: %2d\n",
353 (val
[6] & 0x0001e000) >> 13, (val
[6] & 0x001e0000) >> 17);
355 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
, "pcu observe: 0x%x\n",
356 REG_READ_D(ah
, AR_OBS_BUS_1
));
357 len
+= snprintf(buf
+ len
, DMA_BUF_LEN
- len
,
358 "AR_CR: 0x%x\n", REG_READ_D(ah
, AR_CR
));
360 ath9k_ps_restore(sc
);
362 if (len
> DMA_BUF_LEN
)
365 retval
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
370 static const struct file_operations fops_dma
= {
371 .read
= read_file_dma
,
373 .owner
= THIS_MODULE
,
374 .llseek
= default_llseek
,
378 void ath_debug_stat_interrupt(struct ath_softc
*sc
, enum ath9k_int status
)
381 sc
->debug
.stats
.istats
.total
++;
382 if (sc
->sc_ah
->caps
.hw_caps
& ATH9K_HW_CAP_EDMA
) {
383 if (status
& ATH9K_INT_RXLP
)
384 sc
->debug
.stats
.istats
.rxlp
++;
385 if (status
& ATH9K_INT_RXHP
)
386 sc
->debug
.stats
.istats
.rxhp
++;
387 if (status
& ATH9K_INT_BB_WATCHDOG
)
388 sc
->debug
.stats
.istats
.bb_watchdog
++;
390 if (status
& ATH9K_INT_RX
)
391 sc
->debug
.stats
.istats
.rxok
++;
393 if (status
& ATH9K_INT_RXEOL
)
394 sc
->debug
.stats
.istats
.rxeol
++;
395 if (status
& ATH9K_INT_RXORN
)
396 sc
->debug
.stats
.istats
.rxorn
++;
397 if (status
& ATH9K_INT_TX
)
398 sc
->debug
.stats
.istats
.txok
++;
399 if (status
& ATH9K_INT_TXURN
)
400 sc
->debug
.stats
.istats
.txurn
++;
401 if (status
& ATH9K_INT_RXPHY
)
402 sc
->debug
.stats
.istats
.rxphyerr
++;
403 if (status
& ATH9K_INT_RXKCM
)
404 sc
->debug
.stats
.istats
.rx_keycache_miss
++;
405 if (status
& ATH9K_INT_SWBA
)
406 sc
->debug
.stats
.istats
.swba
++;
407 if (status
& ATH9K_INT_BMISS
)
408 sc
->debug
.stats
.istats
.bmiss
++;
409 if (status
& ATH9K_INT_BNR
)
410 sc
->debug
.stats
.istats
.bnr
++;
411 if (status
& ATH9K_INT_CST
)
412 sc
->debug
.stats
.istats
.cst
++;
413 if (status
& ATH9K_INT_GTT
)
414 sc
->debug
.stats
.istats
.gtt
++;
415 if (status
& ATH9K_INT_TIM
)
416 sc
->debug
.stats
.istats
.tim
++;
417 if (status
& ATH9K_INT_CABEND
)
418 sc
->debug
.stats
.istats
.cabend
++;
419 if (status
& ATH9K_INT_DTIMSYNC
)
420 sc
->debug
.stats
.istats
.dtimsync
++;
421 if (status
& ATH9K_INT_DTIM
)
422 sc
->debug
.stats
.istats
.dtim
++;
423 if (status
& ATH9K_INT_TSFOOR
)
424 sc
->debug
.stats
.istats
.tsfoor
++;
425 if (status
& ATH9K_INT_MCI
)
426 sc
->debug
.stats
.istats
.mci
++;
427 if (status
& ATH9K_INT_GENTIMER
)
428 sc
->debug
.stats
.istats
.gen_timer
++;
431 static ssize_t
read_file_interrupt(struct file
*file
, char __user
*user_buf
,
432 size_t count
, loff_t
*ppos
)
434 struct ath_softc
*sc
= file
->private_data
;
435 unsigned int len
= 0;
438 char *buf
= kmalloc(mxlen
, GFP_KERNEL
);
442 #define PR_IS(a, s) \
444 len += snprintf(buf + len, mxlen - len, \
446 sc->debug.stats.istats.s); \
449 if (sc
->sc_ah
->caps
.hw_caps
& ATH9K_HW_CAP_EDMA
) {
452 PR_IS("WATHDOG", bb_watchdog
);
456 PR_IS("RXEOL", rxeol
);
457 PR_IS("RXORN", rxorn
);
459 PR_IS("TXURN", txurn
);
461 PR_IS("RXPHY", rxphyerr
);
462 PR_IS("RXKCM", rx_keycache_miss
);
464 PR_IS("BMISS", bmiss
);
469 PR_IS("CABEND", cabend
);
470 PR_IS("DTIMSYNC", dtimsync
);
472 PR_IS("TSFOOR", tsfoor
);
474 PR_IS("GENTIMER", gen_timer
);
475 PR_IS("TOTAL", total
);
477 len
+= snprintf(buf
+ len
, mxlen
- len
,
478 "SYNC_CAUSE stats:\n");
480 PR_IS("Sync-All", sync_cause_all
);
481 PR_IS("RTC-IRQ", sync_rtc_irq
);
482 PR_IS("MAC-IRQ", sync_mac_irq
);
483 PR_IS("EEPROM-Illegal-Access", eeprom_illegal_access
);
484 PR_IS("APB-Timeout", apb_timeout
);
485 PR_IS("PCI-Mode-Conflict", pci_mode_conflict
);
486 PR_IS("HOST1-Fatal", host1_fatal
);
487 PR_IS("HOST1-Perr", host1_perr
);
488 PR_IS("TRCV-FIFO-Perr", trcv_fifo_perr
);
489 PR_IS("RADM-CPL-EP", radm_cpl_ep
);
490 PR_IS("RADM-CPL-DLLP-Abort", radm_cpl_dllp_abort
);
491 PR_IS("RADM-CPL-TLP-Abort", radm_cpl_tlp_abort
);
492 PR_IS("RADM-CPL-ECRC-Err", radm_cpl_ecrc_err
);
493 PR_IS("RADM-CPL-Timeout", radm_cpl_timeout
);
494 PR_IS("Local-Bus-Timeout", local_timeout
);
495 PR_IS("PM-Access", pm_access
);
496 PR_IS("MAC-Awake", mac_awake
);
497 PR_IS("MAC-Asleep", mac_asleep
);
498 PR_IS("MAC-Sleep-Access", mac_sleep_access
);
503 rv
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
508 static const struct file_operations fops_interrupt
= {
509 .read
= read_file_interrupt
,
511 .owner
= THIS_MODULE
,
512 .llseek
= default_llseek
,
515 static ssize_t
read_file_xmit(struct file
*file
, char __user
*user_buf
,
516 size_t count
, loff_t
*ppos
)
518 struct ath_softc
*sc
= file
->private_data
;
520 unsigned int len
= 0, size
= 2048;
523 buf
= kzalloc(size
, GFP_KERNEL
);
527 len
+= sprintf(buf
, "%30s %10s%10s%10s\n\n",
528 "BE", "BK", "VI", "VO");
530 PR("MPDUs Queued: ", queued
);
531 PR("MPDUs Completed: ", completed
);
532 PR("MPDUs XRetried: ", xretries
);
533 PR("Aggregates: ", a_aggr
);
534 PR("AMPDUs Queued HW:", a_queued_hw
);
535 PR("AMPDUs Queued SW:", a_queued_sw
);
536 PR("AMPDUs Completed:", a_completed
);
537 PR("AMPDUs Retried: ", a_retries
);
538 PR("AMPDUs XRetried: ", a_xretries
);
539 PR("FIFO Underrun: ", fifo_underrun
);
540 PR("TXOP Exceeded: ", xtxop
);
541 PR("TXTIMER Expiry: ", timer_exp
);
542 PR("DESC CFG Error: ", desc_cfg_err
);
543 PR("DATA Underrun: ", data_underrun
);
544 PR("DELIM Underrun: ", delim_underrun
);
545 PR("TX-Pkts-All: ", tx_pkts_all
);
546 PR("TX-Bytes-All: ", tx_bytes_all
);
547 PR("HW-put-tx-buf: ", puttxbuf
);
548 PR("HW-tx-start: ", txstart
);
549 PR("HW-tx-proc-desc: ", txprocdesc
);
550 PR("TX-Failed: ", txfailed
);
555 retval
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
561 static ssize_t
read_file_queues(struct file
*file
, char __user
*user_buf
,
562 size_t count
, loff_t
*ppos
)
564 struct ath_softc
*sc
= file
->private_data
;
567 unsigned int len
= 0, size
= 1024;
570 char *qname
[4] = {"VO", "VI", "BE", "BK"};
572 buf
= kzalloc(size
, GFP_KERNEL
);
576 for (i
= 0; i
< IEEE80211_NUM_ACS
; i
++) {
577 txq
= sc
->tx
.txq_map
[i
];
578 len
+= snprintf(buf
+ len
, size
- len
, "(%s): ", qname
[i
]);
580 ath_txq_lock(sc
, txq
);
582 len
+= snprintf(buf
+ len
, size
- len
, "%s: %d ",
583 "qnum", txq
->axq_qnum
);
584 len
+= snprintf(buf
+ len
, size
- len
, "%s: %2d ",
585 "qdepth", txq
->axq_depth
);
586 len
+= snprintf(buf
+ len
, size
- len
, "%s: %2d ",
587 "ampdu-depth", txq
->axq_ampdu_depth
);
588 len
+= snprintf(buf
+ len
, size
- len
, "%s: %3d ",
589 "pending", txq
->pending_frames
);
590 len
+= snprintf(buf
+ len
, size
- len
, "%s: %d\n",
591 "stopped", txq
->stopped
);
593 ath_txq_unlock(sc
, txq
);
599 retval
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
605 static ssize_t
read_file_misc(struct file
*file
, char __user
*user_buf
,
606 size_t count
, loff_t
*ppos
)
608 struct ath_softc
*sc
= file
->private_data
;
609 struct ath_common
*common
= ath9k_hw_common(sc
->sc_ah
);
610 struct ieee80211_hw
*hw
= sc
->hw
;
611 struct ath9k_vif_iter_data iter_data
;
613 unsigned int len
= 0;
618 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
619 "BSSID: %pM\n", common
->curbssid
);
620 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
621 "BSSID-MASK: %pM\n", common
->bssidmask
);
622 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
623 "OPMODE: %s\n", ath_opmode_to_string(sc
->sc_ah
->opmode
));
626 rxfilter
= ath9k_hw_getrxfilter(sc
->sc_ah
);
627 ath9k_ps_restore(sc
);
629 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
630 "RXFILTER: 0x%x", rxfilter
);
632 if (rxfilter
& ATH9K_RX_FILTER_UCAST
)
633 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " UCAST");
634 if (rxfilter
& ATH9K_RX_FILTER_MCAST
)
635 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " MCAST");
636 if (rxfilter
& ATH9K_RX_FILTER_BCAST
)
637 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " BCAST");
638 if (rxfilter
& ATH9K_RX_FILTER_CONTROL
)
639 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " CONTROL");
640 if (rxfilter
& ATH9K_RX_FILTER_BEACON
)
641 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " BEACON");
642 if (rxfilter
& ATH9K_RX_FILTER_PROM
)
643 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " PROM");
644 if (rxfilter
& ATH9K_RX_FILTER_PROBEREQ
)
645 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " PROBEREQ");
646 if (rxfilter
& ATH9K_RX_FILTER_PHYERR
)
647 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " PHYERR");
648 if (rxfilter
& ATH9K_RX_FILTER_MYBEACON
)
649 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " MYBEACON");
650 if (rxfilter
& ATH9K_RX_FILTER_COMP_BAR
)
651 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " COMP_BAR");
652 if (rxfilter
& ATH9K_RX_FILTER_PSPOLL
)
653 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " PSPOLL");
654 if (rxfilter
& ATH9K_RX_FILTER_PHYRADAR
)
655 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " PHYRADAR");
656 if (rxfilter
& ATH9K_RX_FILTER_MCAST_BCAST_ALL
)
657 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " MCAST_BCAST_ALL");
658 if (rxfilter
& ATH9K_RX_FILTER_CONTROL_WRAPPER
)
659 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " CONTROL_WRAPPER");
661 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, "\n");
663 reg
= sc
->sc_ah
->imask
;
665 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, "INTERRUPT-MASK: 0x%x", reg
);
667 if (reg
& ATH9K_INT_SWBA
)
668 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " SWBA");
669 if (reg
& ATH9K_INT_BMISS
)
670 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " BMISS");
671 if (reg
& ATH9K_INT_CST
)
672 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " CST");
673 if (reg
& ATH9K_INT_RX
)
674 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " RX");
675 if (reg
& ATH9K_INT_RXHP
)
676 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " RXHP");
677 if (reg
& ATH9K_INT_RXLP
)
678 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " RXLP");
679 if (reg
& ATH9K_INT_BB_WATCHDOG
)
680 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, " BB_WATCHDOG");
682 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
, "\n");
684 ath9k_calculate_iter_data(hw
, NULL
, &iter_data
);
686 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
687 "VIF-COUNTS: AP: %i STA: %i MESH: %i WDS: %i"
688 " ADHOC: %i TOTAL: %hi BEACON-VIF: %hi\n",
689 iter_data
.naps
, iter_data
.nstations
, iter_data
.nmeshes
,
690 iter_data
.nwds
, iter_data
.nadhocs
,
691 sc
->nvifs
, sc
->nbcnvifs
);
693 if (len
> sizeof(buf
))
696 retval
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
700 static ssize_t
read_file_reset(struct file
*file
, char __user
*user_buf
,
701 size_t count
, loff_t
*ppos
)
703 struct ath_softc
*sc
= file
->private_data
;
705 unsigned int len
= 0;
707 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
708 "%17s: %2d\n", "Baseband Hang",
709 sc
->debug
.stats
.reset
[RESET_TYPE_BB_HANG
]);
710 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
711 "%17s: %2d\n", "Baseband Watchdog",
712 sc
->debug
.stats
.reset
[RESET_TYPE_BB_WATCHDOG
]);
713 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
714 "%17s: %2d\n", "Fatal HW Error",
715 sc
->debug
.stats
.reset
[RESET_TYPE_FATAL_INT
]);
716 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
717 "%17s: %2d\n", "TX HW error",
718 sc
->debug
.stats
.reset
[RESET_TYPE_TX_ERROR
]);
719 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
720 "%17s: %2d\n", "TX Path Hang",
721 sc
->debug
.stats
.reset
[RESET_TYPE_TX_HANG
]);
722 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
723 "%17s: %2d\n", "PLL RX Hang",
724 sc
->debug
.stats
.reset
[RESET_TYPE_PLL_HANG
]);
725 len
+= snprintf(buf
+ len
, sizeof(buf
) - len
,
726 "%17s: %2d\n", "MCI Reset",
727 sc
->debug
.stats
.reset
[RESET_TYPE_MCI
]);
729 if (len
> sizeof(buf
))
732 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
735 void ath_debug_stat_tx(struct ath_softc
*sc
, struct ath_buf
*bf
,
736 struct ath_tx_status
*ts
, struct ath_txq
*txq
,
739 #define TX_SAMP_DBG(c) (sc->debug.bb_mac_samp[sc->debug.sampidx].ts\
741 int qnum
= txq
->axq_qnum
;
743 TX_STAT_INC(qnum
, tx_pkts_all
);
744 sc
->debug
.stats
.txstats
[qnum
].tx_bytes_all
+= bf
->bf_mpdu
->len
;
746 if (bf_isampdu(bf
)) {
747 if (flags
& ATH_TX_ERROR
)
748 TX_STAT_INC(qnum
, a_xretries
);
750 TX_STAT_INC(qnum
, a_completed
);
752 if (ts
->ts_status
& ATH9K_TXERR_XRETRY
)
753 TX_STAT_INC(qnum
, xretries
);
755 TX_STAT_INC(qnum
, completed
);
758 if (ts
->ts_status
& ATH9K_TXERR_FIFO
)
759 TX_STAT_INC(qnum
, fifo_underrun
);
760 if (ts
->ts_status
& ATH9K_TXERR_XTXOP
)
761 TX_STAT_INC(qnum
, xtxop
);
762 if (ts
->ts_status
& ATH9K_TXERR_TIMER_EXPIRED
)
763 TX_STAT_INC(qnum
, timer_exp
);
764 if (ts
->ts_flags
& ATH9K_TX_DESC_CFG_ERR
)
765 TX_STAT_INC(qnum
, desc_cfg_err
);
766 if (ts
->ts_flags
& ATH9K_TX_DATA_UNDERRUN
)
767 TX_STAT_INC(qnum
, data_underrun
);
768 if (ts
->ts_flags
& ATH9K_TX_DELIM_UNDERRUN
)
769 TX_STAT_INC(qnum
, delim_underrun
);
771 #ifdef CONFIG_ATH9K_MAC_DEBUG
772 spin_lock(&sc
->debug
.samp_lock
);
773 TX_SAMP_DBG(jiffies
) = jiffies
;
774 TX_SAMP_DBG(rssi_ctl0
) = ts
->ts_rssi_ctl0
;
775 TX_SAMP_DBG(rssi_ctl1
) = ts
->ts_rssi_ctl1
;
776 TX_SAMP_DBG(rssi_ctl2
) = ts
->ts_rssi_ctl2
;
777 TX_SAMP_DBG(rssi_ext0
) = ts
->ts_rssi_ext0
;
778 TX_SAMP_DBG(rssi_ext1
) = ts
->ts_rssi_ext1
;
779 TX_SAMP_DBG(rssi_ext2
) = ts
->ts_rssi_ext2
;
780 TX_SAMP_DBG(rateindex
) = ts
->ts_rateindex
;
781 TX_SAMP_DBG(isok
) = !!(ts
->ts_status
& ATH9K_TXERR_MASK
);
782 TX_SAMP_DBG(rts_fail_cnt
) = ts
->ts_shortretry
;
783 TX_SAMP_DBG(data_fail_cnt
) = ts
->ts_longretry
;
784 TX_SAMP_DBG(rssi
) = ts
->ts_rssi
;
785 TX_SAMP_DBG(tid
) = ts
->tid
;
786 TX_SAMP_DBG(qid
) = ts
->qid
;
788 if (ts
->ts_flags
& ATH9K_TX_BA
) {
789 TX_SAMP_DBG(ba_low
) = ts
->ba_low
;
790 TX_SAMP_DBG(ba_high
) = ts
->ba_high
;
792 TX_SAMP_DBG(ba_low
) = 0;
793 TX_SAMP_DBG(ba_high
) = 0;
796 sc
->debug
.tsidx
= (sc
->debug
.tsidx
+ 1) % ATH_DBG_MAX_SAMPLES
;
797 spin_unlock(&sc
->debug
.samp_lock
);
803 static const struct file_operations fops_xmit
= {
804 .read
= read_file_xmit
,
806 .owner
= THIS_MODULE
,
807 .llseek
= default_llseek
,
810 static const struct file_operations fops_queues
= {
811 .read
= read_file_queues
,
813 .owner
= THIS_MODULE
,
814 .llseek
= default_llseek
,
817 static const struct file_operations fops_misc
= {
818 .read
= read_file_misc
,
820 .owner
= THIS_MODULE
,
821 .llseek
= default_llseek
,
824 static const struct file_operations fops_reset
= {
825 .read
= read_file_reset
,
827 .owner
= THIS_MODULE
,
828 .llseek
= default_llseek
,
831 static ssize_t
read_file_recv(struct file
*file
, char __user
*user_buf
,
832 size_t count
, loff_t
*ppos
)
834 #define PHY_ERR(s, p) \
835 len += snprintf(buf + len, size - len, "%22s : %10u\n", s, \
836 sc->debug.stats.rxstats.phy_err_stats[p]);
838 #define RXS_ERR(s, e) \
840 len += snprintf(buf + len, size - len, \
841 "%22s : %10u\n", s, \
842 sc->debug.stats.rxstats.e); \
845 struct ath_softc
*sc
= file
->private_data
;
847 unsigned int len
= 0, size
= 1600;
850 buf
= kzalloc(size
, GFP_KERNEL
);
854 RXS_ERR("CRC ERR", crc_err
);
855 RXS_ERR("DECRYPT CRC ERR", decrypt_crc_err
);
856 RXS_ERR("PHY ERR", phy_err
);
857 RXS_ERR("MIC ERR", mic_err
);
858 RXS_ERR("PRE-DELIM CRC ERR", pre_delim_crc_err
);
859 RXS_ERR("POST-DELIM CRC ERR", post_delim_crc_err
);
860 RXS_ERR("DECRYPT BUSY ERR", decrypt_busy_err
);
861 RXS_ERR("RX-LENGTH-ERR", rx_len_err
);
862 RXS_ERR("RX-OOM-ERR", rx_oom_err
);
863 RXS_ERR("RX-RATE-ERR", rx_rate_err
);
864 RXS_ERR("RX-DROP-RXFLUSH", rx_drop_rxflush
);
865 RXS_ERR("RX-TOO-MANY-FRAGS", rx_too_many_frags_err
);
867 PHY_ERR("UNDERRUN ERR", ATH9K_PHYERR_UNDERRUN
);
868 PHY_ERR("TIMING ERR", ATH9K_PHYERR_TIMING
);
869 PHY_ERR("PARITY ERR", ATH9K_PHYERR_PARITY
);
870 PHY_ERR("RATE ERR", ATH9K_PHYERR_RATE
);
871 PHY_ERR("LENGTH ERR", ATH9K_PHYERR_LENGTH
);
872 PHY_ERR("RADAR ERR", ATH9K_PHYERR_RADAR
);
873 PHY_ERR("SERVICE ERR", ATH9K_PHYERR_SERVICE
);
874 PHY_ERR("TOR ERR", ATH9K_PHYERR_TOR
);
875 PHY_ERR("OFDM-TIMING ERR", ATH9K_PHYERR_OFDM_TIMING
);
876 PHY_ERR("OFDM-SIGNAL-PARITY ERR", ATH9K_PHYERR_OFDM_SIGNAL_PARITY
);
877 PHY_ERR("OFDM-RATE ERR", ATH9K_PHYERR_OFDM_RATE_ILLEGAL
);
878 PHY_ERR("OFDM-LENGTH ERR", ATH9K_PHYERR_OFDM_LENGTH_ILLEGAL
);
879 PHY_ERR("OFDM-POWER-DROP ERR", ATH9K_PHYERR_OFDM_POWER_DROP
);
880 PHY_ERR("OFDM-SERVICE ERR", ATH9K_PHYERR_OFDM_SERVICE
);
881 PHY_ERR("OFDM-RESTART ERR", ATH9K_PHYERR_OFDM_RESTART
);
882 PHY_ERR("FALSE-RADAR-EXT ERR", ATH9K_PHYERR_FALSE_RADAR_EXT
);
883 PHY_ERR("CCK-TIMING ERR", ATH9K_PHYERR_CCK_TIMING
);
884 PHY_ERR("CCK-HEADER-CRC ERR", ATH9K_PHYERR_CCK_HEADER_CRC
);
885 PHY_ERR("CCK-RATE ERR", ATH9K_PHYERR_CCK_RATE_ILLEGAL
);
886 PHY_ERR("CCK-SERVICE ERR", ATH9K_PHYERR_CCK_SERVICE
);
887 PHY_ERR("CCK-RESTART ERR", ATH9K_PHYERR_CCK_RESTART
);
888 PHY_ERR("CCK-LENGTH ERR", ATH9K_PHYERR_CCK_LENGTH_ILLEGAL
);
889 PHY_ERR("CCK-POWER-DROP ERR", ATH9K_PHYERR_CCK_POWER_DROP
);
890 PHY_ERR("HT-CRC ERR", ATH9K_PHYERR_HT_CRC_ERROR
);
891 PHY_ERR("HT-LENGTH ERR", ATH9K_PHYERR_HT_LENGTH_ILLEGAL
);
892 PHY_ERR("HT-RATE ERR", ATH9K_PHYERR_HT_RATE_ILLEGAL
);
894 RXS_ERR("RX-Pkts-All", rx_pkts_all
);
895 RXS_ERR("RX-Bytes-All", rx_bytes_all
);
896 RXS_ERR("RX-Beacons", rx_beacons
);
897 RXS_ERR("RX-Frags", rx_frags
);
902 retval
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
911 void ath_debug_stat_rx(struct ath_softc
*sc
, struct ath_rx_status
*rs
)
913 #define RX_PHY_ERR_INC(c) sc->debug.stats.rxstats.phy_err_stats[c]++
914 #define RX_SAMP_DBG(c) (sc->debug.bb_mac_samp[sc->debug.sampidx].rs\
917 RX_STAT_INC(rx_pkts_all
);
918 sc
->debug
.stats
.rxstats
.rx_bytes_all
+= rs
->rs_datalen
;
920 if (rs
->rs_status
& ATH9K_RXERR_CRC
)
921 RX_STAT_INC(crc_err
);
922 if (rs
->rs_status
& ATH9K_RXERR_DECRYPT
)
923 RX_STAT_INC(decrypt_crc_err
);
924 if (rs
->rs_status
& ATH9K_RXERR_MIC
)
925 RX_STAT_INC(mic_err
);
926 if (rs
->rs_status
& ATH9K_RX_DELIM_CRC_PRE
)
927 RX_STAT_INC(pre_delim_crc_err
);
928 if (rs
->rs_status
& ATH9K_RX_DELIM_CRC_POST
)
929 RX_STAT_INC(post_delim_crc_err
);
930 if (rs
->rs_status
& ATH9K_RX_DECRYPT_BUSY
)
931 RX_STAT_INC(decrypt_busy_err
);
933 if (rs
->rs_status
& ATH9K_RXERR_PHY
) {
934 RX_STAT_INC(phy_err
);
935 if (rs
->rs_phyerr
< ATH9K_PHYERR_MAX
)
936 RX_PHY_ERR_INC(rs
->rs_phyerr
);
939 #ifdef CONFIG_ATH9K_MAC_DEBUG
940 spin_lock(&sc
->debug
.samp_lock
);
941 RX_SAMP_DBG(jiffies
) = jiffies
;
942 RX_SAMP_DBG(rssi_ctl0
) = rs
->rs_rssi_ctl0
;
943 RX_SAMP_DBG(rssi_ctl1
) = rs
->rs_rssi_ctl1
;
944 RX_SAMP_DBG(rssi_ctl2
) = rs
->rs_rssi_ctl2
;
945 RX_SAMP_DBG(rssi_ext0
) = rs
->rs_rssi_ext0
;
946 RX_SAMP_DBG(rssi_ext1
) = rs
->rs_rssi_ext1
;
947 RX_SAMP_DBG(rssi_ext2
) = rs
->rs_rssi_ext2
;
948 RX_SAMP_DBG(antenna
) = rs
->rs_antenna
;
949 RX_SAMP_DBG(rssi
) = rs
->rs_rssi
;
950 RX_SAMP_DBG(rate
) = rs
->rs_rate
;
951 RX_SAMP_DBG(is_mybeacon
) = rs
->is_mybeacon
;
953 sc
->debug
.rsidx
= (sc
->debug
.rsidx
+ 1) % ATH_DBG_MAX_SAMPLES
;
954 spin_unlock(&sc
->debug
.samp_lock
);
958 #undef RX_PHY_ERR_INC
962 static const struct file_operations fops_recv
= {
963 .read
= read_file_recv
,
965 .owner
= THIS_MODULE
,
966 .llseek
= default_llseek
,
969 static ssize_t
read_file_regidx(struct file
*file
, char __user
*user_buf
,
970 size_t count
, loff_t
*ppos
)
972 struct ath_softc
*sc
= file
->private_data
;
976 len
= sprintf(buf
, "0x%08x\n", sc
->debug
.regidx
);
977 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
980 static ssize_t
write_file_regidx(struct file
*file
, const char __user
*user_buf
,
981 size_t count
, loff_t
*ppos
)
983 struct ath_softc
*sc
= file
->private_data
;
984 unsigned long regidx
;
988 len
= min(count
, sizeof(buf
) - 1);
989 if (copy_from_user(buf
, user_buf
, len
))
993 if (strict_strtoul(buf
, 0, ®idx
))
996 sc
->debug
.regidx
= regidx
;
1000 static const struct file_operations fops_regidx
= {
1001 .read
= read_file_regidx
,
1002 .write
= write_file_regidx
,
1003 .open
= simple_open
,
1004 .owner
= THIS_MODULE
,
1005 .llseek
= default_llseek
,
1008 static ssize_t
read_file_regval(struct file
*file
, char __user
*user_buf
,
1009 size_t count
, loff_t
*ppos
)
1011 struct ath_softc
*sc
= file
->private_data
;
1012 struct ath_hw
*ah
= sc
->sc_ah
;
1017 ath9k_ps_wakeup(sc
);
1018 regval
= REG_READ_D(ah
, sc
->debug
.regidx
);
1019 ath9k_ps_restore(sc
);
1020 len
= sprintf(buf
, "0x%08x\n", regval
);
1021 return simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
1024 static ssize_t
write_file_regval(struct file
*file
, const char __user
*user_buf
,
1025 size_t count
, loff_t
*ppos
)
1027 struct ath_softc
*sc
= file
->private_data
;
1028 struct ath_hw
*ah
= sc
->sc_ah
;
1029 unsigned long regval
;
1033 len
= min(count
, sizeof(buf
) - 1);
1034 if (copy_from_user(buf
, user_buf
, len
))
1038 if (strict_strtoul(buf
, 0, ®val
))
1041 ath9k_ps_wakeup(sc
);
1042 REG_WRITE_D(ah
, sc
->debug
.regidx
, regval
);
1043 ath9k_ps_restore(sc
);
1047 static const struct file_operations fops_regval
= {
1048 .read
= read_file_regval
,
1049 .write
= write_file_regval
,
1050 .open
= simple_open
,
1051 .owner
= THIS_MODULE
,
1052 .llseek
= default_llseek
,
1055 #define REGDUMP_LINE_SIZE 20
1057 static int open_file_regdump(struct inode
*inode
, struct file
*file
)
1059 struct ath_softc
*sc
= inode
->i_private
;
1060 unsigned int len
= 0;
1063 unsigned long num_regs
, regdump_len
, max_reg_offset
;
1065 max_reg_offset
= AR_SREV_9300_20_OR_LATER(sc
->sc_ah
) ? 0x16bd4 : 0xb500;
1066 num_regs
= max_reg_offset
/ 4 + 1;
1067 regdump_len
= num_regs
* REGDUMP_LINE_SIZE
+ 1;
1068 buf
= vmalloc(regdump_len
);
1072 ath9k_ps_wakeup(sc
);
1073 for (i
= 0; i
< num_regs
; i
++)
1074 len
+= scnprintf(buf
+ len
, regdump_len
- len
,
1075 "0x%06x 0x%08x\n", i
<< 2, REG_READ(sc
->sc_ah
, i
<< 2));
1076 ath9k_ps_restore(sc
);
1078 file
->private_data
= buf
;
1083 static const struct file_operations fops_regdump
= {
1084 .open
= open_file_regdump
,
1085 .read
= ath9k_debugfs_read_buf
,
1086 .release
= ath9k_debugfs_release_buf
,
1087 .owner
= THIS_MODULE
,
1088 .llseek
= default_llseek
,/* read accesses f_pos */
1091 static ssize_t
read_file_dump_nfcal(struct file
*file
, char __user
*user_buf
,
1092 size_t count
, loff_t
*ppos
)
1094 struct ath_softc
*sc
= file
->private_data
;
1095 struct ath_hw
*ah
= sc
->sc_ah
;
1096 struct ath9k_nfcal_hist
*h
= sc
->caldata
.nfCalHist
;
1097 struct ath_common
*common
= ath9k_hw_common(ah
);
1098 struct ieee80211_conf
*conf
= &common
->hw
->conf
;
1099 u32 len
= 0, size
= 1500;
1103 u8 chainmask
= (ah
->rxchainmask
<< 3) | ah
->rxchainmask
;
1106 buf
= kzalloc(size
, GFP_KERNEL
);
1110 len
+= snprintf(buf
+ len
, size
- len
,
1111 "Channel Noise Floor : %d\n", ah
->noise
);
1112 len
+= snprintf(buf
+ len
, size
- len
,
1113 "Chain | privNF | # Readings | NF Readings\n");
1114 for (i
= 0; i
< NUM_NF_READINGS
; i
++) {
1115 if (!(chainmask
& (1 << i
)) ||
1116 ((i
>= AR5416_MAX_CHAINS
) && !conf_is_ht40(conf
)))
1119 nread
= AR_PHY_CCA_FILTERWINDOW_LENGTH
- h
[i
].invalidNFcount
;
1120 len
+= snprintf(buf
+ len
, size
- len
, " %d\t %d\t %d\t\t",
1121 i
, h
[i
].privNF
, nread
);
1122 for (j
= 0; j
< nread
; j
++)
1123 len
+= snprintf(buf
+ len
, size
- len
,
1124 " %d", h
[i
].nfCalBuffer
[j
]);
1125 len
+= snprintf(buf
+ len
, size
- len
, "\n");
1131 retval
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
1137 static const struct file_operations fops_dump_nfcal
= {
1138 .read
= read_file_dump_nfcal
,
1139 .open
= simple_open
,
1140 .owner
= THIS_MODULE
,
1141 .llseek
= default_llseek
,
1144 static ssize_t
read_file_base_eeprom(struct file
*file
, char __user
*user_buf
,
1145 size_t count
, loff_t
*ppos
)
1147 struct ath_softc
*sc
= file
->private_data
;
1148 struct ath_hw
*ah
= sc
->sc_ah
;
1149 u32 len
= 0, size
= 1500;
1153 buf
= kzalloc(size
, GFP_KERNEL
);
1157 len
= ah
->eep_ops
->dump_eeprom(ah
, true, buf
, len
, size
);
1159 retval
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
1165 static const struct file_operations fops_base_eeprom
= {
1166 .read
= read_file_base_eeprom
,
1167 .open
= simple_open
,
1168 .owner
= THIS_MODULE
,
1169 .llseek
= default_llseek
,
1172 static ssize_t
read_file_modal_eeprom(struct file
*file
, char __user
*user_buf
,
1173 size_t count
, loff_t
*ppos
)
1175 struct ath_softc
*sc
= file
->private_data
;
1176 struct ath_hw
*ah
= sc
->sc_ah
;
1177 u32 len
= 0, size
= 6000;
1181 buf
= kzalloc(size
, GFP_KERNEL
);
1185 len
= ah
->eep_ops
->dump_eeprom(ah
, false, buf
, len
, size
);
1187 retval
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
1193 static const struct file_operations fops_modal_eeprom
= {
1194 .read
= read_file_modal_eeprom
,
1195 .open
= simple_open
,
1196 .owner
= THIS_MODULE
,
1197 .llseek
= default_llseek
,
1200 #ifdef CONFIG_ATH9K_MAC_DEBUG
1202 void ath9k_debug_samp_bb_mac(struct ath_softc
*sc
)
1204 #define ATH_SAMP_DBG(c) (sc->debug.bb_mac_samp[sc->debug.sampidx].c)
1205 struct ath_hw
*ah
= sc
->sc_ah
;
1206 struct ath_common
*common
= ath9k_hw_common(ah
);
1207 unsigned long flags
;
1210 ath9k_ps_wakeup(sc
);
1212 spin_lock_bh(&sc
->debug
.samp_lock
);
1214 spin_lock_irqsave(&common
->cc_lock
, flags
);
1215 ath_hw_cycle_counters_update(common
);
1217 ATH_SAMP_DBG(cc
.cycles
) = common
->cc_ani
.cycles
;
1218 ATH_SAMP_DBG(cc
.rx_busy
) = common
->cc_ani
.rx_busy
;
1219 ATH_SAMP_DBG(cc
.rx_frame
) = common
->cc_ani
.rx_frame
;
1220 ATH_SAMP_DBG(cc
.tx_frame
) = common
->cc_ani
.tx_frame
;
1221 spin_unlock_irqrestore(&common
->cc_lock
, flags
);
1223 ATH_SAMP_DBG(noise
) = ah
->noise
;
1225 REG_WRITE_D(ah
, AR_MACMISC
,
1226 ((AR_MACMISC_DMA_OBS_LINE_8
<< AR_MACMISC_DMA_OBS_S
) |
1227 (AR_MACMISC_MISC_OBS_BUS_1
<<
1228 AR_MACMISC_MISC_OBS_BUS_MSB_S
)));
1230 for (i
= 0; i
< ATH9K_NUM_DMA_DEBUG_REGS
; i
++)
1231 ATH_SAMP_DBG(dma_dbg_reg_vals
[i
]) = REG_READ_D(ah
,
1232 AR_DMADBG_0
+ (i
* sizeof(u32
)));
1234 ATH_SAMP_DBG(pcu_obs
) = REG_READ_D(ah
, AR_OBS_BUS_1
);
1235 ATH_SAMP_DBG(pcu_cr
) = REG_READ_D(ah
, AR_CR
);
1237 memcpy(ATH_SAMP_DBG(nfCalHist
), sc
->caldata
.nfCalHist
,
1238 sizeof(ATH_SAMP_DBG(nfCalHist
)));
1240 sc
->debug
.sampidx
= (sc
->debug
.sampidx
+ 1) % ATH_DBG_MAX_SAMPLES
;
1241 spin_unlock_bh(&sc
->debug
.samp_lock
);
1242 ath9k_ps_restore(sc
);
1247 static int open_file_bb_mac_samps(struct inode
*inode
, struct file
*file
)
1249 #define ATH_SAMP_DBG(c) bb_mac_samp[sampidx].c
1250 struct ath_softc
*sc
= inode
->i_private
;
1251 struct ath_hw
*ah
= sc
->sc_ah
;
1252 struct ath_common
*common
= ath9k_hw_common(ah
);
1253 struct ieee80211_conf
*conf
= &common
->hw
->conf
;
1254 struct ath_dbg_bb_mac_samp
*bb_mac_samp
;
1255 struct ath9k_nfcal_hist
*h
;
1256 int i
, j
, qcuOffset
= 0, dcuOffset
= 0;
1257 u32
*qcuBase
, *dcuBase
, size
= 30000, len
= 0;
1260 u8 chainmask
= (ah
->rxchainmask
<< 3) | ah
->rxchainmask
;
1263 if (test_bit(SC_OP_INVALID
, &sc
->sc_flags
))
1266 buf
= vmalloc(size
);
1269 bb_mac_samp
= vmalloc(sizeof(*bb_mac_samp
) * ATH_DBG_MAX_SAMPLES
);
1274 /* Account the current state too */
1275 ath9k_debug_samp_bb_mac(sc
);
1277 spin_lock_bh(&sc
->debug
.samp_lock
);
1278 memcpy(bb_mac_samp
, sc
->debug
.bb_mac_samp
,
1279 sizeof(*bb_mac_samp
) * ATH_DBG_MAX_SAMPLES
);
1280 len
+= snprintf(buf
+ len
, size
- len
,
1281 "Current Sample Index: %d\n", sc
->debug
.sampidx
);
1282 spin_unlock_bh(&sc
->debug
.samp_lock
);
1284 len
+= snprintf(buf
+ len
, size
- len
,
1285 "Raw DMA Debug Dump:\n");
1286 len
+= snprintf(buf
+ len
, size
- len
, "Sample |\t");
1287 for (i
= 0; i
< ATH9K_NUM_DMA_DEBUG_REGS
; i
++)
1288 len
+= snprintf(buf
+ len
, size
- len
, " DMA Reg%d |\t", i
);
1289 len
+= snprintf(buf
+ len
, size
- len
, "\n");
1291 for (sampidx
= 0; sampidx
< ATH_DBG_MAX_SAMPLES
; sampidx
++) {
1292 len
+= snprintf(buf
+ len
, size
- len
, "%d\t", sampidx
);
1294 for (i
= 0; i
< ATH9K_NUM_DMA_DEBUG_REGS
; i
++)
1295 len
+= snprintf(buf
+ len
, size
- len
, " %08x\t",
1296 ATH_SAMP_DBG(dma_dbg_reg_vals
[i
]));
1297 len
+= snprintf(buf
+ len
, size
- len
, "\n");
1299 len
+= snprintf(buf
+ len
, size
- len
, "\n");
1301 len
+= snprintf(buf
+ len
, size
- len
,
1302 "Sample Num QCU: chain_st fsp_ok fsp_st DCU: chain_st\n");
1303 for (sampidx
= 0; sampidx
< ATH_DBG_MAX_SAMPLES
; sampidx
++) {
1304 qcuBase
= &ATH_SAMP_DBG(dma_dbg_reg_vals
[0]);
1305 dcuBase
= &ATH_SAMP_DBG(dma_dbg_reg_vals
[4]);
1307 for (i
= 0; i
< ATH9K_NUM_QUEUES
; i
++,
1308 qcuOffset
+= 4, dcuOffset
+= 5) {
1318 if (!sc
->debug
.stats
.txstats
[i
].queued
)
1321 len
+= snprintf(buf
+ len
, size
- len
,
1322 "%4d %7d %2x %1x %2x %2x\n",
1324 (*qcuBase
& (0x7 << qcuOffset
)) >> qcuOffset
,
1325 (*qcuBase
& (0x8 << qcuOffset
)) >>
1327 ATH_SAMP_DBG(dma_dbg_reg_vals
[2]) &
1328 (0x7 << (i
* 3)) >> (i
* 3),
1329 (*dcuBase
& (0x1f << dcuOffset
)) >> dcuOffset
);
1331 len
+= snprintf(buf
+ len
, size
- len
, "\n");
1333 len
+= snprintf(buf
+ len
, size
- len
,
1334 "samp qcu_sh qcu_fh qcu_comp dcu_comp dcu_arb dcu_fp "
1335 "ch_idle_dur ch_idle_dur_val txfifo_val0 txfifo_val1 "
1336 "txfifo_dcu0 txfifo_dcu1 pcu_obs AR_CR\n");
1338 for (sampidx
= 0; sampidx
< ATH_DBG_MAX_SAMPLES
; sampidx
++) {
1339 qcuBase
= &ATH_SAMP_DBG(dma_dbg_reg_vals
[0]);
1340 dcuBase
= &ATH_SAMP_DBG(dma_dbg_reg_vals
[4]);
1342 len
+= snprintf(buf
+ len
, size
- len
, "%4d %5x %5x ", sampidx
,
1343 (ATH_SAMP_DBG(dma_dbg_reg_vals
[3]) & 0x003c0000) >> 18,
1344 (ATH_SAMP_DBG(dma_dbg_reg_vals
[3]) & 0x03c00000) >> 22);
1345 len
+= snprintf(buf
+ len
, size
- len
, "%7x %8x ",
1346 (ATH_SAMP_DBG(dma_dbg_reg_vals
[3]) & 0x1c000000) >> 26,
1347 (ATH_SAMP_DBG(dma_dbg_reg_vals
[6]) & 0x3));
1348 len
+= snprintf(buf
+ len
, size
- len
, "%7x %7x ",
1349 (ATH_SAMP_DBG(dma_dbg_reg_vals
[5]) & 0x06000000) >> 25,
1350 (ATH_SAMP_DBG(dma_dbg_reg_vals
[5]) & 0x38000000) >> 27);
1351 len
+= snprintf(buf
+ len
, size
- len
, "%7d %12d ",
1352 (ATH_SAMP_DBG(dma_dbg_reg_vals
[6]) & 0x000003fc) >> 2,
1353 (ATH_SAMP_DBG(dma_dbg_reg_vals
[6]) & 0x00000400) >> 10);
1354 len
+= snprintf(buf
+ len
, size
- len
, "%12d %12d ",
1355 (ATH_SAMP_DBG(dma_dbg_reg_vals
[6]) & 0x00000800) >> 11,
1356 (ATH_SAMP_DBG(dma_dbg_reg_vals
[6]) & 0x00001000) >> 12);
1357 len
+= snprintf(buf
+ len
, size
- len
, "%12d %12d ",
1358 (ATH_SAMP_DBG(dma_dbg_reg_vals
[6]) & 0x0001e000) >> 13,
1359 (ATH_SAMP_DBG(dma_dbg_reg_vals
[6]) & 0x001e0000) >> 17);
1360 len
+= snprintf(buf
+ len
, size
- len
, "0x%07x 0x%07x\n",
1361 ATH_SAMP_DBG(pcu_obs
), ATH_SAMP_DBG(pcu_cr
));
1364 len
+= snprintf(buf
+ len
, size
- len
,
1365 "Sample ChNoise Chain privNF #Reading Readings\n");
1366 for (sampidx
= 0; sampidx
< ATH_DBG_MAX_SAMPLES
; sampidx
++) {
1367 h
= ATH_SAMP_DBG(nfCalHist
);
1368 if (!ATH_SAMP_DBG(noise
))
1371 for (i
= 0; i
< NUM_NF_READINGS
; i
++) {
1372 if (!(chainmask
& (1 << i
)) ||
1373 ((i
>= AR5416_MAX_CHAINS
) && !conf_is_ht40(conf
)))
1376 nread
= AR_PHY_CCA_FILTERWINDOW_LENGTH
-
1377 h
[i
].invalidNFcount
;
1378 len
+= snprintf(buf
+ len
, size
- len
,
1379 "%4d %5d %4d\t %d\t %d\t",
1380 sampidx
, ATH_SAMP_DBG(noise
),
1381 i
, h
[i
].privNF
, nread
);
1382 for (j
= 0; j
< nread
; j
++)
1383 len
+= snprintf(buf
+ len
, size
- len
,
1384 " %d", h
[i
].nfCalBuffer
[j
]);
1385 len
+= snprintf(buf
+ len
, size
- len
, "\n");
1388 len
+= snprintf(buf
+ len
, size
- len
, "\nCycle counters:\n"
1389 "Sample Total Rxbusy Rxframes Txframes\n");
1390 for (sampidx
= 0; sampidx
< ATH_DBG_MAX_SAMPLES
; sampidx
++) {
1391 if (!ATH_SAMP_DBG(cc
.cycles
))
1393 len
+= snprintf(buf
+ len
, size
- len
,
1394 "%4d %08x %08x %08x %08x\n",
1395 sampidx
, ATH_SAMP_DBG(cc
.cycles
),
1396 ATH_SAMP_DBG(cc
.rx_busy
),
1397 ATH_SAMP_DBG(cc
.rx_frame
),
1398 ATH_SAMP_DBG(cc
.tx_frame
));
1401 len
+= snprintf(buf
+ len
, size
- len
, "Tx status Dump :\n");
1402 len
+= snprintf(buf
+ len
, size
- len
,
1403 "Sample rssi:- ctl0 ctl1 ctl2 ext0 ext1 ext2 comb "
1404 "isok rts_fail data_fail rate tid qid "
1405 "ba_low ba_high tx_before(ms)\n");
1406 for (sampidx
= 0; sampidx
< ATH_DBG_MAX_SAMPLES
; sampidx
++) {
1407 for (i
= 0; i
< ATH_DBG_MAX_SAMPLES
; i
++) {
1408 if (!ATH_SAMP_DBG(ts
[i
].jiffies
))
1410 len
+= snprintf(buf
+ len
, size
- len
, "%-14d"
1411 "%-4d %-4d %-4d %-4d %-4d %-4d %-4d %-4d %-8d "
1412 "%-9d %-4d %-3d %-3d %08x %08x %-11d\n",
1414 ATH_SAMP_DBG(ts
[i
].rssi_ctl0
),
1415 ATH_SAMP_DBG(ts
[i
].rssi_ctl1
),
1416 ATH_SAMP_DBG(ts
[i
].rssi_ctl2
),
1417 ATH_SAMP_DBG(ts
[i
].rssi_ext0
),
1418 ATH_SAMP_DBG(ts
[i
].rssi_ext1
),
1419 ATH_SAMP_DBG(ts
[i
].rssi_ext2
),
1420 ATH_SAMP_DBG(ts
[i
].rssi
),
1421 ATH_SAMP_DBG(ts
[i
].isok
),
1422 ATH_SAMP_DBG(ts
[i
].rts_fail_cnt
),
1423 ATH_SAMP_DBG(ts
[i
].data_fail_cnt
),
1424 ATH_SAMP_DBG(ts
[i
].rateindex
),
1425 ATH_SAMP_DBG(ts
[i
].tid
),
1426 ATH_SAMP_DBG(ts
[i
].qid
),
1427 ATH_SAMP_DBG(ts
[i
].ba_low
),
1428 ATH_SAMP_DBG(ts
[i
].ba_high
),
1429 jiffies_to_msecs(jiffies
-
1430 ATH_SAMP_DBG(ts
[i
].jiffies
)));
1434 len
+= snprintf(buf
+ len
, size
- len
, "Rx status Dump :\n");
1435 len
+= snprintf(buf
+ len
, size
- len
, "Sample rssi:- ctl0 ctl1 ctl2 "
1436 "ext0 ext1 ext2 comb beacon ant rate rx_before(ms)\n");
1437 for (sampidx
= 0; sampidx
< ATH_DBG_MAX_SAMPLES
; sampidx
++) {
1438 for (i
= 0; i
< ATH_DBG_MAX_SAMPLES
; i
++) {
1439 if (!ATH_SAMP_DBG(rs
[i
].jiffies
))
1441 len
+= snprintf(buf
+ len
, size
- len
, "%-14d"
1442 "%-4d %-4d %-4d %-4d %-4d %-4d %-4d %-9s %-2d %02x %-13d\n",
1444 ATH_SAMP_DBG(rs
[i
].rssi_ctl0
),
1445 ATH_SAMP_DBG(rs
[i
].rssi_ctl1
),
1446 ATH_SAMP_DBG(rs
[i
].rssi_ctl2
),
1447 ATH_SAMP_DBG(rs
[i
].rssi_ext0
),
1448 ATH_SAMP_DBG(rs
[i
].rssi_ext1
),
1449 ATH_SAMP_DBG(rs
[i
].rssi_ext2
),
1450 ATH_SAMP_DBG(rs
[i
].rssi
),
1451 ATH_SAMP_DBG(rs
[i
].is_mybeacon
) ?
1453 ATH_SAMP_DBG(rs
[i
].antenna
),
1454 ATH_SAMP_DBG(rs
[i
].rate
),
1455 jiffies_to_msecs(jiffies
-
1456 ATH_SAMP_DBG(rs
[i
].jiffies
)));
1461 file
->private_data
= buf
;
1467 static const struct file_operations fops_samps
= {
1468 .open
= open_file_bb_mac_samps
,
1469 .read
= ath9k_debugfs_read_buf
,
1470 .release
= ath9k_debugfs_release_buf
,
1471 .owner
= THIS_MODULE
,
1472 .llseek
= default_llseek
,
1477 #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
1478 static ssize_t
read_file_btcoex(struct file
*file
, char __user
*user_buf
,
1479 size_t count
, loff_t
*ppos
)
1481 struct ath_softc
*sc
= file
->private_data
;
1482 u32 len
= 0, size
= 1500;
1486 buf
= kzalloc(size
, GFP_KERNEL
);
1490 if (!sc
->sc_ah
->common
.btcoex_enabled
) {
1491 len
= snprintf(buf
, size
, "%s\n",
1492 "BTCOEX is disabled");
1496 len
= ath9k_dump_btcoex(sc
, buf
, size
);
1498 retval
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
1504 static const struct file_operations fops_btcoex
= {
1505 .read
= read_file_btcoex
,
1506 .open
= simple_open
,
1507 .owner
= THIS_MODULE
,
1508 .llseek
= default_llseek
,
1512 static ssize_t
read_file_node_stat(struct file
*file
, char __user
*user_buf
,
1513 size_t count
, loff_t
*ppos
)
1515 struct ath_node
*an
= file
->private_data
;
1516 struct ath_softc
*sc
= an
->sc
;
1517 struct ath_atx_tid
*tid
;
1518 struct ath_atx_ac
*ac
;
1519 struct ath_txq
*txq
;
1520 u32 len
= 0, size
= 4096;
1525 buf
= kzalloc(size
, GFP_KERNEL
);
1529 if (!an
->sta
->ht_cap
.ht_supported
) {
1530 len
= snprintf(buf
, size
, "%s\n",
1531 "HT not supported");
1535 len
= snprintf(buf
, size
, "Max-AMPDU: %d\n",
1537 len
+= snprintf(buf
+ len
, size
- len
, "MPDU Density: %d\n\n",
1540 len
+= snprintf(buf
+ len
, size
- len
,
1541 "%2s%7s\n", "AC", "SCHED");
1543 for (acno
= 0, ac
= &an
->ac
[acno
];
1544 acno
< IEEE80211_NUM_ACS
; acno
++, ac
++) {
1546 ath_txq_lock(sc
, txq
);
1547 len
+= snprintf(buf
+ len
, size
- len
,
1550 ath_txq_unlock(sc
, txq
);
1553 len
+= snprintf(buf
+ len
, size
- len
,
1554 "\n%3s%11s%10s%10s%10s%10s%9s%6s%8s\n",
1555 "TID", "SEQ_START", "SEQ_NEXT", "BAW_SIZE",
1556 "BAW_HEAD", "BAW_TAIL", "BAR_IDX", "SCHED", "PAUSED");
1558 for (tidno
= 0, tid
= &an
->tid
[tidno
];
1559 tidno
< IEEE80211_NUM_TIDS
; tidno
++, tid
++) {
1561 ath_txq_lock(sc
, txq
);
1562 len
+= snprintf(buf
+ len
, size
- len
,
1563 "%3d%11d%10d%10d%10d%10d%9d%6d%8d\n",
1564 tid
->tidno
, tid
->seq_start
, tid
->seq_next
,
1565 tid
->baw_size
, tid
->baw_head
, tid
->baw_tail
,
1566 tid
->bar_index
, tid
->sched
, tid
->paused
);
1567 ath_txq_unlock(sc
, txq
);
1570 retval
= simple_read_from_buffer(user_buf
, count
, ppos
, buf
, len
);
1576 static const struct file_operations fops_node_stat
= {
1577 .read
= read_file_node_stat
,
1578 .open
= simple_open
,
1579 .owner
= THIS_MODULE
,
1580 .llseek
= default_llseek
,
1583 void ath9k_sta_add_debugfs(struct ieee80211_hw
*hw
,
1584 struct ieee80211_vif
*vif
,
1585 struct ieee80211_sta
*sta
,
1588 struct ath_node
*an
= (struct ath_node
*)sta
->drv_priv
;
1589 an
->node_stat
= debugfs_create_file("node_stat", S_IRUGO
,
1590 dir
, an
, &fops_node_stat
);
1593 void ath9k_sta_remove_debugfs(struct ieee80211_hw
*hw
,
1594 struct ieee80211_vif
*vif
,
1595 struct ieee80211_sta
*sta
,
1598 struct ath_node
*an
= (struct ath_node
*)sta
->drv_priv
;
1599 debugfs_remove(an
->node_stat
);
1602 /* Ethtool support for get-stats */
1604 #define AMKSTR(nm) #nm "_BE", #nm "_BK", #nm "_VI", #nm "_VO"
1605 static const char ath9k_gstrings_stats
[][ETH_GSTRING_LEN
] = {
1612 AMKSTR(d_tx_mpdus_queued
),
1613 AMKSTR(d_tx_mpdus_completed
),
1614 AMKSTR(d_tx_mpdu_xretries
),
1615 AMKSTR(d_tx_aggregates
),
1616 AMKSTR(d_tx_ampdus_queued_hw
),
1617 AMKSTR(d_tx_ampdus_queued_sw
),
1618 AMKSTR(d_tx_ampdus_completed
),
1619 AMKSTR(d_tx_ampdu_retries
),
1620 AMKSTR(d_tx_ampdu_xretries
),
1621 AMKSTR(d_tx_fifo_underrun
),
1622 AMKSTR(d_tx_op_exceeded
),
1623 AMKSTR(d_tx_timer_expiry
),
1624 AMKSTR(d_tx_desc_cfg_err
),
1625 AMKSTR(d_tx_data_underrun
),
1626 AMKSTR(d_tx_delim_underrun
),
1627 "d_rx_decrypt_crc_err",
1630 "d_rx_pre_delim_crc_err",
1631 "d_rx_post_delim_crc_err",
1632 "d_rx_decrypt_busy_err",
1634 "d_rx_phyerr_radar",
1635 "d_rx_phyerr_ofdm_timing",
1636 "d_rx_phyerr_cck_timing",
1639 #define ATH9K_SSTATS_LEN ARRAY_SIZE(ath9k_gstrings_stats)
1641 void ath9k_get_et_strings(struct ieee80211_hw
*hw
,
1642 struct ieee80211_vif
*vif
,
1645 if (sset
== ETH_SS_STATS
)
1646 memcpy(data
, *ath9k_gstrings_stats
,
1647 sizeof(ath9k_gstrings_stats
));
1650 int ath9k_get_et_sset_count(struct ieee80211_hw
*hw
,
1651 struct ieee80211_vif
*vif
, int sset
)
1653 if (sset
== ETH_SS_STATS
)
1654 return ATH9K_SSTATS_LEN
;
1658 #define AWDATA(elem) \
1660 data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].elem; \
1661 data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BK)].elem; \
1662 data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VI)].elem; \
1663 data[i++] = sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VO)].elem; \
1666 #define AWDATA_RX(elem) \
1668 data[i++] = sc->debug.stats.rxstats.elem; \
1671 void ath9k_get_et_stats(struct ieee80211_hw
*hw
,
1672 struct ieee80211_vif
*vif
,
1673 struct ethtool_stats
*stats
, u64
*data
)
1675 struct ath_softc
*sc
= hw
->priv
;
1678 data
[i
++] = (sc
->debug
.stats
.txstats
[PR_QNUM(IEEE80211_AC_BE
)].tx_pkts_all
+
1679 sc
->debug
.stats
.txstats
[PR_QNUM(IEEE80211_AC_BK
)].tx_pkts_all
+
1680 sc
->debug
.stats
.txstats
[PR_QNUM(IEEE80211_AC_VI
)].tx_pkts_all
+
1681 sc
->debug
.stats
.txstats
[PR_QNUM(IEEE80211_AC_VO
)].tx_pkts_all
);
1682 data
[i
++] = (sc
->debug
.stats
.txstats
[PR_QNUM(IEEE80211_AC_BE
)].tx_bytes_all
+
1683 sc
->debug
.stats
.txstats
[PR_QNUM(IEEE80211_AC_BK
)].tx_bytes_all
+
1684 sc
->debug
.stats
.txstats
[PR_QNUM(IEEE80211_AC_VI
)].tx_bytes_all
+
1685 sc
->debug
.stats
.txstats
[PR_QNUM(IEEE80211_AC_VO
)].tx_bytes_all
);
1686 AWDATA_RX(rx_pkts_all
);
1687 AWDATA_RX(rx_bytes_all
);
1689 AWDATA(tx_pkts_all
);
1690 AWDATA(tx_bytes_all
);
1695 AWDATA(a_queued_hw
);
1696 AWDATA(a_queued_sw
);
1697 AWDATA(a_completed
);
1700 AWDATA(fifo_underrun
);
1703 AWDATA(desc_cfg_err
);
1704 AWDATA(data_underrun
);
1705 AWDATA(delim_underrun
);
1707 AWDATA_RX(decrypt_crc_err
);
1710 AWDATA_RX(pre_delim_crc_err
);
1711 AWDATA_RX(post_delim_crc_err
);
1712 AWDATA_RX(decrypt_busy_err
);
1714 AWDATA_RX(phy_err_stats
[ATH9K_PHYERR_RADAR
]);
1715 AWDATA_RX(phy_err_stats
[ATH9K_PHYERR_OFDM_TIMING
]);
1716 AWDATA_RX(phy_err_stats
[ATH9K_PHYERR_CCK_TIMING
]);
1718 WARN_ON(i
!= ATH9K_SSTATS_LEN
);
1721 int ath9k_init_debug(struct ath_hw
*ah
)
1723 struct ath_common
*common
= ath9k_hw_common(ah
);
1724 struct ath_softc
*sc
= (struct ath_softc
*) common
->priv
;
1726 sc
->debug
.debugfs_phy
= debugfs_create_dir("ath9k",
1727 sc
->hw
->wiphy
->debugfsdir
);
1728 if (!sc
->debug
.debugfs_phy
)
1731 #ifdef CONFIG_ATH_DEBUG
1732 debugfs_create_file("debug", S_IRUSR
| S_IWUSR
, sc
->debug
.debugfs_phy
,
1736 ath9k_dfs_init_debug(sc
);
1738 debugfs_create_file("dma", S_IRUSR
, sc
->debug
.debugfs_phy
, sc
,
1740 debugfs_create_file("interrupt", S_IRUSR
, sc
->debug
.debugfs_phy
, sc
,
1742 debugfs_create_file("xmit", S_IRUSR
, sc
->debug
.debugfs_phy
, sc
,
1744 debugfs_create_file("queues", S_IRUSR
, sc
->debug
.debugfs_phy
, sc
,
1746 debugfs_create_u32("qlen_bk", S_IRUSR
| S_IWUSR
, sc
->debug
.debugfs_phy
,
1747 &sc
->tx
.txq_max_pending
[IEEE80211_AC_BK
]);
1748 debugfs_create_u32("qlen_be", S_IRUSR
| S_IWUSR
, sc
->debug
.debugfs_phy
,
1749 &sc
->tx
.txq_max_pending
[IEEE80211_AC_BE
]);
1750 debugfs_create_u32("qlen_vi", S_IRUSR
| S_IWUSR
, sc
->debug
.debugfs_phy
,
1751 &sc
->tx
.txq_max_pending
[IEEE80211_AC_VI
]);
1752 debugfs_create_u32("qlen_vo", S_IRUSR
| S_IWUSR
, sc
->debug
.debugfs_phy
,
1753 &sc
->tx
.txq_max_pending
[IEEE80211_AC_VO
]);
1754 debugfs_create_file("misc", S_IRUSR
, sc
->debug
.debugfs_phy
, sc
,
1756 debugfs_create_file("reset", S_IRUSR
, sc
->debug
.debugfs_phy
, sc
,
1758 debugfs_create_file("recv", S_IRUSR
, sc
->debug
.debugfs_phy
, sc
,
1760 debugfs_create_file("rx_chainmask", S_IRUSR
| S_IWUSR
,
1761 sc
->debug
.debugfs_phy
, sc
, &fops_rx_chainmask
);
1762 debugfs_create_file("tx_chainmask", S_IRUSR
| S_IWUSR
,
1763 sc
->debug
.debugfs_phy
, sc
, &fops_tx_chainmask
);
1764 debugfs_create_file("disable_ani", S_IRUSR
| S_IWUSR
,
1765 sc
->debug
.debugfs_phy
, sc
, &fops_disable_ani
);
1766 debugfs_create_bool("paprd", S_IRUSR
| S_IWUSR
, sc
->debug
.debugfs_phy
,
1767 &sc
->sc_ah
->config
.enable_paprd
);
1768 debugfs_create_file("regidx", S_IRUSR
| S_IWUSR
, sc
->debug
.debugfs_phy
,
1770 debugfs_create_file("regval", S_IRUSR
| S_IWUSR
, sc
->debug
.debugfs_phy
,
1772 debugfs_create_bool("ignore_extcca", S_IRUSR
| S_IWUSR
,
1773 sc
->debug
.debugfs_phy
,
1774 &ah
->config
.cwm_ignore_extcca
);
1775 debugfs_create_file("regdump", S_IRUSR
, sc
->debug
.debugfs_phy
, sc
,
1777 debugfs_create_file("dump_nfcal", S_IRUSR
, sc
->debug
.debugfs_phy
, sc
,
1779 debugfs_create_file("base_eeprom", S_IRUSR
, sc
->debug
.debugfs_phy
, sc
,
1781 debugfs_create_file("modal_eeprom", S_IRUSR
, sc
->debug
.debugfs_phy
, sc
,
1782 &fops_modal_eeprom
);
1783 #ifdef CONFIG_ATH9K_MAC_DEBUG
1784 debugfs_create_file("samples", S_IRUSR
, sc
->debug
.debugfs_phy
, sc
,
1787 debugfs_create_u32("gpio_mask", S_IRUSR
| S_IWUSR
,
1788 sc
->debug
.debugfs_phy
, &sc
->sc_ah
->gpio_mask
);
1789 debugfs_create_u32("gpio_val", S_IRUSR
| S_IWUSR
,
1790 sc
->debug
.debugfs_phy
, &sc
->sc_ah
->gpio_val
);
1791 debugfs_create_file("diversity", S_IRUSR
| S_IWUSR
,
1792 sc
->debug
.debugfs_phy
, sc
, &fops_ant_diversity
);
1793 #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
1794 debugfs_create_file("btcoex", S_IRUSR
, sc
->debug
.debugfs_phy
, sc
,