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.c99
1 files changed, 72 insertions, 27 deletions
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index 210b9b6fecd2..6c439cd5ccea 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
@@ -51,14 +52,6 @@ static const struct file_operations name## _ops = { \
51 52
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",
55 local->rts_threshold);
56DEBUGFS_READONLY_FILE(fragmentation_threshold, 20, "%d",
57 local->fragmentation_threshold);
58DEBUGFS_READONLY_FILE(short_retry_limit, 20, "%d",
59 local->hw.conf.short_frame_max_tx_count);
60DEBUGFS_READONLY_FILE(long_retry_limit, 20, "%d",
61 local->hw.conf.long_frame_max_tx_count);
62DEBUGFS_READONLY_FILE(total_ps_buffered, 20, "%d", 55DEBUGFS_READONLY_FILE(total_ps_buffered, 20, "%d",
63 local->total_ps_buffered); 56 local->total_ps_buffered);
64DEBUGFS_READONLY_FILE(wep_iv, 20, "%#08x", 57DEBUGFS_READONLY_FILE(wep_iv, 20, "%#08x",
@@ -70,11 +63,10 @@ static ssize_t tsf_read(struct file *file, char __user *user_buf,
70 size_t count, loff_t *ppos) 63 size_t count, loff_t *ppos)
71{ 64{
72 struct ieee80211_local *local = file->private_data; 65 struct ieee80211_local *local = file->private_data;
73 u64 tsf = 0; 66 u64 tsf;
74 char buf[100]; 67 char buf[100];
75 68
76 if (local->ops->get_tsf) 69 tsf = drv_get_tsf(local);
77 tsf = local->ops->get_tsf(local_to_hw(local));
78 70
79 snprintf(buf, sizeof(buf), "0x%016llx\n", (unsigned long long) tsf); 71 snprintf(buf, sizeof(buf), "0x%016llx\n", (unsigned long long) tsf);
80 72
@@ -97,13 +89,13 @@ static ssize_t tsf_write(struct file *file,
97 89
98 if (strncmp(buf, "reset", 5) == 0) { 90 if (strncmp(buf, "reset", 5) == 0) {
99 if (local->ops->reset_tsf) { 91 if (local->ops->reset_tsf) {
100 local->ops->reset_tsf(local_to_hw(local)); 92 drv_reset_tsf(local);
101 printk(KERN_INFO "%s: debugfs reset TSF\n", wiphy_name(local->hw.wiphy)); 93 printk(KERN_INFO "%s: debugfs reset TSF\n", wiphy_name(local->hw.wiphy));
102 } 94 }
103 } else { 95 } else {
104 tsf = simple_strtoul(buf, NULL, 0); 96 tsf = simple_strtoul(buf, NULL, 0);
105 if (local->ops->set_tsf) { 97 if (local->ops->set_tsf) {
106 local->ops->set_tsf(local_to_hw(local), tsf); 98 drv_set_tsf(local, tsf);
107 printk(KERN_INFO "%s: debugfs set TSF to %#018llx\n", wiphy_name(local->hw.wiphy), tsf); 99 printk(KERN_INFO "%s: debugfs set TSF to %#018llx\n", wiphy_name(local->hw.wiphy), tsf);
108 } 100 }
109 } 101 }
@@ -135,6 +127,65 @@ static const struct file_operations reset_ops = {
135 .open = mac80211_open_file_generic, 127 .open = mac80211_open_file_generic,
136}; 128};
137 129
130static ssize_t noack_read(struct file *file, char __user *user_buf,
131 size_t count, loff_t *ppos)
132{
133 struct ieee80211_local *local = file->private_data;
134 int res;
135 char buf[10];
136
137 res = scnprintf(buf, sizeof(buf), "%d\n", local->wifi_wme_noack_test);
138
139 return simple_read_from_buffer(user_buf, count, ppos, buf, res);
140}
141
142static ssize_t noack_write(struct file *file,
143 const char __user *user_buf,
144 size_t count, loff_t *ppos)
145{
146 struct ieee80211_local *local = file->private_data;
147 char buf[10];
148 size_t len;
149
150 len = min(count, sizeof(buf) - 1);
151 if (copy_from_user(buf, user_buf, len))
152 return -EFAULT;
153 buf[len] = '\0';
154
155 local->wifi_wme_noack_test = !!simple_strtoul(buf, NULL, 0);
156
157 return count;
158}
159
160static const struct file_operations noack_ops = {
161 .read = noack_read,
162 .write = noack_write,
163 .open = mac80211_open_file_generic
164};
165
166static ssize_t queues_read(struct file *file, char __user *user_buf,
167 size_t count, loff_t *ppos)
168{
169 struct ieee80211_local *local = file->private_data;
170 unsigned long flags;
171 char buf[IEEE80211_MAX_QUEUES * 20];
172 int q, res = 0;
173
174 spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
175 for (q = 0; q < local->hw.queues; q++)
176 res += sprintf(buf + res, "%02d: %#.8lx/%d\n", q,
177 local->queue_stop_reasons[q],
178 __netif_subqueue_stopped(local->mdev, q));
179 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
180
181 return simple_read_from_buffer(user_buf, count, ppos, buf, res);
182}
183
184static const struct file_operations queues_ops = {
185 .read = queues_read,
186 .open = mac80211_open_file_generic
187};
188
138/* statistics stuff */ 189/* statistics stuff */
139 190
140#define DEBUGFS_STATS_FILE(name, buflen, fmt, value...) \ 191#define DEBUGFS_STATS_FILE(name, buflen, fmt, value...) \
@@ -150,14 +201,12 @@ static ssize_t format_devstat_counter(struct ieee80211_local *local,
150 char buf[20]; 201 char buf[20];
151 int res; 202 int res;
152 203
153 if (!local->ops->get_stats)
154 return -EOPNOTSUPP;
155
156 rtnl_lock(); 204 rtnl_lock();
157 res = local->ops->get_stats(local_to_hw(local), &stats); 205 res = drv_get_stats(local, &stats);
158 rtnl_unlock(); 206 rtnl_unlock();
159 if (!res) 207 if (res)
160 res = printvalue(&stats, buf, sizeof(buf)); 208 return res;
209 res = printvalue(&stats, buf, sizeof(buf));
161 return simple_read_from_buffer(userbuf, count, ppos, buf, res); 210 return simple_read_from_buffer(userbuf, count, ppos, buf, res);
162} 211}
163 212
@@ -269,14 +318,12 @@ void debugfs_hw_add(struct ieee80211_local *local)
269 local->debugfs.keys = debugfs_create_dir("keys", phyd); 318 local->debugfs.keys = debugfs_create_dir("keys", phyd);
270 319
271 DEBUGFS_ADD(frequency); 320 DEBUGFS_ADD(frequency);
272 DEBUGFS_ADD(rts_threshold);
273 DEBUGFS_ADD(fragmentation_threshold);
274 DEBUGFS_ADD(short_retry_limit);
275 DEBUGFS_ADD(long_retry_limit);
276 DEBUGFS_ADD(total_ps_buffered); 321 DEBUGFS_ADD(total_ps_buffered);
277 DEBUGFS_ADD(wep_iv); 322 DEBUGFS_ADD(wep_iv);
278 DEBUGFS_ADD(tsf); 323 DEBUGFS_ADD(tsf);
324 DEBUGFS_ADD(queues);
279 DEBUGFS_ADD_MODE(reset, 0200); 325 DEBUGFS_ADD_MODE(reset, 0200);
326 DEBUGFS_ADD(noack);
280 327
281 statsd = debugfs_create_dir("statistics", phyd); 328 statsd = debugfs_create_dir("statistics", phyd);
282 local->debugfs.statistics = statsd; 329 local->debugfs.statistics = statsd;
@@ -324,14 +371,12 @@ void debugfs_hw_add(struct ieee80211_local *local)
324void debugfs_hw_del(struct ieee80211_local *local) 371void debugfs_hw_del(struct ieee80211_local *local)
325{ 372{
326 DEBUGFS_DEL(frequency); 373 DEBUGFS_DEL(frequency);
327 DEBUGFS_DEL(rts_threshold);
328 DEBUGFS_DEL(fragmentation_threshold);
329 DEBUGFS_DEL(short_retry_limit);
330 DEBUGFS_DEL(long_retry_limit);
331 DEBUGFS_DEL(total_ps_buffered); 374 DEBUGFS_DEL(total_ps_buffered);
332 DEBUGFS_DEL(wep_iv); 375 DEBUGFS_DEL(wep_iv);
333 DEBUGFS_DEL(tsf); 376 DEBUGFS_DEL(tsf);
377 DEBUGFS_DEL(queues);
334 DEBUGFS_DEL(reset); 378 DEBUGFS_DEL(reset);
379 DEBUGFS_DEL(noack);
335 380
336 DEBUGFS_STATS_DEL(transmitted_fragment_count); 381 DEBUGFS_STATS_DEL(transmitted_fragment_count);
337 DEBUGFS_STATS_DEL(multicast_transmitted_frame_count); 382 DEBUGFS_STATS_DEL(multicast_transmitted_frame_count);