diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/debug.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/debug.c | 95 |
1 files changed, 90 insertions, 5 deletions
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index 6d20725d6451..9e369208f7dc 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -486,6 +486,83 @@ static const struct file_operations fops_wiphy = { | |||
486 | .owner = THIS_MODULE | 486 | .owner = THIS_MODULE |
487 | }; | 487 | }; |
488 | 488 | ||
489 | #define PR(str, elem) \ | ||
490 | do { \ | ||
491 | len += snprintf(buf + len, size - len, \ | ||
492 | "%s%13u%11u%10u%10u\n", str, \ | ||
493 | sc->debug.stats.txstats[sc->tx.hwq_map[ATH9K_WME_AC_BE]].elem, \ | ||
494 | sc->debug.stats.txstats[sc->tx.hwq_map[ATH9K_WME_AC_BK]].elem, \ | ||
495 | sc->debug.stats.txstats[sc->tx.hwq_map[ATH9K_WME_AC_VI]].elem, \ | ||
496 | sc->debug.stats.txstats[sc->tx.hwq_map[ATH9K_WME_AC_VO]].elem); \ | ||
497 | } while(0) | ||
498 | |||
499 | static ssize_t read_file_xmit(struct file *file, char __user *user_buf, | ||
500 | size_t count, loff_t *ppos) | ||
501 | { | ||
502 | struct ath_softc *sc = file->private_data; | ||
503 | char *buf; | ||
504 | unsigned int len = 0, size = 2048; | ||
505 | ssize_t retval = 0; | ||
506 | |||
507 | buf = kzalloc(size, GFP_KERNEL); | ||
508 | if (buf == NULL) | ||
509 | return 0; | ||
510 | |||
511 | len += sprintf(buf, "%30s %10s%10s%10s\n\n", "BE", "BK", "VI", "VO"); | ||
512 | |||
513 | PR("MPDUs Queued: ", queued); | ||
514 | PR("MPDUs Completed: ", completed); | ||
515 | PR("Aggregates: ", a_aggr); | ||
516 | PR("AMPDUs Queued: ", a_queued); | ||
517 | PR("AMPDUs Completed:", a_completed); | ||
518 | PR("AMPDUs Retried: ", a_retries); | ||
519 | PR("AMPDUs XRetried: ", a_xretries); | ||
520 | PR("FIFO Underrun: ", fifo_underrun); | ||
521 | PR("TXOP Exceeded: ", xtxop); | ||
522 | PR("TXTIMER Expiry: ", timer_exp); | ||
523 | PR("DESC CFG Error: ", desc_cfg_err); | ||
524 | PR("DATA Underrun: ", data_underrun); | ||
525 | PR("DELIM Underrun: ", delim_underrun); | ||
526 | |||
527 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
528 | kfree(buf); | ||
529 | |||
530 | return retval; | ||
531 | } | ||
532 | |||
533 | void ath_debug_stat_tx(struct ath_softc *sc, struct ath_txq *txq, | ||
534 | struct ath_buf *bf) | ||
535 | { | ||
536 | struct ath_desc *ds = bf->bf_desc; | ||
537 | |||
538 | if (bf_isampdu(bf)) { | ||
539 | if (bf_isxretried(bf)) | ||
540 | TX_STAT_INC(txq->axq_qnum, a_xretries); | ||
541 | else | ||
542 | TX_STAT_INC(txq->axq_qnum, a_completed); | ||
543 | } else { | ||
544 | TX_STAT_INC(txq->axq_qnum, completed); | ||
545 | } | ||
546 | |||
547 | if (ds->ds_txstat.ts_status & ATH9K_TXERR_FIFO) | ||
548 | TX_STAT_INC(txq->axq_qnum, fifo_underrun); | ||
549 | if (ds->ds_txstat.ts_status & ATH9K_TXERR_XTXOP) | ||
550 | TX_STAT_INC(txq->axq_qnum, xtxop); | ||
551 | if (ds->ds_txstat.ts_status & ATH9K_TXERR_TIMER_EXPIRED) | ||
552 | TX_STAT_INC(txq->axq_qnum, timer_exp); | ||
553 | if (ds->ds_txstat.ts_flags & ATH9K_TX_DESC_CFG_ERR) | ||
554 | TX_STAT_INC(txq->axq_qnum, desc_cfg_err); | ||
555 | if (ds->ds_txstat.ts_flags & ATH9K_TX_DATA_UNDERRUN) | ||
556 | TX_STAT_INC(txq->axq_qnum, data_underrun); | ||
557 | if (ds->ds_txstat.ts_flags & ATH9K_TX_DELIM_UNDERRUN) | ||
558 | TX_STAT_INC(txq->axq_qnum, delim_underrun); | ||
559 | } | ||
560 | |||
561 | static const struct file_operations fops_xmit = { | ||
562 | .read = read_file_xmit, | ||
563 | .open = ath9k_debugfs_open, | ||
564 | .owner = THIS_MODULE | ||
565 | }; | ||
489 | 566 | ||
490 | int ath9k_init_debug(struct ath_softc *sc) | 567 | int ath9k_init_debug(struct ath_softc *sc) |
491 | { | 568 | { |
@@ -500,35 +577,42 @@ int ath9k_init_debug(struct ath_softc *sc) | |||
500 | goto err; | 577 | goto err; |
501 | 578 | ||
502 | sc->debug.debugfs_debug = debugfs_create_file("debug", | 579 | sc->debug.debugfs_debug = debugfs_create_file("debug", |
503 | S_IRUGO | S_IWUSR, sc->debug.debugfs_phy, sc, &fops_debug); | 580 | S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc, &fops_debug); |
504 | if (!sc->debug.debugfs_debug) | 581 | if (!sc->debug.debugfs_debug) |
505 | goto err; | 582 | goto err; |
506 | 583 | ||
507 | sc->debug.debugfs_dma = debugfs_create_file("dma", S_IRUGO, | 584 | sc->debug.debugfs_dma = debugfs_create_file("dma", S_IRUSR, |
508 | sc->debug.debugfs_phy, sc, &fops_dma); | 585 | sc->debug.debugfs_phy, sc, &fops_dma); |
509 | if (!sc->debug.debugfs_dma) | 586 | if (!sc->debug.debugfs_dma) |
510 | goto err; | 587 | goto err; |
511 | 588 | ||
512 | sc->debug.debugfs_interrupt = debugfs_create_file("interrupt", | 589 | sc->debug.debugfs_interrupt = debugfs_create_file("interrupt", |
513 | S_IRUGO, | 590 | S_IRUSR, |
514 | sc->debug.debugfs_phy, | 591 | sc->debug.debugfs_phy, |
515 | sc, &fops_interrupt); | 592 | sc, &fops_interrupt); |
516 | if (!sc->debug.debugfs_interrupt) | 593 | if (!sc->debug.debugfs_interrupt) |
517 | goto err; | 594 | goto err; |
518 | 595 | ||
519 | sc->debug.debugfs_rcstat = debugfs_create_file("rcstat", | 596 | sc->debug.debugfs_rcstat = debugfs_create_file("rcstat", |
520 | S_IRUGO, | 597 | S_IRUSR, |
521 | sc->debug.debugfs_phy, | 598 | sc->debug.debugfs_phy, |
522 | sc, &fops_rcstat); | 599 | sc, &fops_rcstat); |
523 | if (!sc->debug.debugfs_rcstat) | 600 | if (!sc->debug.debugfs_rcstat) |
524 | goto err; | 601 | goto err; |
525 | 602 | ||
526 | sc->debug.debugfs_wiphy = debugfs_create_file( | 603 | sc->debug.debugfs_wiphy = debugfs_create_file( |
527 | "wiphy", S_IRUGO | S_IWUSR, sc->debug.debugfs_phy, sc, | 604 | "wiphy", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc, |
528 | &fops_wiphy); | 605 | &fops_wiphy); |
529 | if (!sc->debug.debugfs_wiphy) | 606 | if (!sc->debug.debugfs_wiphy) |
530 | goto err; | 607 | goto err; |
531 | 608 | ||
609 | sc->debug.debugfs_xmit = debugfs_create_file("xmit", | ||
610 | S_IRUSR, | ||
611 | sc->debug.debugfs_phy, | ||
612 | sc, &fops_xmit); | ||
613 | if (!sc->debug.debugfs_xmit) | ||
614 | goto err; | ||
615 | |||
532 | return 0; | 616 | return 0; |
533 | err: | 617 | err: |
534 | ath9k_exit_debug(sc); | 618 | ath9k_exit_debug(sc); |
@@ -537,6 +621,7 @@ err: | |||
537 | 621 | ||
538 | void ath9k_exit_debug(struct ath_softc *sc) | 622 | void ath9k_exit_debug(struct ath_softc *sc) |
539 | { | 623 | { |
624 | debugfs_remove(sc->debug.debugfs_xmit); | ||
540 | debugfs_remove(sc->debug.debugfs_wiphy); | 625 | debugfs_remove(sc->debug.debugfs_wiphy); |
541 | debugfs_remove(sc->debug.debugfs_rcstat); | 626 | debugfs_remove(sc->debug.debugfs_rcstat); |
542 | debugfs_remove(sc->debug.debugfs_interrupt); | 627 | debugfs_remove(sc->debug.debugfs_interrupt); |