forked from luck/tmp_suning_uos_patched
00f5931411
This patch introduces register and unregister functionality for lowpan interfaces. While register a lowpan interface there are several things which need to be initialize by the 6lowpan subsystem. Upcoming functionality need to register/unregister per interface components e.g. debugfs entry. 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>
75 lines
1.8 KiB
C
75 lines
1.8 KiB
C
/* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2
|
|
* as published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* Authors:
|
|
* (C) 2015 Pengutronix, Alexander Aring <aar@pengutronix.de>
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <net/6lowpan.h>
|
|
|
|
int lowpan_register_netdevice(struct net_device *dev,
|
|
enum lowpan_lltypes lltype)
|
|
{
|
|
dev->addr_len = EUI64_ADDR_LEN;
|
|
dev->type = ARPHRD_6LOWPAN;
|
|
dev->mtu = IPV6_MIN_MTU;
|
|
dev->priv_flags |= IFF_NO_QUEUE;
|
|
|
|
lowpan_priv(dev)->lltype = lltype;
|
|
|
|
return register_netdevice(dev);
|
|
}
|
|
EXPORT_SYMBOL(lowpan_register_netdevice);
|
|
|
|
int lowpan_register_netdev(struct net_device *dev,
|
|
enum lowpan_lltypes lltype)
|
|
{
|
|
int ret;
|
|
|
|
rtnl_lock();
|
|
ret = lowpan_register_netdevice(dev, lltype);
|
|
rtnl_unlock();
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL(lowpan_register_netdev);
|
|
|
|
void lowpan_unregister_netdevice(struct net_device *dev)
|
|
{
|
|
unregister_netdevice(dev);
|
|
}
|
|
EXPORT_SYMBOL(lowpan_unregister_netdevice);
|
|
|
|
void lowpan_unregister_netdev(struct net_device *dev)
|
|
{
|
|
rtnl_lock();
|
|
lowpan_unregister_netdevice(dev);
|
|
rtnl_unlock();
|
|
}
|
|
EXPORT_SYMBOL(lowpan_unregister_netdev);
|
|
|
|
static int __init lowpan_module_init(void)
|
|
{
|
|
request_module_nowait("ipv6");
|
|
|
|
request_module_nowait("nhc_dest");
|
|
request_module_nowait("nhc_fragment");
|
|
request_module_nowait("nhc_hop");
|
|
request_module_nowait("nhc_ipv6");
|
|
request_module_nowait("nhc_mobility");
|
|
request_module_nowait("nhc_routing");
|
|
request_module_nowait("nhc_udp");
|
|
|
|
return 0;
|
|
}
|
|
module_init(lowpan_module_init);
|
|
|
|
MODULE_LICENSE("GPL");
|