summaryrefslogtreecommitdiff
path: root/datapath/vport-lisp.c
diff options
context:
space:
mode:
authorThomas Graf <tgraf@noironetworks.com>2015-04-04 08:24:13 +0200
committerThomas Graf <tgraf@noironetworks.com>2015-04-04 08:24:44 +0200
commit5a38795f5e6623b39004b53c7fede08399a09d79 (patch)
treed20898518d92de89ad0d266f66a790aa8b7f9a54 /datapath/vport-lisp.c
parent416e71322f82beea869b2e5928be5ae60f2577de (diff)
downloadopenvswitch-5a38795f5e6623b39004b53c7fede08399a09d79.tar.gz
datapath: Turn vports with dependencies into separate modules
Upstream commit: The internal and netdev vport remain part of openvswitch.ko. Encap vports including vxlan, gre, and geneve can be built as separate modules and are loaded on demand. Modules can be unloaded after use. Datapath ports keep a reference to the vport module during their lifetime. Allows to remove the error prone maintenance of the global list vport_ops_list. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net> Also folds in the follow-up commits 9ba559d9ca3 to turned the non-GPL symbol exports to GPL exports, and fa2d8ff4e35 which fixes a module reference release bug. Exports various backwards compat functions linked into the main openvswitch module as GPL symbols to ensure vport modules can use them. Some fiddling with the Makefile was needed to work around the fact that Makefile variables can't contain '-' characters needed to define 'vport-xxx' module sources. Also, Kbuild complains heavily if a $(module)-y = $(module).o is defined which is actually backed with a .c file of the same name. Therefore, a new $(build_multi_modules) variable is defined which lists all module which consist of more than one source file. Upstream: 62b9c8d0372 ("ovs: Turn vports with dependencies into separate modules") Upstream: 9ba559d9ca3 ("openvswitch: Export symbols as GPL symbols.") Upstream: fa2d8ff4e35 ("openvswitch: Return vport module ref before destruction") Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
Diffstat (limited to 'datapath/vport-lisp.c')
-rw-r--r--datapath/vport-lisp.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/datapath/vport-lisp.c b/datapath/vport-lisp.c
index 293002fe9..0024eb480 100644
--- a/datapath/vport-lisp.c
+++ b/datapath/vport-lisp.c
@@ -24,6 +24,7 @@
#include <linux/in.h>
#include <linux/ip.h>
#include <linux/net.h>
+#include <linux/module.h>
#include <linux/rculist.h>
#include <linux/udp.h>
@@ -110,6 +111,7 @@ struct lisp_port {
};
static LIST_HEAD(lisp_ports);
+static struct vport_ops ovs_lisp_vport_ops;
static inline struct lisp_port *lisp_vport(const struct vport *vport)
{
@@ -493,7 +495,7 @@ static int lisp_get_egress_tun_info(struct vport *vport, struct sk_buff *skb,
lisp_port->dst_port);
}
-const struct vport_ops ovs_lisp_vport_ops = {
+static struct vport_ops ovs_lisp_vport_ops = {
.type = OVS_VPORT_TYPE_LISP,
.create = lisp_tnl_create,
.destroy = lisp_tnl_destroy,
@@ -501,4 +503,22 @@ const struct vport_ops ovs_lisp_vport_ops = {
.get_options = lisp_get_options,
.send = lisp_send,
.get_egress_tun_info = lisp_get_egress_tun_info,
+ .owner = THIS_MODULE,
};
+
+static int __init ovs_lisp_tnl_init(void)
+{
+ return ovs_vport_ops_register(&ovs_lisp_vport_ops);
+}
+
+static void __exit ovs_lisp_tnl_exit(void)
+{
+ ovs_vport_ops_unregister(&ovs_lisp_vport_ops);
+}
+
+module_init(ovs_lisp_tnl_init);
+module_exit(ovs_lisp_tnl_exit);
+
+MODULE_DESCRIPTION("OVS: LISP switching port");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("vport-type-105");