Commit 422b5ae9 authored by Eric Dumazet's avatar Eric Dumazet Committed by Jakub Kicinski

bareudp: use exit_batch_rtnl() method

exit_batch_rtnl() is called while RTNL is held,
and devices to be unregistered can be queued in the dev_kill_list.

This saves one rtnl_lock()/rtnl_unlock() pair,
and one unregister_netdevice_many() call.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reviewed-by: default avatarAntoine Tenart <atenart@kernel.org>
Link: https://lore.kernel.org/r/20240206144313.2050392-5-edumazet@google.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent a7ec2512
...@@ -760,23 +760,18 @@ static void bareudp_destroy_tunnels(struct net *net, struct list_head *head) ...@@ -760,23 +760,18 @@ static void bareudp_destroy_tunnels(struct net *net, struct list_head *head)
unregister_netdevice_queue(bareudp->dev, head); unregister_netdevice_queue(bareudp->dev, head);
} }
static void __net_exit bareudp_exit_batch_net(struct list_head *net_list) static void __net_exit bareudp_exit_batch_rtnl(struct list_head *net_list,
struct list_head *dev_kill_list)
{ {
struct net *net; struct net *net;
LIST_HEAD(list);
rtnl_lock();
list_for_each_entry(net, net_list, exit_list) list_for_each_entry(net, net_list, exit_list)
bareudp_destroy_tunnels(net, &list); bareudp_destroy_tunnels(net, dev_kill_list);
/* unregister the devices gathered above */
unregister_netdevice_many(&list);
rtnl_unlock();
} }
static struct pernet_operations bareudp_net_ops = { static struct pernet_operations bareudp_net_ops = {
.init = bareudp_init_net, .init = bareudp_init_net,
.exit_batch = bareudp_exit_batch_net, .exit_batch_rtnl = bareudp_exit_batch_rtnl,
.id = &bareudp_net_id, .id = &bareudp_net_id,
.size = sizeof(struct bareudp_net), .size = sizeof(struct bareudp_net),
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment