diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/debugfs.c | 16 | ||||
-rw-r--r-- | net/mac80211/ieee80211_i.h | 4 | ||||
-rw-r--r-- | net/wireless/Kconfig | 8 | ||||
-rw-r--r-- | net/wireless/Makefile | 1 | ||||
-rw-r--r-- | net/wireless/core.c | 5 | ||||
-rw-r--r-- | net/wireless/core.h | 11 | ||||
-rw-r--r-- | net/wireless/debugfs.c | 70 | ||||
-rw-r--r-- | net/wireless/debugfs.h | 14 |
8 files changed, 109 insertions, 20 deletions
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c index e7682fe1c590..11c72311f35b 100644 --- a/net/mac80211/debugfs.c +++ b/net/mac80211/debugfs.c | |||
@@ -52,14 +52,6 @@ static const struct file_operations name## _ops = { \ | |||
52 | 52 | ||
53 | DEBUGFS_READONLY_FILE(frequency, 20, "%d", | 53 | DEBUGFS_READONLY_FILE(frequency, 20, "%d", |
54 | local->hw.conf.channel->center_freq); | 54 | local->hw.conf.channel->center_freq); |
55 | DEBUGFS_READONLY_FILE(rts_threshold, 20, "%d", | ||
56 | local->hw.wiphy->rts_threshold); | ||
57 | DEBUGFS_READONLY_FILE(fragmentation_threshold, 20, "%d", | ||
58 | local->hw.wiphy->frag_threshold); | ||
59 | DEBUGFS_READONLY_FILE(short_retry_limit, 20, "%d", | ||
60 | local->hw.wiphy->retry_short); | ||
61 | DEBUGFS_READONLY_FILE(long_retry_limit, 20, "%d", | ||
62 | local->hw.wiphy->retry_long); | ||
63 | DEBUGFS_READONLY_FILE(total_ps_buffered, 20, "%d", | 55 | DEBUGFS_READONLY_FILE(total_ps_buffered, 20, "%d", |
64 | local->total_ps_buffered); | 56 | local->total_ps_buffered); |
65 | DEBUGFS_READONLY_FILE(wep_iv, 20, "%#08x", | 57 | DEBUGFS_READONLY_FILE(wep_iv, 20, "%#08x", |
@@ -303,10 +295,6 @@ void debugfs_hw_add(struct ieee80211_local *local) | |||
303 | local->debugfs.keys = debugfs_create_dir("keys", phyd); | 295 | local->debugfs.keys = debugfs_create_dir("keys", phyd); |
304 | 296 | ||
305 | DEBUGFS_ADD(frequency); | 297 | DEBUGFS_ADD(frequency); |
306 | DEBUGFS_ADD(rts_threshold); | ||
307 | DEBUGFS_ADD(fragmentation_threshold); | ||
308 | DEBUGFS_ADD(short_retry_limit); | ||
309 | DEBUGFS_ADD(long_retry_limit); | ||
310 | DEBUGFS_ADD(total_ps_buffered); | 298 | DEBUGFS_ADD(total_ps_buffered); |
311 | DEBUGFS_ADD(wep_iv); | 299 | DEBUGFS_ADD(wep_iv); |
312 | DEBUGFS_ADD(tsf); | 300 | DEBUGFS_ADD(tsf); |
@@ -359,10 +347,6 @@ void debugfs_hw_add(struct ieee80211_local *local) | |||
359 | void debugfs_hw_del(struct ieee80211_local *local) | 347 | void debugfs_hw_del(struct ieee80211_local *local) |
360 | { | 348 | { |
361 | DEBUGFS_DEL(frequency); | 349 | DEBUGFS_DEL(frequency); |
362 | DEBUGFS_DEL(rts_threshold); | ||
363 | DEBUGFS_DEL(fragmentation_threshold); | ||
364 | DEBUGFS_DEL(short_retry_limit); | ||
365 | DEBUGFS_DEL(long_retry_limit); | ||
366 | DEBUGFS_DEL(total_ps_buffered); | 350 | DEBUGFS_DEL(total_ps_buffered); |
367 | DEBUGFS_DEL(wep_iv); | 351 | DEBUGFS_DEL(wep_iv); |
368 | DEBUGFS_DEL(tsf); | 352 | DEBUGFS_DEL(tsf); |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 9d1514727f6e..3241e76eece7 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -758,10 +758,6 @@ struct ieee80211_local { | |||
758 | struct dentry *rcdir; | 758 | struct dentry *rcdir; |
759 | struct dentry *rcname; | 759 | struct dentry *rcname; |
760 | struct dentry *frequency; | 760 | struct dentry *frequency; |
761 | struct dentry *rts_threshold; | ||
762 | struct dentry *fragmentation_threshold; | ||
763 | struct dentry *short_retry_limit; | ||
764 | struct dentry *long_retry_limit; | ||
765 | struct dentry *total_ps_buffered; | 761 | struct dentry *total_ps_buffered; |
766 | struct dentry *wep_iv; | 762 | struct dentry *wep_iv; |
767 | struct dentry *tsf; | 763 | struct dentry *tsf; |
diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig index 3c3bc9e579ed..45005497c634 100644 --- a/net/wireless/Kconfig +++ b/net/wireless/Kconfig | |||
@@ -10,6 +10,14 @@ config CFG80211_REG_DEBUG | |||
10 | 10 | ||
11 | If unsure, say N. | 11 | If unsure, say N. |
12 | 12 | ||
13 | config CFG80211_DEBUGFS | ||
14 | bool "cfg80211 DebugFS entries" | ||
15 | depends on CFG80211 && DEBUG_FS | ||
16 | ---help--- | ||
17 | You can enable this if you want to debugfs entries for cfg80211. | ||
18 | |||
19 | If unsure, say N. | ||
20 | |||
13 | config WIRELESS_OLD_REGULATORY | 21 | config WIRELESS_OLD_REGULATORY |
14 | bool "Old wireless static regulatory definitions" | 22 | bool "Old wireless static regulatory definitions" |
15 | default n | 23 | default n |
diff --git a/net/wireless/Makefile b/net/wireless/Makefile index 14ea01c4a103..f78c4832a9ca 100644 --- a/net/wireless/Makefile +++ b/net/wireless/Makefile | |||
@@ -6,6 +6,7 @@ obj-$(CONFIG_LIB80211_CRYPT_CCMP) += lib80211_crypt_ccmp.o | |||
6 | obj-$(CONFIG_LIB80211_CRYPT_TKIP) += lib80211_crypt_tkip.o | 6 | obj-$(CONFIG_LIB80211_CRYPT_TKIP) += lib80211_crypt_tkip.o |
7 | 7 | ||
8 | cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o mlme.o ibss.o | 8 | cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o mlme.o ibss.o |
9 | cfg80211-$(CONFIG_CFG80211_DEBUGFS) += debugfs.o | ||
9 | cfg80211-$(CONFIG_WIRELESS_EXT) += wext-compat.o | 10 | cfg80211-$(CONFIG_WIRELESS_EXT) += wext-compat.o |
10 | 11 | ||
11 | ccflags-y += -D__CHECK_ENDIAN__ | 12 | ccflags-y += -D__CHECK_ENDIAN__ |
diff --git a/net/wireless/core.c b/net/wireless/core.c index 47c20eb0c04d..b6ef5337c85f 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include "nl80211.h" | 17 | #include "nl80211.h" |
18 | #include "core.h" | 18 | #include "core.h" |
19 | #include "sysfs.h" | 19 | #include "sysfs.h" |
20 | #include "debugfs.h" | ||
20 | 21 | ||
21 | /* name for sysfs, %d is appended */ | 22 | /* name for sysfs, %d is appended */ |
22 | #define PHY_NAME "phy" | 23 | #define PHY_NAME "phy" |
@@ -375,6 +376,8 @@ int wiphy_register(struct wiphy *wiphy) | |||
375 | nl80211_send_reg_change_event(&request); | 376 | nl80211_send_reg_change_event(&request); |
376 | } | 377 | } |
377 | 378 | ||
379 | cfg80211_debugfs_drv_add(drv); | ||
380 | |||
378 | res = 0; | 381 | res = 0; |
379 | out_unlock: | 382 | out_unlock: |
380 | mutex_unlock(&cfg80211_mutex); | 383 | mutex_unlock(&cfg80211_mutex); |
@@ -405,6 +408,8 @@ void wiphy_unregister(struct wiphy *wiphy) | |||
405 | /* unlock again before freeing */ | 408 | /* unlock again before freeing */ |
406 | mutex_unlock(&drv->mtx); | 409 | mutex_unlock(&drv->mtx); |
407 | 410 | ||
411 | cfg80211_debugfs_drv_del(drv); | ||
412 | |||
408 | /* If this device got a regulatory hint tell core its | 413 | /* If this device got a regulatory hint tell core its |
409 | * free to listen now to a new shiny device regulatory hint */ | 414 | * free to listen now to a new shiny device regulatory hint */ |
410 | reg_device_remove(wiphy); | 415 | reg_device_remove(wiphy); |
diff --git a/net/wireless/core.h b/net/wireless/core.h index f14b6c5f4221..930a80124dbf 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/netdevice.h> | 10 | #include <linux/netdevice.h> |
11 | #include <linux/kref.h> | 11 | #include <linux/kref.h> |
12 | #include <linux/rbtree.h> | 12 | #include <linux/rbtree.h> |
13 | #include <linux/debugfs.h> | ||
13 | #include <net/genetlink.h> | 14 | #include <net/genetlink.h> |
14 | #include <net/cfg80211.h> | 15 | #include <net/cfg80211.h> |
15 | #include "reg.h" | 16 | #include "reg.h" |
@@ -50,6 +51,16 @@ struct cfg80211_registered_device { | |||
50 | struct cfg80211_scan_request *scan_req; /* protected by RTNL */ | 51 | struct cfg80211_scan_request *scan_req; /* protected by RTNL */ |
51 | unsigned long suspend_at; | 52 | unsigned long suspend_at; |
52 | 53 | ||
54 | #ifdef CONFIG_MAC80211_DEBUGFS | ||
55 | /* Debugfs entries */ | ||
56 | struct wiphy_debugfsdentries { | ||
57 | struct dentry *rts_threshold; | ||
58 | struct dentry *fragmentation_threshold; | ||
59 | struct dentry *short_retry_limit; | ||
60 | struct dentry *long_retry_limit; | ||
61 | } debugfs; | ||
62 | #endif | ||
63 | |||
53 | /* must be last because of the way we do wiphy_priv(), | 64 | /* must be last because of the way we do wiphy_priv(), |
54 | * and it should at least be aligned to NETDEV_ALIGN */ | 65 | * and it should at least be aligned to NETDEV_ALIGN */ |
55 | struct wiphy wiphy __attribute__((__aligned__(NETDEV_ALIGN))); | 66 | struct wiphy wiphy __attribute__((__aligned__(NETDEV_ALIGN))); |
diff --git a/net/wireless/debugfs.c b/net/wireless/debugfs.c new file mode 100644 index 000000000000..3211e0e9fe4c --- /dev/null +++ b/net/wireless/debugfs.c | |||
@@ -0,0 +1,70 @@ | |||
1 | /* | ||
2 | * cfg80211 debugfs | ||
3 | * | ||
4 | * Copyright 2009 Luis R. Rodriguez <lrodriguez@atheros.com> | ||
5 | * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include "core.h" | ||
13 | #include "debugfs.h" | ||
14 | |||
15 | static int cfg80211_open_file_generic(struct inode *inode, struct file *file) | ||
16 | { | ||
17 | file->private_data = inode->i_private; | ||
18 | return 0; | ||
19 | } | ||
20 | |||
21 | #define DEBUGFS_READONLY_FILE(name, buflen, fmt, value...) \ | ||
22 | static ssize_t name## _read(struct file *file, char __user *userbuf, \ | ||
23 | size_t count, loff_t *ppos) \ | ||
24 | { \ | ||
25 | struct wiphy *wiphy= file->private_data; \ | ||
26 | char buf[buflen]; \ | ||
27 | int res; \ | ||
28 | \ | ||
29 | res = scnprintf(buf, buflen, fmt "\n", ##value); \ | ||
30 | return simple_read_from_buffer(userbuf, count, ppos, buf, res); \ | ||
31 | } \ | ||
32 | \ | ||
33 | static const struct file_operations name## _ops = { \ | ||
34 | .read = name## _read, \ | ||
35 | .open = cfg80211_open_file_generic, \ | ||
36 | }; | ||
37 | |||
38 | DEBUGFS_READONLY_FILE(rts_threshold, 20, "%d", | ||
39 | wiphy->rts_threshold) | ||
40 | DEBUGFS_READONLY_FILE(fragmentation_threshold, 20, "%d", | ||
41 | wiphy->frag_threshold); | ||
42 | DEBUGFS_READONLY_FILE(short_retry_limit, 20, "%d", | ||
43 | wiphy->retry_short) | ||
44 | DEBUGFS_READONLY_FILE(long_retry_limit, 20, "%d", | ||
45 | wiphy->retry_long); | ||
46 | |||
47 | #define DEBUGFS_ADD(name) \ | ||
48 | drv->debugfs.name = debugfs_create_file(#name, S_IRUGO, phyd, \ | ||
49 | &drv->wiphy, &name## _ops); | ||
50 | #define DEBUGFS_DEL(name) \ | ||
51 | debugfs_remove(drv->debugfs.name); \ | ||
52 | drv->debugfs.name = NULL; | ||
53 | |||
54 | void cfg80211_debugfs_drv_add(struct cfg80211_registered_device *drv) | ||
55 | { | ||
56 | struct dentry *phyd = drv->wiphy.debugfsdir; | ||
57 | |||
58 | DEBUGFS_ADD(rts_threshold); | ||
59 | DEBUGFS_ADD(fragmentation_threshold); | ||
60 | DEBUGFS_ADD(short_retry_limit); | ||
61 | DEBUGFS_ADD(long_retry_limit); | ||
62 | } | ||
63 | |||
64 | void cfg80211_debugfs_drv_del(struct cfg80211_registered_device *drv) | ||
65 | { | ||
66 | DEBUGFS_DEL(rts_threshold); | ||
67 | DEBUGFS_DEL(fragmentation_threshold); | ||
68 | DEBUGFS_DEL(short_retry_limit); | ||
69 | DEBUGFS_DEL(long_retry_limit); | ||
70 | } | ||
diff --git a/net/wireless/debugfs.h b/net/wireless/debugfs.h new file mode 100644 index 000000000000..c226983ae66b --- /dev/null +++ b/net/wireless/debugfs.h | |||
@@ -0,0 +1,14 @@ | |||
1 | #ifndef __CFG80211_DEBUGFS_H | ||
2 | #define __CFG80211_DEBUGFS_H | ||
3 | |||
4 | #ifdef CONFIG_CFG80211_DEBUGFS | ||
5 | void cfg80211_debugfs_drv_add(struct cfg80211_registered_device *drv); | ||
6 | void cfg80211_debugfs_drv_del(struct cfg80211_registered_device *drv); | ||
7 | #else | ||
8 | static inline | ||
9 | void cfg80211_debugfs_drv_add(struct cfg80211_registered_device *drv) {} | ||
10 | static inline | ||
11 | void cfg80211_debugfs_drv_del(struct cfg80211_registered_device *drv) {} | ||
12 | #endif | ||
13 | |||
14 | #endif /* __CFG80211_DEBUGFS_H */ | ||