]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - net/6lowpan/core.c
6lowpan: add lowpan dev register helpers
[mirror_ubuntu-bionic-kernel.git] / net / 6lowpan / core.c
CommitLineData
b72f6f51
AA
1/* This program is free software; you can redistribute it and/or modify
2 * it under the terms of the GNU General Public License version 2
3 * as published by the Free Software Foundation.
4 *
5 * This program is distributed in the hope that it will be useful,
6 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 * GNU General Public License for more details.
9 *
10 * Authors:
11 * (C) 2015 Pengutronix, Alexander Aring <aar@pengutronix.de>
12 */
13
4ae935c1
AA
14#include <linux/module.h>
15
b72f6f51
AA
16#include <net/6lowpan.h>
17
00f59314
AA
18int lowpan_register_netdevice(struct net_device *dev,
19 enum lowpan_lltypes lltype)
b72f6f51 20{
4d6a6aed
AA
21 dev->addr_len = EUI64_ADDR_LEN;
22 dev->type = ARPHRD_6LOWPAN;
23 dev->mtu = IPV6_MIN_MTU;
24 dev->priv_flags |= IFF_NO_QUEUE;
25
b72f6f51 26 lowpan_priv(dev)->lltype = lltype;
00f59314
AA
27
28 return register_netdevice(dev);
29}
30EXPORT_SYMBOL(lowpan_register_netdevice);
31
32int lowpan_register_netdev(struct net_device *dev,
33 enum lowpan_lltypes lltype)
34{
35 int ret;
36
37 rtnl_lock();
38 ret = lowpan_register_netdevice(dev, lltype);
39 rtnl_unlock();
40 return ret;
41}
42EXPORT_SYMBOL(lowpan_register_netdev);
43
44void lowpan_unregister_netdevice(struct net_device *dev)
45{
46 unregister_netdevice(dev);
47}
48EXPORT_SYMBOL(lowpan_unregister_netdevice);
49
50void lowpan_unregister_netdev(struct net_device *dev)
51{
52 rtnl_lock();
53 lowpan_unregister_netdevice(dev);
54 rtnl_unlock();
b72f6f51 55}
00f59314 56EXPORT_SYMBOL(lowpan_unregister_netdev);
4ae935c1
AA
57
58static int __init lowpan_module_init(void)
59{
60 request_module_nowait("ipv6");
61
62 request_module_nowait("nhc_dest");
63 request_module_nowait("nhc_fragment");
64 request_module_nowait("nhc_hop");
65 request_module_nowait("nhc_ipv6");
66 request_module_nowait("nhc_mobility");
67 request_module_nowait("nhc_routing");
68 request_module_nowait("nhc_udp");
69
70 return 0;
71}
72module_init(lowpan_module_init);
73
74MODULE_LICENSE("GPL");