]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
ath5k: add debugfs file for queue debugging
authorBruno Randolf <br1@einfach.org>
Mon, 7 Jun 2010 04:11:40 +0000 (13:11 +0900)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 8 Jun 2010 13:31:21 +0000 (09:31 -0400)
Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath5k/debug.c
drivers/net/wireless/ath/ath5k/debug.h

index 41817a2949457701826e3c84158b7c6c140cbc43..0f2e37d85cbd6704a886df9c2eb97f0718d4d963 100644 (file)
@@ -735,6 +735,66 @@ static const struct file_operations fops_ani = {
 };
 
 
+/* debugfs: queues etc */
+
+static ssize_t read_file_queue(struct file *file, char __user *user_buf,
+                                  size_t count, loff_t *ppos)
+{
+       struct ath5k_softc *sc = file->private_data;
+       char buf[700];
+       unsigned int len = 0;
+
+       struct ath5k_txq *txq;
+       struct ath5k_buf *bf, *bf0;
+       int i, n = 0;
+
+       len += snprintf(buf+len, sizeof(buf)-len,
+                       "available txbuffers: %d\n", sc->txbuf_len);
+
+       for (i = 0; i < ARRAY_SIZE(sc->txqs); i++) {
+               txq = &sc->txqs[i];
+
+               len += snprintf(buf+len, sizeof(buf)-len,
+                       "%02d: %ssetup\n", i, txq->setup ? "" : "not ");
+
+               if (!txq->setup)
+                       continue;
+
+               list_for_each_entry_safe(bf, bf0, &txq->q, list)
+                       n++;
+               len += snprintf(buf+len, sizeof(buf)-len, "  len: %d\n", n);
+       }
+
+       return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+}
+
+static ssize_t write_file_queue(struct file *file,
+                                const char __user *userbuf,
+                                size_t count, loff_t *ppos)
+{
+       struct ath5k_softc *sc = file->private_data;
+       char buf[20];
+
+       if (copy_from_user(buf, userbuf, min(count, sizeof(buf))))
+               return -EFAULT;
+
+       if (strncmp(buf, "start", 5) == 0)
+               ieee80211_wake_queues(sc->hw);
+       else if (strncmp(buf, "stop", 4) == 0)
+               ieee80211_stop_queues(sc->hw);
+
+       return count;
+}
+
+
+static const struct file_operations fops_queue = {
+       .read = read_file_queue,
+       .write = write_file_queue,
+       .open = ath5k_debugfs_open,
+       .owner = THIS_MODULE,
+};
+
+
 /* init */
 
 void
@@ -778,6 +838,11 @@ ath5k_debug_init_device(struct ath5k_softc *sc)
                                S_IWUSR | S_IRUSR,
                                sc->debug.debugfs_phydir, sc,
                                &fops_ani);
+
+       sc->debug.debugfs_queue = debugfs_create_file("queue",
+                               S_IWUSR | S_IRUSR,
+                               sc->debug.debugfs_phydir, sc,
+                               &fops_queue);
 }
 
 void
@@ -796,6 +861,7 @@ ath5k_debug_finish_device(struct ath5k_softc *sc)
        debugfs_remove(sc->debug.debugfs_antenna);
        debugfs_remove(sc->debug.debugfs_frameerrors);
        debugfs_remove(sc->debug.debugfs_ani);
+       debugfs_remove(sc->debug.debugfs_queue);
        debugfs_remove(sc->debug.debugfs_phydir);
 }
 
index bd165872914162dffabd9cd24864f3fc10e8503b..606ae94a9157806b736f3c9d890c36a2f1edb762 100644 (file)
@@ -77,6 +77,7 @@ struct ath5k_dbg_info {
        struct dentry           *debugfs_antenna;
        struct dentry           *debugfs_frameerrors;
        struct dentry           *debugfs_ani;
+       struct dentry           *debugfs_queue;
 };
 
 /**