aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/debugfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/debugfs.c')
-rw-r--r--net/mac80211/debugfs.c66
1 files changed, 51 insertions, 15 deletions
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index 210b9b6fecd2..e7682fe1c590 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -10,6 +10,7 @@
10#include <linux/debugfs.h> 10#include <linux/debugfs.h>
11#include <linux/rtnetlink.h> 11#include <linux/rtnetlink.h>
12#include "ieee80211_i.h" 12#include "ieee80211_i.h"
13#include "driver-ops.h"
13#include "rate.h" 14#include "rate.h"
14#include "debugfs.h" 15#include "debugfs.h"
15 16
@@ -52,13 +53,13 @@ static const struct file_operations name## _ops = { \
52DEBUGFS_READONLY_FILE(frequency, 20, "%d", 53DEBUGFS_READONLY_FILE(frequency, 20, "%d",
53 local->hw.conf.channel->center_freq); 54 local->hw.conf.channel->center_freq);
54DEBUGFS_READONLY_FILE(rts_threshold, 20, "%d", 55DEBUGFS_READONLY_FILE(rts_threshold, 20, "%d",
55 local->rts_threshold); 56 local->hw.wiphy->rts_threshold);
56DEBUGFS_READONLY_FILE(fragmentation_threshold, 20, "%d", 57DEBUGFS_READONLY_FILE(fragmentation_threshold, 20, "%d",
57 local->fragmentation_threshold); 58 local->hw.wiphy->frag_threshold);
58DEBUGFS_READONLY_FILE(short_retry_limit, 20, "%d", 59DEBUGFS_READONLY_FILE(short_retry_limit, 20, "%d",
59 local->hw.conf.short_frame_max_tx_count); 60 local->hw.wiphy->retry_short);
60DEBUGFS_READONLY_FILE(long_retry_limit, 20, "%d", 61DEBUGFS_READONLY_FILE(long_retry_limit, 20, "%d",
61 local->hw.conf.long_frame_max_tx_count); 62 local->hw.wiphy->retry_long);
62DEBUGFS_READONLY_FILE(total_ps_buffered, 20, "%d", 63DEBUGFS_READONLY_FILE(total_ps_buffered, 20, "%d",
63 local->total_ps_buffered); 64 local->total_ps_buffered);
64DEBUGFS_READONLY_FILE(wep_iv, 20, "%#08x", 65DEBUGFS_READONLY_FILE(wep_iv, 20, "%#08x",
@@ -70,11 +71,10 @@ static ssize_t tsf_read(struct file *file, char __user *user_buf,
70 size_t count, loff_t *ppos) 71 size_t count, loff_t *ppos)
71{ 72{
72 struct ieee80211_local *local = file->private_data; 73 struct ieee80211_local *local = file->private_data;
73 u64 tsf = 0; 74 u64 tsf;
74 char buf[100]; 75 char buf[100];
75 76
76 if (local->ops->get_tsf) 77 tsf = drv_get_tsf(local);
77 tsf = local->ops->get_tsf(local_to_hw(local));
78 78
79 snprintf(buf, sizeof(buf), "0x%016llx\n", (unsigned long long) tsf); 79 snprintf(buf, sizeof(buf), "0x%016llx\n", (unsigned long long) tsf);
80 80
@@ -97,13 +97,13 @@ static ssize_t tsf_write(struct file *file,
97 97
98 if (strncmp(buf, "reset", 5) == 0) { 98 if (strncmp(buf, "reset", 5) == 0) {
99 if (local->ops->reset_tsf) { 99 if (local->ops->reset_tsf) {
100 local->ops->reset_tsf(local_to_hw(local)); 100 drv_reset_tsf(local);
101 printk(KERN_INFO "%s: debugfs reset TSF\n", wiphy_name(local->hw.wiphy)); 101 printk(KERN_INFO "%s: debugfs reset TSF\n", wiphy_name(local->hw.wiphy));
102 } 102 }
103 } else { 103 } else {
104 tsf = simple_strtoul(buf, NULL, 0); 104 tsf = simple_strtoul(buf, NULL, 0);
105 if (local->ops->set_tsf) { 105 if (local->ops->set_tsf) {
106 local->ops->set_tsf(local_to_hw(local), tsf); 106 drv_set_tsf(local, tsf);
107 printk(KERN_INFO "%s: debugfs set TSF to %#018llx\n", wiphy_name(local->hw.wiphy), tsf); 107 printk(KERN_INFO "%s: debugfs set TSF to %#018llx\n", wiphy_name(local->hw.wiphy), tsf);
108 } 108 }
109 } 109 }
@@ -135,6 +135,42 @@ static const struct file_operations reset_ops = {
135 .open = mac80211_open_file_generic, 135 .open = mac80211_open_file_generic,
136}; 136};
137 137
138static ssize_t noack_read(struct file *file, char __user *user_buf,
139 size_t count, loff_t *ppos)
140{
141 struct ieee80211_local *local = file->private_data;
142 int res;
143 char buf[10];
144
145 res = scnprintf(buf, sizeof(buf), "%d\n", local->wifi_wme_noack_test);
146
147 return simple_read_from_buffer(user_buf, count, ppos, buf, res);
148}
149
150static ssize_t noack_write(struct file *file,
151 const char __user *user_buf,
152 size_t count, loff_t *ppos)
153{
154 struct ieee80211_local *local = file->private_data;
155 char buf[10];
156 size_t len;
157
158 len = min(count, sizeof(buf) - 1);
159 if (copy_from_user(buf, user_buf, len))
160 return -EFAULT;
161 buf[len] = '\0';
162
163 local->wifi_wme_noack_test = !!simple_strtoul(buf, NULL, 0);
164
165 return count;
166}
167
168static const struct file_operations noack_ops = {
169 .read = noack_read,
170 .write = noack_write,
171 .open = mac80211_open_file_generic
172};
173
138/* statistics stuff */ 174/* statistics stuff */
139 175
140#define DEBUGFS_STATS_FILE(name, buflen, fmt, value...) \ 176#define DEBUGFS_STATS_FILE(name, buflen, fmt, value...) \
@@ -150,14 +186,12 @@ static ssize_t format_devstat_counter(struct ieee80211_local *local,
150 char buf[20]; 186 char buf[20];
151 int res; 187 int res;
152 188
153 if (!local->ops->get_stats)
154 return -EOPNOTSUPP;
155
156 rtnl_lock(); 189 rtnl_lock();
157 res = local->ops->get_stats(local_to_hw(local), &stats); 190 res = drv_get_stats(local, &stats);
158 rtnl_unlock(); 191 rtnl_unlock();
159 if (!res) 192 if (res)
160 res = printvalue(&stats, buf, sizeof(buf)); 193 return res;
194 res = printvalue(&stats, buf, sizeof(buf));
161 return simple_read_from_buffer(userbuf, count, ppos, buf, res); 195 return simple_read_from_buffer(userbuf, count, ppos, buf, res);
162} 196}
163 197
@@ -277,6 +311,7 @@ void debugfs_hw_add(struct ieee80211_local *local)
277 DEBUGFS_ADD(wep_iv); 311 DEBUGFS_ADD(wep_iv);
278 DEBUGFS_ADD(tsf); 312 DEBUGFS_ADD(tsf);
279 DEBUGFS_ADD_MODE(reset, 0200); 313 DEBUGFS_ADD_MODE(reset, 0200);
314 DEBUGFS_ADD(noack);
280 315
281 statsd = debugfs_create_dir("statistics", phyd); 316 statsd = debugfs_create_dir("statistics", phyd);
282 local->debugfs.statistics = statsd; 317 local->debugfs.statistics = statsd;
@@ -332,6 +367,7 @@ void debugfs_hw_del(struct ieee80211_local *local)
332 DEBUGFS_DEL(wep_iv); 367 DEBUGFS_DEL(wep_iv);
333 DEBUGFS_DEL(tsf); 368 DEBUGFS_DEL(tsf);
334 DEBUGFS_DEL(reset); 369 DEBUGFS_DEL(reset);
370 DEBUGFS_DEL(noack);
335 371
336 DEBUGFS_STATS_DEL(transmitted_fragment_count); 372 DEBUGFS_STATS_DEL(transmitted_fragment_count);
337 DEBUGFS_STATS_DEL(multicast_transmitted_frame_count); 373 DEBUGFS_STATS_DEL(multicast_transmitted_frame_count);