ath5k: Print out opmode in debugfs.
authorBen Greear <greearb@candelatech.com>
Fri, 8 Oct 2010 16:43:29 +0000 (09:43 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 11 Oct 2010 19:04:19 +0000 (15:04 -0400)
Helps debug multi-VIF scenarios.

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/debug.c
drivers/net/wireless/ath/debug.h

index c2d549f871f936075ed64587690273c5717edd10..a342a9da1b3e95e45f276d2f15de6348f885e1ef 100644 (file)
@@ -60,6 +60,7 @@
 
 #include "base.h"
 #include "debug.h"
+#include "../debug.h"
 
 static unsigned int ath5k_debug;
 module_param_named(debug, ath5k_debug, uint, 0);
@@ -492,6 +493,7 @@ static ssize_t read_file_misc(struct file *file, char __user *user_buf,
        char buf[700];
        unsigned int len = 0;
        u32 filt = ath5k_hw_get_rx_filter(sc->ah);
+       const char *tmp;
 
        len += snprintf(buf+len, sizeof(buf)-len, "bssid-mask: %pM\n",
                        sc->bssidmask);
@@ -524,6 +526,14 @@ static ssize_t read_file_misc(struct file *file, char __user *user_buf,
        else
                len += snprintf(buf+len, sizeof(buf)-len, "\n");
 
+       tmp = ath_opmode_to_string(sc->opmode);
+       if (tmp)
+               len += snprintf(buf+len, sizeof(buf)-len, "opmode: %s\n",
+                               tmp);
+       else
+               len += snprintf(buf+len, sizeof(buf)-len,
+                               "opmode: UNKNOWN-%i\n", sc->opmode);
+
        if (len > sizeof(buf))
                len = sizeof(buf);
 
index 53e77bd131b925937cd432f347b31e16855be9a8..a9eb7876dbe19c866a65fe566ab1e38f400dfeb6 100644 (file)
@@ -30,3 +30,32 @@ void ath_print(struct ath_common *common, int dbg_mask, const char *fmt, ...)
        va_end(args);
 }
 EXPORT_SYMBOL(ath_print);
+
+const char *ath_opmode_to_string(enum nl80211_iftype opmode)
+{
+       switch (opmode) {
+       case NL80211_IFTYPE_UNSPECIFIED:
+               return "UNSPEC";
+       case NL80211_IFTYPE_ADHOC:
+               return "ADHOC";
+       case NL80211_IFTYPE_STATION:
+               return "STATION";
+       case NL80211_IFTYPE_AP:
+               return "AP";
+       case NL80211_IFTYPE_AP_VLAN:
+               return "AP-VLAN";
+       case NL80211_IFTYPE_WDS:
+               return "WDS";
+       case NL80211_IFTYPE_MONITOR:
+               return "MONITOR";
+       case NL80211_IFTYPE_MESH_POINT:
+               return "MESH";
+       case NL80211_IFTYPE_P2P_CLIENT:
+               return "P2P-CLIENT";
+       case NL80211_IFTYPE_P2P_GO:
+               return "P2P-GO";
+       default:
+               return NULL;
+       }
+}
+EXPORT_SYMBOL(ath_opmode_to_string);
index fd3a020682dc2dee0dbb2339b4ea1b25d36c4303..a3a5a628d24dc5c802f422441fde2e7fae90808c 100644 (file)
@@ -77,4 +77,7 @@ ath_print(struct ath_common *common, int dbg_mask, const char *fmt, ...)
 }
 #endif /* CONFIG_ATH_DEBUG */
 
+/** Returns string describing opmode, or NULL if unknown mode. */
+const char *ath_opmode_to_string(enum nl80211_iftype opmode);
+
 #endif /* ATH_DEBUG_H */