aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorSaravana <saravanad@posedge.com>2012-11-29 09:24:19 -0500
committerJohannes Berg <johannes.berg@intel.com>2012-11-29 09:33:06 -0500
commit1f2e651c9aa4be5ace193b6a8f48e4b068a60207 (patch)
treef6e354bf381244ffbaa3a20e570851dd43585f1d /net/mac80211
parent003e676af5044c2168dafbb49c7b8d61dd68cc60 (diff)
mac80211: add debugfs file for last rx rate
Add a debugfs file showing the rate at which the last packet is received. Signed-off-by: Saravana <saravanad@posedge.com> [fix whitespace] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/debugfs_sta.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index b6fd9f6ed80c..49a1c70bbd70 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -337,6 +337,23 @@ static ssize_t sta_current_tx_rate_read(struct file *file, char __user *userbuf,
337} 337}
338STA_OPS(current_tx_rate); 338STA_OPS(current_tx_rate);
339 339
340static ssize_t sta_last_rx_rate_read(struct file *file, char __user *userbuf,
341 size_t count, loff_t *ppos)
342{
343 struct sta_info *sta = file->private_data;
344 struct rate_info rinfo;
345 u16 rate;
346
347 sta_set_rate_info_rx(sta, &rinfo);
348
349 rate = cfg80211_calculate_bitrate(&rinfo);
350
351 return mac80211_format_buffer(userbuf, count, ppos,
352 "%d.%d MBit/s\n",
353 rate/10, rate%10);
354}
355STA_OPS(last_rx_rate);
356
340#define DEBUGFS_ADD(name) \ 357#define DEBUGFS_ADD(name) \
341 debugfs_create_file(#name, 0400, \ 358 debugfs_create_file(#name, 0400, \
342 sta->debugfs.dir, sta, &sta_ ##name## _ops); 359 sta->debugfs.dir, sta, &sta_ ##name## _ops);
@@ -387,6 +404,7 @@ void ieee80211_sta_debugfs_add(struct sta_info *sta)
387 DEBUGFS_ADD(ht_capa); 404 DEBUGFS_ADD(ht_capa);
388 DEBUGFS_ADD(last_ack_signal); 405 DEBUGFS_ADD(last_ack_signal);
389 DEBUGFS_ADD(current_tx_rate); 406 DEBUGFS_ADD(current_tx_rate);
407 DEBUGFS_ADD(last_rx_rate);
390 408
391 DEBUGFS_ADD_COUNTER(rx_packets, rx_packets); 409 DEBUGFS_ADD_COUNTER(rx_packets, rx_packets);
392 DEBUGFS_ADD_COUNTER(tx_packets, tx_packets); 410 DEBUGFS_ADD_COUNTER(tx_packets, tx_packets);