ovs: Turn vports with dependencies into separate modules
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>
This commit is contained in:

committed by
David S. Miller

parent
cf7b200386
commit
62b9c8d037
@@ -24,6 +24,7 @@
|
||||
#include <linux/net.h>
|
||||
#include <linux/rculist.h>
|
||||
#include <linux/udp.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
#include <net/icmp.h>
|
||||
#include <net/ip.h>
|
||||
@@ -50,6 +51,8 @@ struct vxlan_port {
|
||||
char name[IFNAMSIZ];
|
||||
};
|
||||
|
||||
static struct vport_ops ovs_vxlan_vport_ops;
|
||||
|
||||
static inline struct vxlan_port *vxlan_vport(const struct vport *vport)
|
||||
{
|
||||
return vport_priv(vport);
|
||||
@@ -192,11 +195,29 @@ static const char *vxlan_get_name(const struct vport *vport)
|
||||
return vxlan_port->name;
|
||||
}
|
||||
|
||||
const struct vport_ops ovs_vxlan_vport_ops = {
|
||||
static struct vport_ops ovs_vxlan_vport_ops = {
|
||||
.type = OVS_VPORT_TYPE_VXLAN,
|
||||
.create = vxlan_tnl_create,
|
||||
.destroy = vxlan_tnl_destroy,
|
||||
.get_name = vxlan_get_name,
|
||||
.get_options = vxlan_get_options,
|
||||
.send = vxlan_tnl_send,
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static int __init ovs_vxlan_tnl_init(void)
|
||||
{
|
||||
return ovs_vport_ops_register(&ovs_vxlan_vport_ops);
|
||||
}
|
||||
|
||||
static void __exit ovs_vxlan_tnl_exit(void)
|
||||
{
|
||||
ovs_vport_ops_unregister(&ovs_vxlan_vport_ops);
|
||||
}
|
||||
|
||||
module_init(ovs_vxlan_tnl_init);
|
||||
module_exit(ovs_vxlan_tnl_exit);
|
||||
|
||||
MODULE_DESCRIPTION("OVS: VXLAN switching port");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_ALIAS("vport-type-4");
|
||||
|
Reference in New Issue
Block a user