diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-05-02 00:37:21 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-05-20 14:46:23 -0400 |
commit | 1ac61302dcd18880e28c29e5728cd4d0efeb5366 (patch) | |
tree | 2fa7f137b67df3f966408b016745083cae7cdefa /net/wireless | |
parent | 294196ab22c91da974ba1f40d0a7cdcb0b3e6bc3 (diff) |
mac80211/cfg80211: move wiphy specific debugfs entries to cfg80211
This moves the cfg80211 specific stuff to new cfg80211 debugfs
entries. Non-mac80211 will also get these entries now. There were
only 4 which we take:
rts_threshold
fragmentation_threshold
short_retry_limit
long_retry_limit
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless')
-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 |
6 files changed, 109 insertions, 0 deletions
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 */ | ||