aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath5k/debug.c
diff options
context:
space:
mode:
authorBruno Randolf <br1@einfach.org>2010-06-07 00:11:40 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-06-08 09:31:21 -0400
commit3cfd43f484c8d4bcb38db83f7be19fbd4ac8440c (patch)
tree55c9fdabb0c0e9b02c3b634859e338d8c3023370 /drivers/net/wireless/ath/ath5k/debug.c
parent20fbed21e934355ee00850f6dead22be3147893f (diff)
ath5k: add debugfs file for queue debugging
Signed-off-by: Bruno Randolf <br1@einfach.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath5k/debug.c')
-rw-r--r--drivers/net/wireless/ath/ath5k/debug.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c
index 41817a294945..0f2e37d85cbd 100644
--- a/drivers/net/wireless/ath/ath5k/debug.c
+++ b/drivers/net/wireless/ath/ath5k/debug.c
@@ -735,6 +735,66 @@ static const struct file_operations fops_ani = {
735}; 735};
736 736
737 737
738/* debugfs: queues etc */
739
740static ssize_t read_file_queue(struct file *file, char __user *user_buf,
741 size_t count, loff_t *ppos)
742{
743 struct ath5k_softc *sc = file->private_data;
744 char buf[700];
745 unsigned int len = 0;
746
747 struct ath5k_txq *txq;
748 struct ath5k_buf *bf, *bf0;
749 int i, n = 0;
750
751 len += snprintf(buf+len, sizeof(buf)-len,
752 "available txbuffers: %d\n", sc->txbuf_len);
753
754 for (i = 0; i < ARRAY_SIZE(sc->txqs); i++) {
755 txq = &sc->txqs[i];
756
757 len += snprintf(buf+len, sizeof(buf)-len,
758 "%02d: %ssetup\n", i, txq->setup ? "" : "not ");
759
760 if (!txq->setup)
761 continue;
762
763 list_for_each_entry_safe(bf, bf0, &txq->q, list)
764 n++;
765 len += snprintf(buf+len, sizeof(buf)-len, " len: %d\n", n);
766 }
767
768 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
769}
770
771static ssize_t write_file_queue(struct file *file,
772 const char __user *userbuf,
773 size_t count, loff_t *ppos)
774{
775 struct ath5k_softc *sc = file->private_data;
776 char buf[20];
777
778 if (copy_from_user(buf, userbuf, min(count, sizeof(buf))))
779 return -EFAULT;
780
781 if (strncmp(buf, "start", 5) == 0)
782 ieee80211_wake_queues(sc->hw);
783 else if (strncmp(buf, "stop", 4) == 0)
784 ieee80211_stop_queues(sc->hw);
785
786 return count;
787}
788
789
790static const struct file_operations fops_queue = {
791 .read = read_file_queue,
792 .write = write_file_queue,
793 .open = ath5k_debugfs_open,
794 .owner = THIS_MODULE,
795};
796
797
738/* init */ 798/* init */
739 799
740void 800void
@@ -778,6 +838,11 @@ ath5k_debug_init_device(struct ath5k_softc *sc)
778 S_IWUSR | S_IRUSR, 838 S_IWUSR | S_IRUSR,
779 sc->debug.debugfs_phydir, sc, 839 sc->debug.debugfs_phydir, sc,
780 &fops_ani); 840 &fops_ani);
841
842 sc->debug.debugfs_queue = debugfs_create_file("queue",
843 S_IWUSR | S_IRUSR,
844 sc->debug.debugfs_phydir, sc,
845 &fops_queue);
781} 846}
782 847
783void 848void
@@ -796,6 +861,7 @@ ath5k_debug_finish_device(struct ath5k_softc *sc)
796 debugfs_remove(sc->debug.debugfs_antenna); 861 debugfs_remove(sc->debug.debugfs_antenna);
797 debugfs_remove(sc->debug.debugfs_frameerrors); 862 debugfs_remove(sc->debug.debugfs_frameerrors);
798 debugfs_remove(sc->debug.debugfs_ani); 863 debugfs_remove(sc->debug.debugfs_ani);
864 debugfs_remove(sc->debug.debugfs_queue);
799 debugfs_remove(sc->debug.debugfs_phydir); 865 debugfs_remove(sc->debug.debugfs_phydir);
800} 866}
801 867