blob: 267ed45ef6a2aa05fa49c3078ca4a9cc32c86382 [file] [log] [blame]
Johannes Berg7bcfaf22009-10-27 12:59:03 +01001
Jiri Bence9f207f2007-05-05 11:46:38 -07002/*
3 * mac80211 debugfs for wireless PHYs
4 *
5 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
6 *
7 * GPLv2
8 *
9 */
10
11#include <linux/debugfs.h>
12#include <linux/rtnetlink.h>
13#include "ieee80211_i.h"
Johannes Berg24487982009-04-23 18:52:52 +020014#include "driver-ops.h"
Johannes Berg2c8dccc2008-04-08 15:14:40 -040015#include "rate.h"
Jiri Bence9f207f2007-05-05 11:46:38 -070016#include "debugfs.h"
17
18int mac80211_open_file_generic(struct inode *inode, struct file *file)
19{
20 file->private_data = inode->i_private;
21 return 0;
22}
23
Eliad Peller07caf9d2010-10-27 14:58:29 +020024#define DEBUGFS_FORMAT_BUFFER_SIZE 100
25
26int mac80211_format_buffer(char __user *userbuf, size_t count,
27 loff_t *ppos, char *fmt, ...)
28{
29 va_list args;
30 char buf[DEBUGFS_FORMAT_BUFFER_SIZE];
31 int res;
32
33 va_start(args, fmt);
34 res = vscnprintf(buf, sizeof(buf), fmt, args);
35 va_end(args);
36
37 return simple_read_from_buffer(userbuf, count, ppos, buf, res);
38}
39
Ben Greear279daf62011-03-23 14:04:31 -070040#define DEBUGFS_READONLY_FILE_FN(name, fmt, value...) \
Jiri Bence9f207f2007-05-05 11:46:38 -070041static ssize_t name## _read(struct file *file, char __user *userbuf, \
42 size_t count, loff_t *ppos) \
43{ \
44 struct ieee80211_local *local = file->private_data; \
Jiri Bence9f207f2007-05-05 11:46:38 -070045 \
Eliad Peller07caf9d2010-10-27 14:58:29 +020046 return mac80211_format_buffer(userbuf, count, ppos, \
47 fmt "\n", ##value); \
Ben Greear279daf62011-03-23 14:04:31 -070048}
49
50#define DEBUGFS_READONLY_FILE_OPS(name) \
Jiri Bence9f207f2007-05-05 11:46:38 -070051static const struct file_operations name## _ops = { \
52 .read = name## _read, \
53 .open = mac80211_open_file_generic, \
Arnd Bergmann2b18ab32010-07-06 19:05:31 +020054 .llseek = generic_file_llseek, \
Jiri Bence9f207f2007-05-05 11:46:38 -070055};
56
Ben Greear279daf62011-03-23 14:04:31 -070057#define DEBUGFS_READONLY_FILE(name, fmt, value...) \
58 DEBUGFS_READONLY_FILE_FN(name, fmt, value) \
59 DEBUGFS_READONLY_FILE_OPS(name)
60
Jiri Bence9f207f2007-05-05 11:46:38 -070061#define DEBUGFS_ADD(name) \
Johannes Berg7bcfaf22009-10-27 12:59:03 +010062 debugfs_create_file(#name, 0400, phyd, local, &name## _ops);
Jiri Bence9f207f2007-05-05 11:46:38 -070063
Johannes Berg827b1fb2009-03-13 11:44:18 +010064#define DEBUGFS_ADD_MODE(name, mode) \
Johannes Berg7bcfaf22009-10-27 12:59:03 +010065 debugfs_create_file(#name, mode, phyd, local, &name## _ops);
Jiri Bence9f207f2007-05-05 11:46:38 -070066
67
Ben Greear83bdf2a2011-02-15 13:11:22 -080068DEBUGFS_READONLY_FILE(user_power, "%d",
69 local->user_power_level);
70DEBUGFS_READONLY_FILE(power, "%d",
71 local->hw.conf.power_level);
Eliad Peller07caf9d2010-10-27 14:58:29 +020072DEBUGFS_READONLY_FILE(frequency, "%d",
Johannes Berg8318d782008-01-24 19:38:38 +010073 local->hw.conf.channel->center_freq);
Eliad Peller07caf9d2010-10-27 14:58:29 +020074DEBUGFS_READONLY_FILE(total_ps_buffered, "%d",
Jiri Bence9f207f2007-05-05 11:46:38 -070075 local->total_ps_buffered);
Eliad Peller07caf9d2010-10-27 14:58:29 +020076DEBUGFS_READONLY_FILE(wep_iv, "%#08x",
Jiri Bence9f207f2007-05-05 11:46:38 -070077 local->wep_iv & 0xffffff);
Eliad Peller07caf9d2010-10-27 14:58:29 +020078DEBUGFS_READONLY_FILE(rate_ctrl_alg, "%s",
Johannes Bergaf65cd92009-11-17 18:18:36 +010079 local->rate_ctrl ? local->rate_ctrl->ops->name : "hw/driver");
Alina Friedrichsen3b5d6652009-01-24 07:09:59 +010080
81static ssize_t tsf_read(struct file *file, char __user *user_buf,
82 size_t count, loff_t *ppos)
83{
84 struct ieee80211_local *local = file->private_data;
Johannes Berg24487982009-04-23 18:52:52 +020085 u64 tsf;
Alina Friedrichsen3b5d6652009-01-24 07:09:59 +010086
Johannes Berg24487982009-04-23 18:52:52 +020087 tsf = drv_get_tsf(local);
Alina Friedrichsen3b5d6652009-01-24 07:09:59 +010088
Eliad Peller07caf9d2010-10-27 14:58:29 +020089 return mac80211_format_buffer(user_buf, count, ppos, "0x%016llx\n",
90 (unsigned long long) tsf);
Alina Friedrichsen3b5d6652009-01-24 07:09:59 +010091}
92
93static ssize_t tsf_write(struct file *file,
94 const char __user *user_buf,
95 size_t count, loff_t *ppos)
96{
97 struct ieee80211_local *local = file->private_data;
98 unsigned long long tsf;
99 char buf[100];
100 size_t len;
101
102 len = min(count, sizeof(buf) - 1);
103 if (copy_from_user(buf, user_buf, len))
104 return -EFAULT;
105 buf[len] = '\0';
106
107 if (strncmp(buf, "reset", 5) == 0) {
108 if (local->ops->reset_tsf) {
Johannes Berg24487982009-04-23 18:52:52 +0200109 drv_reset_tsf(local);
Joe Perches0fb9a9e2010-08-20 16:25:38 -0700110 wiphy_info(local->hw.wiphy, "debugfs reset TSF\n");
Alina Friedrichsen3b5d6652009-01-24 07:09:59 +0100111 }
112 } else {
113 tsf = simple_strtoul(buf, NULL, 0);
114 if (local->ops->set_tsf) {
Johannes Berg24487982009-04-23 18:52:52 +0200115 drv_set_tsf(local, tsf);
Joe Perches0fb9a9e2010-08-20 16:25:38 -0700116 wiphy_info(local->hw.wiphy,
117 "debugfs set TSF to %#018llx\n", tsf);
118
Alina Friedrichsen3b5d6652009-01-24 07:09:59 +0100119 }
120 }
121
122 return count;
123}
124
125static const struct file_operations tsf_ops = {
126 .read = tsf_read,
127 .write = tsf_write,
Arnd Bergmann6038f372010-08-15 18:52:59 +0200128 .open = mac80211_open_file_generic,
129 .llseek = default_llseek,
Alina Friedrichsen3b5d6652009-01-24 07:09:59 +0100130};
Jiri Bence9f207f2007-05-05 11:46:38 -0700131
Johannes Berg827b1fb2009-03-13 11:44:18 +0100132static ssize_t reset_write(struct file *file, const char __user *user_buf,
133 size_t count, loff_t *ppos)
134{
135 struct ieee80211_local *local = file->private_data;
136
137 rtnl_lock();
Johannes Bergeecc4802011-05-04 15:37:29 +0200138 __ieee80211_suspend(&local->hw, NULL);
Johannes Berg827b1fb2009-03-13 11:44:18 +0100139 __ieee80211_resume(&local->hw);
140 rtnl_unlock();
141
142 return count;
143}
144
145static const struct file_operations reset_ops = {
146 .write = reset_write,
147 .open = mac80211_open_file_generic,
Arnd Bergmann6038f372010-08-15 18:52:59 +0200148 .llseek = noop_llseek,
Johannes Berg827b1fb2009-03-13 11:44:18 +0100149};
150
Johannes Bergd3707d92009-05-12 22:05:40 +0200151static ssize_t noack_read(struct file *file, char __user *user_buf,
152 size_t count, loff_t *ppos)
153{
154 struct ieee80211_local *local = file->private_data;
Johannes Bergd3707d92009-05-12 22:05:40 +0200155
Eliad Peller07caf9d2010-10-27 14:58:29 +0200156 return mac80211_format_buffer(user_buf, count, ppos, "%d\n",
157 local->wifi_wme_noack_test);
Johannes Bergd3707d92009-05-12 22:05:40 +0200158}
159
160static ssize_t noack_write(struct file *file,
161 const char __user *user_buf,
162 size_t count, loff_t *ppos)
163{
164 struct ieee80211_local *local = file->private_data;
165 char buf[10];
166 size_t len;
167
168 len = min(count, sizeof(buf) - 1);
169 if (copy_from_user(buf, user_buf, len))
170 return -EFAULT;
171 buf[len] = '\0';
172
173 local->wifi_wme_noack_test = !!simple_strtoul(buf, NULL, 0);
174
175 return count;
176}
177
178static const struct file_operations noack_ops = {
179 .read = noack_read,
180 .write = noack_write,
Arnd Bergmann6038f372010-08-15 18:52:59 +0200181 .open = mac80211_open_file_generic,
182 .llseek = default_llseek,
Johannes Bergd3707d92009-05-12 22:05:40 +0200183};
184
Kalle Valo50ae0cf2010-01-12 10:42:39 +0200185static ssize_t uapsd_queues_read(struct file *file, char __user *user_buf,
186 size_t count, loff_t *ppos)
187{
188 struct ieee80211_local *local = file->private_data;
Eliad Peller07caf9d2010-10-27 14:58:29 +0200189 return mac80211_format_buffer(user_buf, count, ppos, "0x%x\n",
190 local->uapsd_queues);
Kalle Valo50ae0cf2010-01-12 10:42:39 +0200191}
192
193static ssize_t uapsd_queues_write(struct file *file,
194 const char __user *user_buf,
195 size_t count, loff_t *ppos)
196{
197 struct ieee80211_local *local = file->private_data;
Peter Hueweb38de312011-06-07 22:36:14 +0200198 u8 val;
Kalle Valo50ae0cf2010-01-12 10:42:39 +0200199 int ret;
200
Peter Hueweb38de312011-06-07 22:36:14 +0200201 ret = kstrtou8_from_user(user_buf, count, 0, &val);
Kalle Valo50ae0cf2010-01-12 10:42:39 +0200202 if (ret)
Peter Hueweb38de312011-06-07 22:36:14 +0200203 return ret;
Kalle Valo50ae0cf2010-01-12 10:42:39 +0200204
205 if (val & ~IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK)
206 return -ERANGE;
207
208 local->uapsd_queues = val;
209
210 return count;
211}
212
213static const struct file_operations uapsd_queues_ops = {
214 .read = uapsd_queues_read,
215 .write = uapsd_queues_write,
Arnd Bergmann6038f372010-08-15 18:52:59 +0200216 .open = mac80211_open_file_generic,
217 .llseek = default_llseek,
Kalle Valo50ae0cf2010-01-12 10:42:39 +0200218};
219
220static ssize_t uapsd_max_sp_len_read(struct file *file, char __user *user_buf,
221 size_t count, loff_t *ppos)
222{
223 struct ieee80211_local *local = file->private_data;
Kalle Valo50ae0cf2010-01-12 10:42:39 +0200224
Eliad Peller07caf9d2010-10-27 14:58:29 +0200225 return mac80211_format_buffer(user_buf, count, ppos, "0x%x\n",
226 local->uapsd_max_sp_len);
Kalle Valo50ae0cf2010-01-12 10:42:39 +0200227}
228
229static ssize_t uapsd_max_sp_len_write(struct file *file,
230 const char __user *user_buf,
231 size_t count, loff_t *ppos)
232{
233 struct ieee80211_local *local = file->private_data;
234 unsigned long val;
235 char buf[10];
236 size_t len;
237 int ret;
238
239 len = min(count, sizeof(buf) - 1);
240 if (copy_from_user(buf, user_buf, len))
241 return -EFAULT;
242 buf[len] = '\0';
243
244 ret = strict_strtoul(buf, 0, &val);
245
246 if (ret)
247 return -EINVAL;
248
249 if (val & ~IEEE80211_WMM_IE_STA_QOSINFO_SP_MASK)
250 return -ERANGE;
251
252 local->uapsd_max_sp_len = val;
253
254 return count;
255}
256
257static const struct file_operations uapsd_max_sp_len_ops = {
258 .read = uapsd_max_sp_len_read,
259 .write = uapsd_max_sp_len_write,
Arnd Bergmann6038f372010-08-15 18:52:59 +0200260 .open = mac80211_open_file_generic,
261 .llseek = default_llseek,
Kalle Valo50ae0cf2010-01-12 10:42:39 +0200262};
263
Benoit Papillault199d69f2010-02-04 22:00:20 +0100264static ssize_t channel_type_read(struct file *file, char __user *user_buf,
265 size_t count, loff_t *ppos)
266{
267 struct ieee80211_local *local = file->private_data;
268 const char *buf;
269
270 switch (local->hw.conf.channel_type) {
271 case NL80211_CHAN_NO_HT:
272 buf = "no ht\n";
273 break;
274 case NL80211_CHAN_HT20:
275 buf = "ht20\n";
276 break;
277 case NL80211_CHAN_HT40MINUS:
278 buf = "ht40-\n";
279 break;
280 case NL80211_CHAN_HT40PLUS:
281 buf = "ht40+\n";
282 break;
283 default:
284 buf = "???";
285 break;
286 }
287
288 return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));
289}
290
Ben Greear279daf62011-03-23 14:04:31 -0700291static ssize_t hwflags_read(struct file *file, char __user *user_buf,
292 size_t count, loff_t *ppos)
293{
294 struct ieee80211_local *local = file->private_data;
295 int mxln = 500;
296 ssize_t rv;
297 char *buf = kzalloc(mxln, GFP_KERNEL);
298 int sf = 0; /* how many written so far */
299
300 sf += snprintf(buf, mxln - sf, "0x%x\n", local->hw.flags);
301 if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL)
302 sf += snprintf(buf + sf, mxln - sf, "HAS_RATE_CONTROL\n");
303 if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS)
304 sf += snprintf(buf + sf, mxln - sf, "RX_INCLUDES_FCS\n");
305 if (local->hw.flags & IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING)
306 sf += snprintf(buf + sf, mxln - sf,
307 "HOST_BCAST_PS_BUFFERING\n");
308 if (local->hw.flags & IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE)
309 sf += snprintf(buf + sf, mxln - sf,
310 "2GHZ_SHORT_SLOT_INCAPABLE\n");
311 if (local->hw.flags & IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE)
312 sf += snprintf(buf + sf, mxln - sf,
313 "2GHZ_SHORT_PREAMBLE_INCAPABLE\n");
314 if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)
315 sf += snprintf(buf + sf, mxln - sf, "SIGNAL_UNSPEC\n");
316 if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM)
317 sf += snprintf(buf + sf, mxln - sf, "SIGNAL_DBM\n");
318 if (local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD)
319 sf += snprintf(buf + sf, mxln - sf, "NEED_DTIM_PERIOD\n");
320 if (local->hw.flags & IEEE80211_HW_SPECTRUM_MGMT)
321 sf += snprintf(buf + sf, mxln - sf, "SPECTRUM_MGMT\n");
322 if (local->hw.flags & IEEE80211_HW_AMPDU_AGGREGATION)
323 sf += snprintf(buf + sf, mxln - sf, "AMPDU_AGGREGATION\n");
324 if (local->hw.flags & IEEE80211_HW_SUPPORTS_PS)
325 sf += snprintf(buf + sf, mxln - sf, "SUPPORTS_PS\n");
326 if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK)
327 sf += snprintf(buf + sf, mxln - sf, "PS_NULLFUNC_STACK\n");
328 if (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS)
329 sf += snprintf(buf + sf, mxln - sf, "SUPPORTS_DYNAMIC_PS\n");
330 if (local->hw.flags & IEEE80211_HW_MFP_CAPABLE)
331 sf += snprintf(buf + sf, mxln - sf, "MFP_CAPABLE\n");
332 if (local->hw.flags & IEEE80211_HW_BEACON_FILTER)
333 sf += snprintf(buf + sf, mxln - sf, "BEACON_FILTER\n");
334 if (local->hw.flags & IEEE80211_HW_SUPPORTS_STATIC_SMPS)
335 sf += snprintf(buf + sf, mxln - sf, "SUPPORTS_STATIC_SMPS\n");
336 if (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS)
337 sf += snprintf(buf + sf, mxln - sf, "SUPPORTS_DYNAMIC_SMPS\n");
338 if (local->hw.flags & IEEE80211_HW_SUPPORTS_UAPSD)
339 sf += snprintf(buf + sf, mxln - sf, "SUPPORTS_UAPSD\n");
340 if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS)
341 sf += snprintf(buf + sf, mxln - sf, "REPORTS_TX_ACK_STATUS\n");
342 if (local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR)
343 sf += snprintf(buf + sf, mxln - sf, "CONNECTION_MONITOR\n");
344 if (local->hw.flags & IEEE80211_HW_SUPPORTS_CQM_RSSI)
345 sf += snprintf(buf + sf, mxln - sf, "SUPPORTS_CQM_RSSI\n");
346 if (local->hw.flags & IEEE80211_HW_SUPPORTS_PER_STA_GTK)
347 sf += snprintf(buf + sf, mxln - sf, "SUPPORTS_PER_STA_GTK\n");
348 if (local->hw.flags & IEEE80211_HW_AP_LINK_PS)
349 sf += snprintf(buf + sf, mxln - sf, "AP_LINK_PS\n");
350
351 rv = simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));
352 kfree(buf);
353 return rv;
354}
Benoit Papillault199d69f2010-02-04 22:00:20 +0100355
Johannes Bergdb2e6bd2009-06-14 17:37:39 +0200356static ssize_t queues_read(struct file *file, char __user *user_buf,
357 size_t count, loff_t *ppos)
358{
359 struct ieee80211_local *local = file->private_data;
360 unsigned long flags;
361 char buf[IEEE80211_MAX_QUEUES * 20];
362 int q, res = 0;
363
364 spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
365 for (q = 0; q < local->hw.queues; q++)
366 res += sprintf(buf + res, "%02d: %#.8lx/%d\n", q,
367 local->queue_stop_reasons[q],
Johannes Berg3b8d81e2009-06-17 17:43:56 +0200368 skb_queue_len(&local->pending[q]));
Johannes Bergdb2e6bd2009-06-14 17:37:39 +0200369 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
370
371 return simple_read_from_buffer(user_buf, count, ppos, buf, res);
372}
373
Ben Greear279daf62011-03-23 14:04:31 -0700374DEBUGFS_READONLY_FILE_OPS(hwflags);
375DEBUGFS_READONLY_FILE_OPS(channel_type);
376DEBUGFS_READONLY_FILE_OPS(queues);
Johannes Bergdb2e6bd2009-06-14 17:37:39 +0200377
Jiri Bence9f207f2007-05-05 11:46:38 -0700378/* statistics stuff */
379
Jiri Bence9f207f2007-05-05 11:46:38 -0700380static ssize_t format_devstat_counter(struct ieee80211_local *local,
381 char __user *userbuf,
382 size_t count, loff_t *ppos,
383 int (*printvalue)(struct ieee80211_low_level_stats *stats, char *buf,
384 int buflen))
385{
386 struct ieee80211_low_level_stats stats;
387 char buf[20];
388 int res;
389
Johannes Berg75636522008-07-09 14:40:35 +0200390 rtnl_lock();
Johannes Berg24487982009-04-23 18:52:52 +0200391 res = drv_get_stats(local, &stats);
Jiri Bence9f207f2007-05-05 11:46:38 -0700392 rtnl_unlock();
Johannes Berg24487982009-04-23 18:52:52 +0200393 if (res)
394 return res;
395 res = printvalue(&stats, buf, sizeof(buf));
Jiri Bence9f207f2007-05-05 11:46:38 -0700396 return simple_read_from_buffer(userbuf, count, ppos, buf, res);
397}
398
399#define DEBUGFS_DEVSTATS_FILE(name) \
400static int print_devstats_##name(struct ieee80211_low_level_stats *stats,\
401 char *buf, int buflen) \
402{ \
403 return scnprintf(buf, buflen, "%u\n", stats->name); \
404} \
405static ssize_t stats_ ##name## _read(struct file *file, \
406 char __user *userbuf, \
407 size_t count, loff_t *ppos) \
408{ \
409 return format_devstat_counter(file->private_data, \
410 userbuf, \
411 count, \
412 ppos, \
413 print_devstats_##name); \
414} \
415 \
416static const struct file_operations stats_ ##name## _ops = { \
417 .read = stats_ ##name## _read, \
418 .open = mac80211_open_file_generic, \
Arnd Bergmann2b18ab32010-07-06 19:05:31 +0200419 .llseek = generic_file_llseek, \
Jiri Bence9f207f2007-05-05 11:46:38 -0700420};
421
Felix Fietkau2826bcd2010-06-02 02:57:34 +0200422#define DEBUGFS_STATS_ADD(name, field) \
423 debugfs_create_u32(#name, 0400, statsd, (u32 *) &field);
424#define DEBUGFS_DEVSTATS_ADD(name) \
Johannes Berg7bcfaf22009-10-27 12:59:03 +0100425 debugfs_create_file(#name, 0400, statsd, local, &stats_ ##name## _ops);
Jiri Bence9f207f2007-05-05 11:46:38 -0700426
Jiri Bence9f207f2007-05-05 11:46:38 -0700427DEBUGFS_DEVSTATS_FILE(dot11ACKFailureCount);
428DEBUGFS_DEVSTATS_FILE(dot11RTSFailureCount);
429DEBUGFS_DEVSTATS_FILE(dot11FCSErrorCount);
430DEBUGFS_DEVSTATS_FILE(dot11RTSSuccessCount);
431
Jiri Bence9f207f2007-05-05 11:46:38 -0700432void debugfs_hw_add(struct ieee80211_local *local)
433{
434 struct dentry *phyd = local->hw.wiphy->debugfsdir;
435 struct dentry *statsd;
436
437 if (!phyd)
438 return;
439
Jiri Bence9f207f2007-05-05 11:46:38 -0700440 local->debugfs.keys = debugfs_create_dir("keys", phyd);
441
Jiri Bence9f207f2007-05-05 11:46:38 -0700442 DEBUGFS_ADD(frequency);
Jiri Bence9f207f2007-05-05 11:46:38 -0700443 DEBUGFS_ADD(total_ps_buffered);
Jiri Bence9f207f2007-05-05 11:46:38 -0700444 DEBUGFS_ADD(wep_iv);
Alina Friedrichsenae54c982009-01-23 05:33:37 +0100445 DEBUGFS_ADD(tsf);
Johannes Bergdb2e6bd2009-06-14 17:37:39 +0200446 DEBUGFS_ADD(queues);
Johannes Berg827b1fb2009-03-13 11:44:18 +0100447 DEBUGFS_ADD_MODE(reset, 0200);
Johannes Bergd3707d92009-05-12 22:05:40 +0200448 DEBUGFS_ADD(noack);
Kalle Valo50ae0cf2010-01-12 10:42:39 +0200449 DEBUGFS_ADD(uapsd_queues);
450 DEBUGFS_ADD(uapsd_max_sp_len);
Benoit Papillault199d69f2010-02-04 22:00:20 +0100451 DEBUGFS_ADD(channel_type);
Ben Greear279daf62011-03-23 14:04:31 -0700452 DEBUGFS_ADD(hwflags);
Ben Greear83bdf2a2011-02-15 13:11:22 -0800453 DEBUGFS_ADD(user_power);
454 DEBUGFS_ADD(power);
Jiri Bence9f207f2007-05-05 11:46:38 -0700455
456 statsd = debugfs_create_dir("statistics", phyd);
Jiri Bence9f207f2007-05-05 11:46:38 -0700457
458 /* if the dir failed, don't put all the other things into the root! */
459 if (!statsd)
460 return;
461
Felix Fietkau2826bcd2010-06-02 02:57:34 +0200462 DEBUGFS_STATS_ADD(transmitted_fragment_count,
463 local->dot11TransmittedFragmentCount);
464 DEBUGFS_STATS_ADD(multicast_transmitted_frame_count,
465 local->dot11MulticastTransmittedFrameCount);
466 DEBUGFS_STATS_ADD(failed_count, local->dot11FailedCount);
467 DEBUGFS_STATS_ADD(retry_count, local->dot11RetryCount);
468 DEBUGFS_STATS_ADD(multiple_retry_count,
469 local->dot11MultipleRetryCount);
470 DEBUGFS_STATS_ADD(frame_duplicate_count,
471 local->dot11FrameDuplicateCount);
472 DEBUGFS_STATS_ADD(received_fragment_count,
473 local->dot11ReceivedFragmentCount);
474 DEBUGFS_STATS_ADD(multicast_received_frame_count,
475 local->dot11MulticastReceivedFrameCount);
476 DEBUGFS_STATS_ADD(transmitted_frame_count,
477 local->dot11TransmittedFrameCount);
Jiri Bence9f207f2007-05-05 11:46:38 -0700478#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
Felix Fietkau2826bcd2010-06-02 02:57:34 +0200479 DEBUGFS_STATS_ADD(tx_handlers_drop, local->tx_handlers_drop);
480 DEBUGFS_STATS_ADD(tx_handlers_queued, local->tx_handlers_queued);
481 DEBUGFS_STATS_ADD(tx_handlers_drop_unencrypted,
482 local->tx_handlers_drop_unencrypted);
483 DEBUGFS_STATS_ADD(tx_handlers_drop_fragment,
484 local->tx_handlers_drop_fragment);
485 DEBUGFS_STATS_ADD(tx_handlers_drop_wep,
486 local->tx_handlers_drop_wep);
487 DEBUGFS_STATS_ADD(tx_handlers_drop_not_assoc,
488 local->tx_handlers_drop_not_assoc);
489 DEBUGFS_STATS_ADD(tx_handlers_drop_unauth_port,
490 local->tx_handlers_drop_unauth_port);
491 DEBUGFS_STATS_ADD(rx_handlers_drop, local->rx_handlers_drop);
492 DEBUGFS_STATS_ADD(rx_handlers_queued, local->rx_handlers_queued);
493 DEBUGFS_STATS_ADD(rx_handlers_drop_nullfunc,
494 local->rx_handlers_drop_nullfunc);
495 DEBUGFS_STATS_ADD(rx_handlers_drop_defrag,
496 local->rx_handlers_drop_defrag);
497 DEBUGFS_STATS_ADD(rx_handlers_drop_short,
498 local->rx_handlers_drop_short);
499 DEBUGFS_STATS_ADD(rx_handlers_drop_passive_scan,
500 local->rx_handlers_drop_passive_scan);
501 DEBUGFS_STATS_ADD(tx_expand_skb_head,
502 local->tx_expand_skb_head);
503 DEBUGFS_STATS_ADD(tx_expand_skb_head_cloned,
504 local->tx_expand_skb_head_cloned);
505 DEBUGFS_STATS_ADD(rx_expand_skb_head,
506 local->rx_expand_skb_head);
507 DEBUGFS_STATS_ADD(rx_expand_skb_head2,
508 local->rx_expand_skb_head2);
509 DEBUGFS_STATS_ADD(rx_handlers_fragments,
510 local->rx_handlers_fragments);
511 DEBUGFS_STATS_ADD(tx_status_drop,
512 local->tx_status_drop);
Jiri Bence9f207f2007-05-05 11:46:38 -0700513#endif
Felix Fietkau2826bcd2010-06-02 02:57:34 +0200514 DEBUGFS_DEVSTATS_ADD(dot11ACKFailureCount);
515 DEBUGFS_DEVSTATS_ADD(dot11RTSFailureCount);
516 DEBUGFS_DEVSTATS_ADD(dot11FCSErrorCount);
517 DEBUGFS_DEVSTATS_ADD(dot11RTSSuccessCount);
Jiri Bence9f207f2007-05-05 11:46:38 -0700518}