aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/debug.c
diff options
context:
space:
mode:
authorBen Greear <greearb@candelatech.com>2011-01-17 14:54:50 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-01-21 15:34:18 -0500
commit55f6d0fff64dfee57812e821f846b068a8c2df01 (patch)
tree648e16bd630f0927d81e2d0d3b2ba3a2b9ade2a2 /drivers/net/wireless/ath/ath9k/debug.c
parent59eb21a6504731fc16db4cf9463065dd61093e08 (diff)
ath9k: Add 'misc' file to debugfs, fix queue indexes.
Add a misc file to show hardware op-mode, irq setup, number of various types of VIFs and more. Also, previous patches were using the wrong xmit queue indexes. Change to use the internal ath9k indexes instead of the mac80211 queue indexes. Signed-off-by: Ben Greear <greearb@candelatech.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.c137
1 files changed, 125 insertions, 12 deletions
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index b0cb792d38ca..f0c80ec290d1 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -595,10 +595,10 @@ static const struct file_operations fops_wiphy = {
595do { \ 595do { \
596 len += snprintf(buf + len, size - len, \ 596 len += snprintf(buf + len, size - len, \
597 "%s%13u%11u%10u%10u\n", str, \ 597 "%s%13u%11u%10u%10u\n", str, \
598 (unsigned int)(sc->tx.txq[WME_AC_BE].elem), \ 598 (unsigned int)(sc->tx.txq[ATH_TXQ_AC_BE].elem), \
599 (unsigned int)(sc->tx.txq[WME_AC_BK].elem), \ 599 (unsigned int)(sc->tx.txq[ATH_TXQ_AC_BK].elem), \
600 (unsigned int)(sc->tx.txq[WME_AC_VI].elem), \ 600 (unsigned int)(sc->tx.txq[ATH_TXQ_AC_VI].elem), \
601 (unsigned int)(sc->tx.txq[WME_AC_VO].elem)); \ 601 (unsigned int)(sc->tx.txq[ATH_TXQ_AC_VO].elem)); \
602 if (len >= size) \ 602 if (len >= size) \
603 goto done; \ 603 goto done; \
604} while(0) 604} while(0)
@@ -607,10 +607,10 @@ do { \
607do { \ 607do { \
608 len += snprintf(buf + len, size - len, \ 608 len += snprintf(buf + len, size - len, \
609 "%s%13i%11i%10i%10i\n", str, \ 609 "%s%13i%11i%10i%10i\n", str, \
610 list_empty(&sc->tx.txq[WME_AC_BE].elem), \ 610 list_empty(&sc->tx.txq[ATH_TXQ_AC_BE].elem), \
611 list_empty(&sc->tx.txq[WME_AC_BK].elem), \ 611 list_empty(&sc->tx.txq[ATH_TXQ_AC_BK].elem), \
612 list_empty(&sc->tx.txq[WME_AC_VI].elem), \ 612 list_empty(&sc->tx.txq[ATH_TXQ_AC_VI].elem), \
613 list_empty(&sc->tx.txq[WME_AC_VO].elem)); \ 613 list_empty(&sc->tx.txq[ATH_TXQ_AC_VO].elem)); \
614 if (len >= size) \ 614 if (len >= size) \
615 goto done; \ 615 goto done; \
616} while (0) 616} while (0)
@@ -657,10 +657,10 @@ static ssize_t read_file_xmit(struct file *file, char __user *user_buf,
657 PR("hw-tx-proc-desc: ", txprocdesc); 657 PR("hw-tx-proc-desc: ", txprocdesc);
658 len += snprintf(buf + len, size - len, 658 len += snprintf(buf + len, size - len,
659 "%s%11p%11p%10p%10p\n", "txq-memory-address:", 659 "%s%11p%11p%10p%10p\n", "txq-memory-address:",
660 &(sc->tx.txq[WME_AC_BE]), 660 &(sc->tx.txq[ATH_TXQ_AC_BE]),
661 &(sc->tx.txq[WME_AC_BK]), 661 &(sc->tx.txq[ATH_TXQ_AC_BK]),
662 &(sc->tx.txq[WME_AC_VI]), 662 &(sc->tx.txq[ATH_TXQ_AC_VI]),
663 &(sc->tx.txq[WME_AC_VO])); 663 &(sc->tx.txq[ATH_TXQ_AC_VO]));
664 if (len >= size) 664 if (len >= size)
665 goto done; 665 goto done;
666 666
@@ -777,6 +777,108 @@ done:
777 return retval; 777 return retval;
778} 778}
779 779
780static ssize_t read_file_misc(struct file *file, char __user *user_buf,
781 size_t count, loff_t *ppos)
782{
783 struct ath_softc *sc = file->private_data;
784 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
785 struct ath_hw *ah = sc->sc_ah;
786 struct ieee80211_hw *hw = sc->hw;
787 char *buf;
788 unsigned int len = 0, size = 8000;
789 ssize_t retval = 0;
790 const char *tmp;
791 unsigned int reg;
792 struct ath9k_vif_iter_data iter_data;
793
794 ath9k_calculate_iter_data(hw, NULL, &iter_data);
795
796 buf = kzalloc(size, GFP_KERNEL);
797 if (buf == NULL)
798 return -ENOMEM;
799
800 switch (sc->sc_ah->opmode) {
801 case NL80211_IFTYPE_ADHOC:
802 tmp = "ADHOC";
803 break;
804 case NL80211_IFTYPE_MESH_POINT:
805 tmp = "MESH";
806 break;
807 case NL80211_IFTYPE_AP:
808 tmp = "AP";
809 break;
810 case NL80211_IFTYPE_STATION:
811 tmp = "STATION";
812 break;
813 default:
814 tmp = "???";
815 break;
816 }
817
818 len += snprintf(buf + len, size - len,
819 "curbssid: %pM\n"
820 "OP-Mode: %s(%i)\n"
821 "Beacon-Timer-Register: 0x%x\n",
822 common->curbssid,
823 tmp, (int)(sc->sc_ah->opmode),
824 REG_READ(ah, AR_BEACON_PERIOD));
825
826 reg = REG_READ(ah, AR_TIMER_MODE);
827 len += snprintf(buf + len, size - len, "Timer-Mode-Register: 0x%x (",
828 reg);
829 if (reg & AR_TBTT_TIMER_EN)
830 len += snprintf(buf + len, size - len, "TBTT ");
831 if (reg & AR_DBA_TIMER_EN)
832 len += snprintf(buf + len, size - len, "DBA ");
833 if (reg & AR_SWBA_TIMER_EN)
834 len += snprintf(buf + len, size - len, "SWBA ");
835 if (reg & AR_HCF_TIMER_EN)
836 len += snprintf(buf + len, size - len, "HCF ");
837 if (reg & AR_TIM_TIMER_EN)
838 len += snprintf(buf + len, size - len, "TIM ");
839 if (reg & AR_DTIM_TIMER_EN)
840 len += snprintf(buf + len, size - len, "DTIM ");
841 len += snprintf(buf + len, size - len, ")\n");
842
843 reg = sc->sc_ah->imask;
844 len += snprintf(buf + len, size - len, "imask: 0x%x (", reg);
845 if (reg & ATH9K_INT_SWBA)
846 len += snprintf(buf + len, size - len, "SWBA ");
847 if (reg & ATH9K_INT_BMISS)
848 len += snprintf(buf + len, size - len, "BMISS ");
849 if (reg & ATH9K_INT_CST)
850 len += snprintf(buf + len, size - len, "CST ");
851 if (reg & ATH9K_INT_RX)
852 len += snprintf(buf + len, size - len, "RX ");
853 if (reg & ATH9K_INT_RXHP)
854 len += snprintf(buf + len, size - len, "RXHP ");
855 if (reg & ATH9K_INT_RXLP)
856 len += snprintf(buf + len, size - len, "RXLP ");
857 if (reg & ATH9K_INT_BB_WATCHDOG)
858 len += snprintf(buf + len, size - len, "BB_WATCHDOG ");
859 /* there are other IRQs if one wanted to add them. */
860 len += snprintf(buf + len, size - len, ")\n");
861
862 len += snprintf(buf + len, size - len,
863 "VIF Counts: AP: %i STA: %i MESH: %i WDS: %i"
864 " ADHOC: %i OTHER: %i nvifs: %hi beacon-vifs: %hi\n",
865 iter_data.naps, iter_data.nstations, iter_data.nmeshes,
866 iter_data.nwds, iter_data.nadhocs, iter_data.nothers,
867 sc->nvifs, sc->nbcnvifs);
868
869 len += snprintf(buf + len, size - len,
870 "Calculated-BSSID-Mask: %pM\n",
871 iter_data.mask);
872
873 if (len > size)
874 len = size;
875
876 retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
877 kfree(buf);
878
879 return retval;
880}
881
780void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf, 882void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
781 struct ath_tx_status *ts) 883 struct ath_tx_status *ts)
782{ 884{
@@ -822,6 +924,13 @@ static const struct file_operations fops_stations = {
822 .llseek = default_llseek, 924 .llseek = default_llseek,
823}; 925};
824 926
927static const struct file_operations fops_misc = {
928 .read = read_file_misc,
929 .open = ath9k_debugfs_open,
930 .owner = THIS_MODULE,
931 .llseek = default_llseek,
932};
933
825static ssize_t read_file_recv(struct file *file, char __user *user_buf, 934static ssize_t read_file_recv(struct file *file, char __user *user_buf,
826 size_t count, loff_t *ppos) 935 size_t count, loff_t *ppos)
827{ 936{
@@ -1063,6 +1172,10 @@ int ath9k_init_debug(struct ath_hw *ah)
1063 sc, &fops_stations)) 1172 sc, &fops_stations))
1064 goto err; 1173 goto err;
1065 1174
1175 if (!debugfs_create_file("misc", S_IRUSR, sc->debug.debugfs_phy,
1176 sc, &fops_misc))
1177 goto err;
1178
1066 if (!debugfs_create_file("recv", S_IRUSR, sc->debug.debugfs_phy, 1179 if (!debugfs_create_file("recv", S_IRUSR, sc->debug.debugfs_phy,
1067 sc, &fops_recv)) 1180 sc, &fops_recv))
1068 goto err; 1181 goto err;