mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-21 06:01:23 +00:00
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:
parent
cf7b200386
commit
62b9c8d037
11 changed files with 199 additions and 68 deletions
|
@ -59,6 +59,7 @@
|
|||
#include "vport-netdev.h"
|
||||
|
||||
int ovs_net_id __read_mostly;
|
||||
EXPORT_SYMBOL(ovs_net_id);
|
||||
|
||||
static struct genl_family dp_packet_genl_family;
|
||||
static struct genl_family dp_flow_genl_family;
|
||||
|
@ -1764,6 +1765,7 @@ static int ovs_vport_cmd_new(struct sk_buff *skb, struct genl_info *info)
|
|||
return -ENOMEM;
|
||||
|
||||
ovs_lock();
|
||||
restart:
|
||||
dp = get_dp(sock_net(skb->sk), ovs_header->dp_ifindex);
|
||||
err = -ENODEV;
|
||||
if (!dp)
|
||||
|
@ -1795,8 +1797,11 @@ static int ovs_vport_cmd_new(struct sk_buff *skb, struct genl_info *info)
|
|||
|
||||
vport = new_vport(&parms);
|
||||
err = PTR_ERR(vport);
|
||||
if (IS_ERR(vport))
|
||||
if (IS_ERR(vport)) {
|
||||
if (err == -EAGAIN)
|
||||
goto restart;
|
||||
goto exit_unlock_free;
|
||||
}
|
||||
|
||||
err = ovs_vport_cmd_fill_info(vport, reply, info->snd_portid,
|
||||
info->snd_seq, 0, OVS_VPORT_CMD_NEW);
|
||||
|
@ -2112,12 +2117,18 @@ static int __init dp_init(void)
|
|||
if (err)
|
||||
goto error_netns_exit;
|
||||
|
||||
err = ovs_netdev_init();
|
||||
if (err)
|
||||
goto error_unreg_notifier;
|
||||
|
||||
err = dp_register_genl();
|
||||
if (err < 0)
|
||||
goto error_unreg_notifier;
|
||||
goto error_unreg_netdev;
|
||||
|
||||
return 0;
|
||||
|
||||
error_unreg_netdev:
|
||||
ovs_netdev_exit();
|
||||
error_unreg_notifier:
|
||||
unregister_netdevice_notifier(&ovs_dp_device_notifier);
|
||||
error_netns_exit:
|
||||
|
@ -2137,6 +2148,7 @@ error:
|
|||
static void dp_cleanup(void)
|
||||
{
|
||||
dp_unregister_genl(ARRAY_SIZE(dp_genl_families));
|
||||
ovs_netdev_exit();
|
||||
unregister_netdevice_notifier(&ovs_dp_device_notifier);
|
||||
unregister_pernet_device(&ovs_net_ops);
|
||||
rcu_barrier();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue