summaryrefslogtreecommitdiffstats
path: root/net/6lowpan/core.c
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2015-12-09 22:46:30 +0100
committerMarcel Holtmann <marcel@holtmann.org>2015-12-10 01:25:25 +0100
commitb1815fd949e5bd06d118019acf68f87c9414f705 (patch)
tree5c3964d3a3020cbc75a1184834af8a0cda56a90e /net/6lowpan/core.c
parent00f59314111a6b18ee65b238b38c470dbdbf3be5 (diff)
downloadlinux-b1815fd949e5bd06d118019acf68f87c9414f705.tar.bz2
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.c28
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 @@
#include <net/6lowpan.h>
+#include "6lowpan_i.h"
+
int lowpan_register_netdevice(struct net_device *dev,
enum lowpan_lltypes lltype)
{
+ int ret;
+
dev->addr_len = EUI64_ADDR_LEN;
dev->type = ARPHRD_6LOWPAN;
dev->mtu = IPV6_MIN_MTU;
@@ -25,7 +29,15 @@ int lowpan_register_netdevice(struct net_device *dev,
lowpan_priv(dev)->lltype = lltype;
- return register_netdevice(dev);
+ ret = lowpan_dev_debugfs_init(dev);
+ if (ret < 0)
+ return ret;
+
+ ret = register_netdevice(dev);
+ if (ret < 0)
+ lowpan_dev_debugfs_exit(dev);
+
+ return ret;
}
EXPORT_SYMBOL(lowpan_register_netdevice);
@@ -44,6 +56,7 @@ EXPORT_SYMBOL(lowpan_register_netdev);
void lowpan_unregister_netdevice(struct net_device *dev)
{
unregister_netdevice(dev);
+ lowpan_dev_debugfs_exit(dev);
}
EXPORT_SYMBOL(lowpan_unregister_netdevice);
@@ -57,6 +70,12 @@ EXPORT_SYMBOL(lowpan_unregister_netdev);
static int __init lowpan_module_init(void)
{
+ int ret;
+
+ ret = lowpan_debugfs_init();
+ if (ret < 0)
+ return ret;
+
request_module_nowait("ipv6");
request_module_nowait("nhc_dest");
@@ -69,6 +88,13 @@ static int __init lowpan_module_init(void)
return 0;
}
+
+static void __exit lowpan_module_exit(void)
+{
+ lowpan_debugfs_exit();
+}
+
module_init(lowpan_module_init);
+module_exit(lowpan_module_exit);
MODULE_LICENSE("GPL");