Commit 62808f91 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

ipv6 sit: Optimize multiple unregistration

Speedup module unloading by factorizing synchronize_rcu() calls
Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d17fa6fa
...@@ -1145,16 +1145,19 @@ static struct xfrm_tunnel sit_handler = { ...@@ -1145,16 +1145,19 @@ static struct xfrm_tunnel sit_handler = {
.priority = 1, .priority = 1,
}; };
static void sit_destroy_tunnels(struct sit_net *sitn) static void sit_destroy_tunnels(struct sit_net *sitn, struct list_head *head)
{ {
int prio; int prio;
for (prio = 1; prio < 4; prio++) { for (prio = 1; prio < 4; prio++) {
int h; int h;
for (h = 0; h < HASH_SIZE; h++) { for (h = 0; h < HASH_SIZE; h++) {
struct ip_tunnel *t; struct ip_tunnel *t = sitn->tunnels[prio][h];
while ((t = sitn->tunnels[prio][h]) != NULL)
unregister_netdevice(t->dev); while (t != NULL) {
unregister_netdevice_queue(t->dev, head);
t = t->next;
}
} }
} }
} }
...@@ -1208,11 +1211,13 @@ static int sit_init_net(struct net *net) ...@@ -1208,11 +1211,13 @@ static int sit_init_net(struct net *net)
static void sit_exit_net(struct net *net) static void sit_exit_net(struct net *net)
{ {
struct sit_net *sitn; struct sit_net *sitn;
LIST_HEAD(list);
sitn = net_generic(net, sit_net_id); sitn = net_generic(net, sit_net_id);
rtnl_lock(); rtnl_lock();
sit_destroy_tunnels(sitn); sit_destroy_tunnels(sitn, &list);
unregister_netdevice(sitn->fb_tunnel_dev); unregister_netdevice_queue(sitn->fb_tunnel_dev, &list);
unregister_netdevice_many(&list);
rtnl_unlock(); rtnl_unlock();
kfree(sitn); kfree(sitn);
} }
......
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