Commit 0694c4c0 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

ipip: 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 63c8099d
...@@ -754,16 +754,19 @@ static struct xfrm_tunnel ipip_handler = { ...@@ -754,16 +754,19 @@ static struct xfrm_tunnel ipip_handler = {
static const char banner[] __initconst = static const char banner[] __initconst =
KERN_INFO "IPv4 over IPv4 tunneling driver\n"; KERN_INFO "IPv4 over IPv4 tunneling driver\n";
static void ipip_destroy_tunnels(struct ipip_net *ipn) static void ipip_destroy_tunnels(struct ipip_net *ipn, 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 = ipn->tunnels[prio][h];
while ((t = ipn->tunnels[prio][h]) != NULL)
unregister_netdevice(t->dev); while (t != NULL) {
unregister_netdevice_queue(t->dev, head);
t = t->next;
}
} }
} }
} }
...@@ -816,11 +819,13 @@ static int ipip_init_net(struct net *net) ...@@ -816,11 +819,13 @@ static int ipip_init_net(struct net *net)
static void ipip_exit_net(struct net *net) static void ipip_exit_net(struct net *net)
{ {
struct ipip_net *ipn; struct ipip_net *ipn;
LIST_HEAD(list);
ipn = net_generic(net, ipip_net_id); ipn = net_generic(net, ipip_net_id);
rtnl_lock(); rtnl_lock();
ipip_destroy_tunnels(ipn); ipip_destroy_tunnels(ipn, &list);
unregister_netdevice(ipn->fb_tunnel_dev); unregister_netdevice_queue(ipn->fb_tunnel_dev, &list);
unregister_netdevice_many(&list);
rtnl_unlock(); rtnl_unlock();
kfree(ipn); kfree(ipn);
} }
......
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