diff options
author | Sujith Manoharan <c_manoha@qca.qualcomm.com> | 2012-11-21 07:43:11 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-11-21 14:16:03 -0500 |
commit | 78ef731ce549dd9baf6eba8cf52f61727613690a (patch) | |
tree | 7ea204e511e1fc1d95f6036b4a7374fbc5ae41ed /drivers/net/wireless/ath/ath9k/debug.c | |
parent | bea843c73854becf998047a83af22a90de3fd19b (diff) |
ath9k: Fix the 'xmit' debugfs file
The 'xmit' debugfs file has become big and unwieldy, fix
multiple issues with its usage:
* Store TX counters/statistics only for the 4 Access Categories.
Use IEEE80211_NUM_ACS instead of ATH9K_NUM_TX_QUEUES.
* Move various utility macros to debug.h, they can be reused
elsewhere.
* Remove tx_complete_poll_work_seen.
* Remove code that accesses various internal queue-specific
variables without any locking whatsoever. HW/SW queue details
will be handled in a subsequent patch.
* Do not print internal values like txq_headidx and txq_headidx.
They were mostly unused anyway, considering code like:
PRX("txq_tailidx: ", txq_headidx);
* Handle 'txprocdesc' for EDMA too.
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/debug.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/debug.c | 104 |
1 files changed, 5 insertions, 99 deletions
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index 957e38646fdc..f9df82bdd213 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -512,62 +512,19 @@ static const struct file_operations fops_interrupt = { | |||
512 | .llseek = default_llseek, | 512 | .llseek = default_llseek, |
513 | }; | 513 | }; |
514 | 514 | ||
515 | #define PR_QNUM(_n) sc->tx.txq_map[_n]->axq_qnum | ||
516 | #define PR(str, elem) \ | ||
517 | do { \ | ||
518 | len += snprintf(buf + len, size - len, \ | ||
519 | "%s%13u%11u%10u%10u\n", str, \ | ||
520 | sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].elem, \ | ||
521 | sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BK)].elem, \ | ||
522 | sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VI)].elem, \ | ||
523 | sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VO)].elem); \ | ||
524 | if (len >= size) \ | ||
525 | goto done; \ | ||
526 | } while(0) | ||
527 | |||
528 | #define PRX(str, elem) \ | ||
529 | do { \ | ||
530 | len += snprintf(buf + len, size - len, \ | ||
531 | "%s%13u%11u%10u%10u\n", str, \ | ||
532 | (unsigned int)(sc->tx.txq_map[IEEE80211_AC_BE]->elem), \ | ||
533 | (unsigned int)(sc->tx.txq_map[IEEE80211_AC_BK]->elem), \ | ||
534 | (unsigned int)(sc->tx.txq_map[IEEE80211_AC_VI]->elem), \ | ||
535 | (unsigned int)(sc->tx.txq_map[IEEE80211_AC_VO]->elem)); \ | ||
536 | if (len >= size) \ | ||
537 | goto done; \ | ||
538 | } while(0) | ||
539 | |||
540 | #define PRQLE(str, elem) \ | ||
541 | do { \ | ||
542 | len += snprintf(buf + len, size - len, \ | ||
543 | "%s%13i%11i%10i%10i\n", str, \ | ||
544 | list_empty(&sc->tx.txq_map[IEEE80211_AC_BE]->elem), \ | ||
545 | list_empty(&sc->tx.txq_map[IEEE80211_AC_BK]->elem), \ | ||
546 | list_empty(&sc->tx.txq_map[IEEE80211_AC_VI]->elem), \ | ||
547 | list_empty(&sc->tx.txq_map[IEEE80211_AC_VO]->elem)); \ | ||
548 | if (len >= size) \ | ||
549 | goto done; \ | ||
550 | } while (0) | ||
551 | |||
552 | static ssize_t read_file_xmit(struct file *file, char __user *user_buf, | 515 | static ssize_t read_file_xmit(struct file *file, char __user *user_buf, |
553 | size_t count, loff_t *ppos) | 516 | size_t count, loff_t *ppos) |
554 | { | 517 | { |
555 | struct ath_softc *sc = file->private_data; | 518 | struct ath_softc *sc = file->private_data; |
556 | char *buf; | 519 | char *buf; |
557 | unsigned int len = 0, size = 8000; | 520 | unsigned int len = 0, size = 2048; |
558 | int i; | ||
559 | ssize_t retval = 0; | 521 | ssize_t retval = 0; |
560 | char tmp[32]; | ||
561 | 522 | ||
562 | buf = kzalloc(size, GFP_KERNEL); | 523 | buf = kzalloc(size, GFP_KERNEL); |
563 | if (buf == NULL) | 524 | if (buf == NULL) |
564 | return -ENOMEM; | 525 | return -ENOMEM; |
565 | 526 | ||
566 | len += sprintf(buf, "Num-Tx-Queues: %i tx-queues-setup: 0x%x" | 527 | len += sprintf(buf, "%30s %10s%10s%10s\n\n", |
567 | " poll-work-seen: %u\n" | ||
568 | "%30s %10s%10s%10s\n\n", | ||
569 | ATH9K_NUM_TX_QUEUES, sc->tx.txqsetup, | ||
570 | sc->tx_complete_poll_work_seen, | ||
571 | "BE", "BK", "VI", "VO"); | 528 | "BE", "BK", "VI", "VO"); |
572 | 529 | ||
573 | PR("MPDUs Queued: ", queued); | 530 | PR("MPDUs Queued: ", queued); |
@@ -587,62 +544,11 @@ static ssize_t read_file_xmit(struct file *file, char __user *user_buf, | |||
587 | PR("DELIM Underrun: ", delim_underrun); | 544 | PR("DELIM Underrun: ", delim_underrun); |
588 | PR("TX-Pkts-All: ", tx_pkts_all); | 545 | PR("TX-Pkts-All: ", tx_pkts_all); |
589 | PR("TX-Bytes-All: ", tx_bytes_all); | 546 | PR("TX-Bytes-All: ", tx_bytes_all); |
590 | PR("hw-put-tx-buf: ", puttxbuf); | 547 | PR("HW-put-tx-buf: ", puttxbuf); |
591 | PR("hw-tx-start: ", txstart); | 548 | PR("HW-tx-start: ", txstart); |
592 | PR("hw-tx-proc-desc: ", txprocdesc); | 549 | PR("HW-tx-proc-desc: ", txprocdesc); |
593 | PR("TX-Failed: ", txfailed); | 550 | PR("TX-Failed: ", txfailed); |
594 | len += snprintf(buf + len, size - len, | ||
595 | "%s%11p%11p%10p%10p\n", "txq-memory-address:", | ||
596 | sc->tx.txq_map[IEEE80211_AC_BE], | ||
597 | sc->tx.txq_map[IEEE80211_AC_BK], | ||
598 | sc->tx.txq_map[IEEE80211_AC_VI], | ||
599 | sc->tx.txq_map[IEEE80211_AC_VO]); | ||
600 | if (len >= size) | ||
601 | goto done; | ||
602 | |||
603 | PRX("axq-qnum: ", axq_qnum); | ||
604 | PRX("axq-depth: ", axq_depth); | ||
605 | PRX("axq-ampdu_depth: ", axq_ampdu_depth); | ||
606 | PRX("axq-stopped ", stopped); | ||
607 | PRX("tx-in-progress ", axq_tx_inprogress); | ||
608 | PRX("pending-frames ", pending_frames); | ||
609 | PRX("txq_headidx: ", txq_headidx); | ||
610 | PRX("txq_tailidx: ", txq_headidx); | ||
611 | |||
612 | PRQLE("axq_q empty: ", axq_q); | ||
613 | PRQLE("axq_acq empty: ", axq_acq); | ||
614 | for (i = 0; i < ATH_TXFIFO_DEPTH; i++) { | ||
615 | snprintf(tmp, sizeof(tmp) - 1, "txq_fifo[%i] empty: ", i); | ||
616 | PRQLE(tmp, txq_fifo[i]); | ||
617 | } | ||
618 | |||
619 | /* Print out more detailed queue-info */ | ||
620 | for (i = 0; i <= IEEE80211_AC_BK; i++) { | ||
621 | struct ath_txq *txq = &(sc->tx.txq[i]); | ||
622 | struct ath_atx_ac *ac; | ||
623 | struct ath_atx_tid *tid; | ||
624 | if (len >= size) | ||
625 | goto done; | ||
626 | spin_lock_bh(&txq->axq_lock); | ||
627 | if (!list_empty(&txq->axq_acq)) { | ||
628 | ac = list_first_entry(&txq->axq_acq, struct ath_atx_ac, | ||
629 | list); | ||
630 | len += snprintf(buf + len, size - len, | ||
631 | "txq[%i] first-ac: %p sched: %i\n", | ||
632 | i, ac, ac->sched); | ||
633 | if (list_empty(&ac->tid_q) || (len >= size)) | ||
634 | goto done_for; | ||
635 | tid = list_first_entry(&ac->tid_q, struct ath_atx_tid, | ||
636 | list); | ||
637 | len += snprintf(buf + len, size - len, | ||
638 | " first-tid: %p sched: %i paused: %i\n", | ||
639 | tid, tid->sched, tid->paused); | ||
640 | } | ||
641 | done_for: | ||
642 | spin_unlock_bh(&txq->axq_lock); | ||
643 | } | ||
644 | 551 | ||
645 | done: | ||
646 | if (len > size) | 552 | if (len > size) |
647 | len = size; | 553 | len = size; |
648 | 554 | ||