summaryrefslogtreecommitdiff
path: root/datapath/vport-netdev.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-netdev.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-netdev.c')
-rw-r--r--datapath/vport-netdev.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/datapath/vport-netdev.c b/datapath/vport-netdev.c
index 9c0908a03..05ad0b4ab 100644
--- a/datapath/vport-netdev.c
+++ b/datapath/vport-netdev.c
@@ -35,6 +35,7 @@
#include "vport-internal_dev.h"
#include "vport-netdev.h"
+static struct vport_ops ovs_netdev_vport_ops;
static void netdev_port_receive(struct vport *vport, struct sk_buff *skb);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
@@ -274,7 +275,7 @@ struct vport *ovs_netdev_get_vport(struct net_device *dev)
#endif
}
-const struct vport_ops ovs_netdev_vport_ops = {
+static struct vport_ops ovs_netdev_vport_ops = {
.type = OVS_VPORT_TYPE_NETDEV,
.create = netdev_create,
.destroy = netdev_destroy,
@@ -282,6 +283,16 @@ const struct vport_ops ovs_netdev_vport_ops = {
.send = netdev_send,
};
+int __init ovs_netdev_init(void)
+{
+ return ovs_vport_ops_register(&ovs_netdev_vport_ops);
+}
+
+void ovs_netdev_exit(void)
+{
+ ovs_vport_ops_unregister(&ovs_netdev_vport_ops);
+}
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36) && \
!defined HAVE_RHEL_OVS_HOOK
/*