All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] mac80211: Add station uptime in debugfs
@ 2011-04-05 13:39 Mohammed Shafi Shajakhan
  2011-04-05 14:04 ` Helmut Schaa
  2011-04-05 14:08 ` Felix Fietkau
  0 siblings, 2 replies; 10+ messages in thread
From: Mohammed Shafi Shajakhan @ 2011-04-05 13:39 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, Mohammed Shafi Shajakhan

From: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>

Add station uptime parameter in debugfs. This will be helpful to get a
measure of stability of connection and also during stress testing.

Signed-off-by: Mohammed Shafi Shajakhan <mshajakhan@atheros.com>
---
 net/mac80211/debugfs_sta.c |   22 ++++++++++++++++++++++
 net/mac80211/sta_info.c    |    1 +
 net/mac80211/sta_info.h    |    2 ++
 3 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index c04a139..cc79e76 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -73,6 +73,27 @@ static ssize_t sta_flags_read(struct file *file, char __user *userbuf,
 }
 STA_OPS(flags);
 
+static ssize_t sta_station_uptime_read(struct file *file, char __user *userbuf,
+					size_t count, loff_t *ppos)
+{
+	struct sta_info *sta = file->private_data;
+	struct tm result;
+	unsigned long uptime_msecs;
+	unsigned long  uptime_secs;
+	char buf[100];
+	int res;
+	uptime_msecs = jiffies_to_msecs(jiffies - (sta->sta_uptime));
+	uptime_secs = uptime_msecs / 1000;
+	uptime_msecs %= 1000;
+	time_to_tm(uptime_secs, 0, &result);
+	res = scnprintf(buf, sizeof(buf),
+			"days  - %d\nclock - %d:%d:%d\nmsecs - %lu\n",
+			result.tm_yday, result.tm_hour,
+			result.tm_min, result.tm_sec, uptime_msecs);
+	return simple_read_from_buffer(userbuf, count, ppos, buf, res);
+}
+STA_OPS(station_uptime);
+
 static ssize_t sta_num_ps_buf_frames_read(struct file *file,
 					  char __user *userbuf,
 					  size_t count, loff_t *ppos)
@@ -324,6 +345,7 @@ void ieee80211_sta_debugfs_add(struct sta_info *sta)
 	DEBUGFS_ADD(flags);
 	DEBUGFS_ADD(num_ps_buf_frames);
 	DEBUGFS_ADD(inactive_ms);
+	DEBUGFS_ADD(station_uptime);
 	DEBUGFS_ADD(last_seq_ctrl);
 	DEBUGFS_ADD(agg_status);
 	DEBUGFS_ADD(dev);
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 999f8fb..08b9f51 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -244,6 +244,7 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
 	sta->local = local;
 	sta->sdata = sdata;
 	sta->last_rx = jiffies;
+	sta->sta_uptime = jiffies;
 
 	ewma_init(&sta->avg_signal, 1024, 8);
 
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 43238e9..e704270 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -226,6 +226,7 @@ enum plink_state {
  * @rx_bytes: Number of bytes received from this STA
  * @wep_weak_iv_count: number of weak WEP IVs received from this station
  * @last_rx: time (in jiffies) when last frame was received from this STA
+ * @sta_uptime: time (in jiffies) when the station gets associated
  * @num_duplicates: number of duplicate frames received from this STA
  * @rx_fragments: number of received MPDUs
  * @rx_dropped: number of dropped MPDUs from this STA
@@ -295,6 +296,7 @@ struct sta_info {
 	unsigned long rx_packets, rx_bytes;
 	unsigned long wep_weak_iv_count;
 	unsigned long last_rx;
+	unsigned long sta_uptime;
 	unsigned long num_duplicates;
 	unsigned long rx_fragments;
 	unsigned long rx_dropped;
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-04-05 15:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-05 13:39 [RFC] mac80211: Add station uptime in debugfs Mohammed Shafi Shajakhan
2011-04-05 14:04 ` Helmut Schaa
2011-04-05 14:36   ` Mohammed Shafi
2011-04-05 14:50     ` Johannes Berg
2011-04-05 14:59       ` Mohammed Shafi
2011-04-05 15:05   ` Mohammed Shafi
2011-04-05 14:08 ` Felix Fietkau
2011-04-05 15:04   ` Mohammed Shafi
2011-04-05 15:25     ` Felix Fietkau
2011-04-05 15:29       ` Mohammed Shafi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.