aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/debug.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.c83
1 files changed, 29 insertions, 54 deletions
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index 43e71a944cb1..3586c43077a7 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -24,8 +24,6 @@
24#define REG_READ_D(_ah, _reg) \ 24#define REG_READ_D(_ah, _reg) \
25 ath9k_hw_common(_ah)->ops->read((_ah), (_reg)) 25 ath9k_hw_common(_ah)->ops->read((_ah), (_reg))
26 26
27static struct dentry *ath9k_debugfs_root;
28
29static int ath9k_debugfs_open(struct inode *inode, struct file *file) 27static int ath9k_debugfs_open(struct inode *inode, struct file *file)
30{ 28{
31 file->private_data = inode->i_private; 29 file->private_data = inode->i_private;
@@ -461,16 +459,16 @@ static ssize_t read_file_wiphy(struct file *file, char __user *user_buf,
461 459
462 /* Put variable-length stuff down here, and check for overflows. */ 460 /* Put variable-length stuff down here, and check for overflows. */
463 for (i = 0; i < sc->num_sec_wiphy; i++) { 461 for (i = 0; i < sc->num_sec_wiphy; i++) {
464 struct ath_wiphy *aphy = sc->sec_wiphy[i]; 462 struct ath_wiphy *aphy_tmp = sc->sec_wiphy[i];
465 if (aphy == NULL) 463 if (aphy_tmp == NULL)
466 continue; 464 continue;
467 chan = aphy->hw->conf.channel; 465 chan = aphy_tmp->hw->conf.channel;
468 len += snprintf(buf + len, sizeof(buf) - len, 466 len += snprintf(buf + len, sizeof(buf) - len,
469 "secondary: %s (%s chan=%d ht=%d)\n", 467 "secondary: %s (%s chan=%d ht=%d)\n",
470 wiphy_name(aphy->hw->wiphy), 468 wiphy_name(aphy_tmp->hw->wiphy),
471 ath_wiphy_state_str(aphy->state), 469 ath_wiphy_state_str(aphy_tmp->state),
472 ieee80211_frequency_to_channel(chan->center_freq), 470 ieee80211_frequency_to_channel(chan->center_freq),
473 aphy->chan_is_ht); 471 aphy_tmp->chan_is_ht);
474 } 472 }
475 if (len > sizeof(buf)) 473 if (len > sizeof(buf))
476 len = sizeof(buf); 474 len = sizeof(buf);
@@ -585,10 +583,10 @@ static const struct file_operations fops_wiphy = {
585 do { \ 583 do { \
586 len += snprintf(buf + len, size - len, \ 584 len += snprintf(buf + len, size - len, \
587 "%s%13u%11u%10u%10u\n", str, \ 585 "%s%13u%11u%10u%10u\n", str, \
588 sc->debug.stats.txstats[sc->tx.hwq_map[WME_AC_BE]].elem, \ 586 sc->debug.stats.txstats[WME_AC_BE].elem, \
589 sc->debug.stats.txstats[sc->tx.hwq_map[WME_AC_BK]].elem, \ 587 sc->debug.stats.txstats[WME_AC_BK].elem, \
590 sc->debug.stats.txstats[sc->tx.hwq_map[WME_AC_VI]].elem, \ 588 sc->debug.stats.txstats[WME_AC_VI].elem, \
591 sc->debug.stats.txstats[sc->tx.hwq_map[WME_AC_VO]].elem); \ 589 sc->debug.stats.txstats[WME_AC_VO].elem); \
592} while(0) 590} while(0)
593 591
594static ssize_t read_file_xmit(struct file *file, char __user *user_buf, 592static ssize_t read_file_xmit(struct file *file, char __user *user_buf,
@@ -630,33 +628,35 @@ static ssize_t read_file_xmit(struct file *file, char __user *user_buf,
630 return retval; 628 return retval;
631} 629}
632 630
633void ath_debug_stat_tx(struct ath_softc *sc, struct ath_txq *txq, 631void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
634 struct ath_buf *bf, struct ath_tx_status *ts) 632 struct ath_tx_status *ts)
635{ 633{
636 TX_STAT_INC(txq->axq_qnum, tx_pkts_all); 634 int qnum = skb_get_queue_mapping(bf->bf_mpdu);
637 sc->debug.stats.txstats[txq->axq_qnum].tx_bytes_all += bf->bf_mpdu->len; 635
636 TX_STAT_INC(qnum, tx_pkts_all);
637 sc->debug.stats.txstats[qnum].tx_bytes_all += bf->bf_mpdu->len;
638 638
639 if (bf_isampdu(bf)) { 639 if (bf_isampdu(bf)) {
640 if (bf_isxretried(bf)) 640 if (bf_isxretried(bf))
641 TX_STAT_INC(txq->axq_qnum, a_xretries); 641 TX_STAT_INC(qnum, a_xretries);
642 else 642 else
643 TX_STAT_INC(txq->axq_qnum, a_completed); 643 TX_STAT_INC(qnum, a_completed);
644 } else { 644 } else {
645 TX_STAT_INC(txq->axq_qnum, completed); 645 TX_STAT_INC(qnum, completed);
646 } 646 }
647 647
648 if (ts->ts_status & ATH9K_TXERR_FIFO) 648 if (ts->ts_status & ATH9K_TXERR_FIFO)
649 TX_STAT_INC(txq->axq_qnum, fifo_underrun); 649 TX_STAT_INC(qnum, fifo_underrun);
650 if (ts->ts_status & ATH9K_TXERR_XTXOP) 650 if (ts->ts_status & ATH9K_TXERR_XTXOP)
651 TX_STAT_INC(txq->axq_qnum, xtxop); 651 TX_STAT_INC(qnum, xtxop);
652 if (ts->ts_status & ATH9K_TXERR_TIMER_EXPIRED) 652 if (ts->ts_status & ATH9K_TXERR_TIMER_EXPIRED)
653 TX_STAT_INC(txq->axq_qnum, timer_exp); 653 TX_STAT_INC(qnum, timer_exp);
654 if (ts->ts_flags & ATH9K_TX_DESC_CFG_ERR) 654 if (ts->ts_flags & ATH9K_TX_DESC_CFG_ERR)
655 TX_STAT_INC(txq->axq_qnum, desc_cfg_err); 655 TX_STAT_INC(qnum, desc_cfg_err);
656 if (ts->ts_flags & ATH9K_TX_DATA_UNDERRUN) 656 if (ts->ts_flags & ATH9K_TX_DATA_UNDERRUN)
657 TX_STAT_INC(txq->axq_qnum, data_underrun); 657 TX_STAT_INC(qnum, data_underrun);
658 if (ts->ts_flags & ATH9K_TX_DELIM_UNDERRUN) 658 if (ts->ts_flags & ATH9K_TX_DELIM_UNDERRUN)
659 TX_STAT_INC(txq->axq_qnum, delim_underrun); 659 TX_STAT_INC(qnum, delim_underrun);
660} 660}
661 661
662static const struct file_operations fops_xmit = { 662static const struct file_operations fops_xmit = {
@@ -876,11 +876,8 @@ int ath9k_init_debug(struct ath_hw *ah)
876 struct ath_common *common = ath9k_hw_common(ah); 876 struct ath_common *common = ath9k_hw_common(ah);
877 struct ath_softc *sc = (struct ath_softc *) common->priv; 877 struct ath_softc *sc = (struct ath_softc *) common->priv;
878 878
879 if (!ath9k_debugfs_root) 879 sc->debug.debugfs_phy = debugfs_create_dir("ath9k",
880 return -ENOENT; 880 sc->hw->wiphy->debugfsdir);
881
882 sc->debug.debugfs_phy = debugfs_create_dir(wiphy_name(sc->hw->wiphy),
883 ath9k_debugfs_root);
884 if (!sc->debug.debugfs_phy) 881 if (!sc->debug.debugfs_phy)
885 return -ENOMEM; 882 return -ENOMEM;
886 883
@@ -933,29 +930,7 @@ int ath9k_init_debug(struct ath_hw *ah)
933 sc->debug.regidx = 0; 930 sc->debug.regidx = 0;
934 return 0; 931 return 0;
935err: 932err:
936 ath9k_exit_debug(ah);
937 return -ENOMEM;
938}
939
940void ath9k_exit_debug(struct ath_hw *ah)
941{
942 struct ath_common *common = ath9k_hw_common(ah);
943 struct ath_softc *sc = (struct ath_softc *) common->priv;
944
945 debugfs_remove_recursive(sc->debug.debugfs_phy); 933 debugfs_remove_recursive(sc->debug.debugfs_phy);
946} 934 sc->debug.debugfs_phy = NULL;
947 935 return -ENOMEM;
948int ath9k_debug_create_root(void)
949{
950 ath9k_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL);
951 if (!ath9k_debugfs_root)
952 return -ENOENT;
953
954 return 0;
955}
956
957void ath9k_debug_remove_root(void)
958{
959 debugfs_remove(ath9k_debugfs_root);
960 ath9k_debugfs_root = NULL;
961} 936}