ath5k: Add bssid mask and rxfilter to debugfs.
authorBen Greear <greearb@candelatech.com>
Wed, 22 Sep 2010 00:03:57 +0000 (17:03 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 27 Sep 2010 19:57:36 +0000 (15:57 -0400)
Helps with debugging virtual interfaces.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath5k/debug.c
drivers/net/wireless/ath/ath5k/debug.h

index 6583a82a0783255496ec72e17ea220153fafa296..0f06e849031400405673c37b07835e95165a3af2 100644 (file)
@@ -483,6 +483,59 @@ static const struct file_operations fops_antenna = {
        .owner = THIS_MODULE,
 };
 
+/* debugfs: misc */
+
+static ssize_t read_file_misc(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;
+       u32 filt = ath5k_hw_get_rx_filter(sc->ah);
+
+       len += snprintf(buf+len, sizeof(buf)-len, "bssid-mask: %pM\n",
+                       sc->bssidmask);
+       len += snprintf(buf+len, sizeof(buf)-len, "filter-flags: 0x%x ",
+                       filt);
+       if (filt & AR5K_RX_FILTER_UCAST)
+               len += snprintf(buf+len, sizeof(buf)-len, " UCAST");
+       if (filt & AR5K_RX_FILTER_MCAST)
+               len += snprintf(buf+len, sizeof(buf)-len, " MCAST");
+       if (filt & AR5K_RX_FILTER_BCAST)
+               len += snprintf(buf+len, sizeof(buf)-len, " BCAST");
+       if (filt & AR5K_RX_FILTER_CONTROL)
+               len += snprintf(buf+len, sizeof(buf)-len, " CONTROL");
+       if (filt & AR5K_RX_FILTER_BEACON)
+               len += snprintf(buf+len, sizeof(buf)-len, " BEACON");
+       if (filt & AR5K_RX_FILTER_PROM)
+               len += snprintf(buf+len, sizeof(buf)-len, " PROM");
+       if (filt & AR5K_RX_FILTER_XRPOLL)
+               len += snprintf(buf+len, sizeof(buf)-len, " XRPOLL");
+       if (filt & AR5K_RX_FILTER_PROBEREQ)
+               len += snprintf(buf+len, sizeof(buf)-len, " PROBEREQ");
+       if (filt & AR5K_RX_FILTER_PHYERR_5212)
+               len += snprintf(buf+len, sizeof(buf)-len, " PHYERR-5212");
+       if (filt & AR5K_RX_FILTER_RADARERR_5212)
+               len += snprintf(buf+len, sizeof(buf)-len, " RADARERR-5212");
+       if (filt & AR5K_RX_FILTER_PHYERR_5211)
+               snprintf(buf+len, sizeof(buf)-len, " PHYERR-5211");
+       if (filt & AR5K_RX_FILTER_RADARERR_5211)
+               len += snprintf(buf+len, sizeof(buf)-len, " RADARERR-5211\n");
+       else
+               len += snprintf(buf+len, sizeof(buf)-len, "\n");
+
+       if (len > sizeof(buf))
+               len = sizeof(buf);
+
+       return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+}
+
+static const struct file_operations fops_misc = {
+       .read = read_file_misc,
+       .open = ath5k_debugfs_open,
+       .owner = THIS_MODULE,
+};
+
 
 /* debugfs: frameerrors */
 
@@ -856,6 +909,10 @@ ath5k_debug_init_device(struct ath5k_softc *sc)
                                S_IWUSR | S_IRUSR,
                                sc->debug.debugfs_phydir, sc, &fops_antenna);
 
+       sc->debug.debugfs_misc = debugfs_create_file("misc",
+                               S_IRUSR,
+                               sc->debug.debugfs_phydir, sc, &fops_misc);
+
        sc->debug.debugfs_frameerrors = debugfs_create_file("frameerrors",
                                S_IWUSR | S_IRUSR,
                                sc->debug.debugfs_phydir, sc,
@@ -886,6 +943,7 @@ ath5k_debug_finish_device(struct ath5k_softc *sc)
        debugfs_remove(sc->debug.debugfs_beacon);
        debugfs_remove(sc->debug.debugfs_reset);
        debugfs_remove(sc->debug.debugfs_antenna);
+       debugfs_remove(sc->debug.debugfs_misc);
        debugfs_remove(sc->debug.debugfs_frameerrors);
        debugfs_remove(sc->debug.debugfs_ani);
        debugfs_remove(sc->debug.debugfs_queue);
index 9b22722a95f04a420da49ff22395d3629cc965ca..4f078b134015c2a91680e60f973f18d3065c0c7b 100644 (file)
@@ -75,6 +75,7 @@ struct ath5k_dbg_info {
        struct dentry           *debugfs_beacon;
        struct dentry           *debugfs_reset;
        struct dentry           *debugfs_antenna;
+       struct dentry           *debugfs_misc;
        struct dentry           *debugfs_frameerrors;
        struct dentry           *debugfs_ani;
        struct dentry           *debugfs_queue;