mac80211: add beacon stats to debugfs
authorBen Greear <greearb@candelatech.com>
Mon, 25 Mar 2013 18:19:34 +0000 (11:19 -0700)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 8 Apr 2013 07:16:54 +0000 (09:16 +0200)
Beacon-timeout and number of beacon loss events.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/debugfs_netdev.c
net/mac80211/debugfs_sta.c

index ddb426867904d55c3b14ab4d7642bef3b0cd66cd..14abcf44f974309de5495908d413eeeae2f3595e 100644 (file)
@@ -124,6 +124,15 @@ static ssize_t ieee80211_if_fmt_##name(                                    \
        return scnprintf(buf, buflen, "%d\n", sdata->field / 16);       \
 }
 
+#define IEEE80211_IF_FMT_JIFFIES_TO_MS(name, field)                    \
+static ssize_t ieee80211_if_fmt_##name(                                        \
+       const struct ieee80211_sub_if_data *sdata,                      \
+       char *buf, int buflen)                                          \
+{                                                                      \
+       return scnprintf(buf, buflen, "%d\n",                           \
+                        jiffies_to_msecs(sdata->field));               \
+}
+
 #define __IEEE80211_IF_FILE(name, _write)                              \
 static ssize_t ieee80211_if_read_##name(struct file *file,             \
                                        char __user *userbuf,           \
@@ -197,6 +206,7 @@ IEEE80211_IF_FILE(bssid, u.mgd.bssid, MAC);
 IEEE80211_IF_FILE(aid, u.mgd.aid, DEC);
 IEEE80211_IF_FILE(last_beacon, u.mgd.last_beacon_signal, DEC);
 IEEE80211_IF_FILE(ave_beacon, u.mgd.ave_beacon_signal, DEC_DIV_16);
+IEEE80211_IF_FILE(beacon_timeout, u.mgd.beacon_timeout, JIFFIES_TO_MS);
 
 static int ieee80211_set_smps(struct ieee80211_sub_if_data *sdata,
                              enum ieee80211_smps_mode smps_mode)
@@ -542,6 +552,7 @@ static void add_sta_files(struct ieee80211_sub_if_data *sdata)
        DEBUGFS_ADD(aid);
        DEBUGFS_ADD(last_beacon);
        DEBUGFS_ADD(ave_beacon);
+       DEBUGFS_ADD(beacon_timeout);
        DEBUGFS_ADD_MODE(smps, 0600);
        DEBUGFS_ADD_MODE(tkip_mic_test, 0200);
        DEBUGFS_ADD_MODE(uapsd_queues, 0600);
index 4f841fe559df3d834516bf50c60709929d1c4639..44e201d60a13991f0144954ac1dd1ebd00cb4672 100644 (file)
@@ -54,6 +54,7 @@ STA_FILE(aid, sta.aid, D);
 STA_FILE(dev, sdata->name, S);
 STA_FILE(last_signal, last_signal, D);
 STA_FILE(last_ack_signal, last_ack_signal, D);
+STA_FILE(beacon_loss_count, beacon_loss_count, D);
 
 static ssize_t sta_flags_read(struct file *file, char __user *userbuf,
                              size_t count, loff_t *ppos)
@@ -434,6 +435,7 @@ void ieee80211_sta_debugfs_add(struct sta_info *sta)
        DEBUGFS_ADD(agg_status);
        DEBUGFS_ADD(dev);
        DEBUGFS_ADD(last_signal);
+       DEBUGFS_ADD(beacon_loss_count);
        DEBUGFS_ADD(ht_capa);
        DEBUGFS_ADD(vht_capa);
        DEBUGFS_ADD(last_ack_signal);