diff options
author | Alexander Aring <alex.aring@gmail.com> | 2015-12-09 16:46:30 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-12-09 19:25:25 -0500 |
commit | b1815fd949e5bd06d118019acf68f87c9414f705 (patch) | |
tree | 5c3964d3a3020cbc75a1184834af8a0cda56a90e /net/6lowpan/core.c | |
parent | 00f59314111a6b18ee65b238b38c470dbdbf3be5 (diff) |
6lowpan: add debugfs support
This patch will introduce a 6lowpan entry into the debugfs if enabled.
Inside this 6lowpan directory we create a subdirectories of all 6lowpan
interfaces to offer a per interface debugfs support.
Reviewed-by: Stefan Schmidt <stefan@osg.samsung.com>
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/6lowpan/core.c')
-rw-r--r-- | net/6lowpan/core.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/net/6lowpan/core.c b/net/6lowpan/core.c index 80fc50987cf3..c7f06f5c0121 100644 --- a/net/6lowpan/core.c +++ b/net/6lowpan/core.c | |||
@@ -15,9 +15,13 @@ | |||
15 | 15 | ||
16 | #include <net/6lowpan.h> | 16 | #include <net/6lowpan.h> |
17 | 17 | ||
18 | #include "6lowpan_i.h" | ||
19 | |||
18 | int lowpan_register_netdevice(struct net_device *dev, | 20 | int lowpan_register_netdevice(struct net_device *dev, |
19 | enum lowpan_lltypes lltype) | 21 | enum lowpan_lltypes lltype) |
20 | { | 22 | { |
23 | int ret; | ||
24 | |||
21 | dev->addr_len = EUI64_ADDR_LEN; | 25 | dev->addr_len = EUI64_ADDR_LEN; |
22 | dev->type = ARPHRD_6LOWPAN; | 26 | dev->type = ARPHRD_6LOWPAN; |
23 | dev->mtu = IPV6_MIN_MTU; | 27 | dev->mtu = IPV6_MIN_MTU; |
@@ -25,7 +29,15 @@ int lowpan_register_netdevice(struct net_device *dev, | |||
25 | 29 | ||
26 | lowpan_priv(dev)->lltype = lltype; | 30 | lowpan_priv(dev)->lltype = lltype; |
27 | 31 | ||
28 | return register_netdevice(dev); | 32 | ret = lowpan_dev_debugfs_init(dev); |
33 | if (ret < 0) | ||
34 | return ret; | ||
35 | |||
36 | ret = register_netdevice(dev); | ||
37 | if (ret < 0) | ||
38 | lowpan_dev_debugfs_exit(dev); | ||
39 | |||
40 | return ret; | ||
29 | } | 41 | } |
30 | EXPORT_SYMBOL(lowpan_register_netdevice); | 42 | EXPORT_SYMBOL(lowpan_register_netdevice); |
31 | 43 | ||
@@ -44,6 +56,7 @@ EXPORT_SYMBOL(lowpan_register_netdev); | |||
44 | void lowpan_unregister_netdevice(struct net_device *dev) | 56 | void lowpan_unregister_netdevice(struct net_device *dev) |
45 | { | 57 | { |
46 | unregister_netdevice(dev); | 58 | unregister_netdevice(dev); |
59 | lowpan_dev_debugfs_exit(dev); | ||
47 | } | 60 | } |
48 | EXPORT_SYMBOL(lowpan_unregister_netdevice); | 61 | EXPORT_SYMBOL(lowpan_unregister_netdevice); |
49 | 62 | ||
@@ -57,6 +70,12 @@ EXPORT_SYMBOL(lowpan_unregister_netdev); | |||
57 | 70 | ||
58 | static int __init lowpan_module_init(void) | 71 | static int __init lowpan_module_init(void) |
59 | { | 72 | { |
73 | int ret; | ||
74 | |||
75 | ret = lowpan_debugfs_init(); | ||
76 | if (ret < 0) | ||
77 | return ret; | ||
78 | |||
60 | request_module_nowait("ipv6"); | 79 | request_module_nowait("ipv6"); |
61 | 80 | ||
62 | request_module_nowait("nhc_dest"); | 81 | request_module_nowait("nhc_dest"); |
@@ -69,6 +88,13 @@ static int __init lowpan_module_init(void) | |||
69 | 88 | ||
70 | return 0; | 89 | return 0; |
71 | } | 90 | } |
91 | |||
92 | static void __exit lowpan_module_exit(void) | ||
93 | { | ||
94 | lowpan_debugfs_exit(); | ||
95 | } | ||
96 | |||
72 | module_init(lowpan_module_init); | 97 | module_init(lowpan_module_init); |
98 | module_exit(lowpan_module_exit); | ||
73 | 99 | ||
74 | MODULE_LICENSE("GPL"); | 100 | MODULE_LICENSE("GPL"); |