Commit e2ce1468 authored by Octavian Purdila's avatar Octavian Purdila Committed by David S. Miller

ipv4: factorize cache clearing for batched unregister operations

Signed-off-by: default avatarOctavian Purdila <opurdila@ixiacom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 395264d5
...@@ -895,11 +895,11 @@ static void nl_fib_lookup_exit(struct net *net) ...@@ -895,11 +895,11 @@ static void nl_fib_lookup_exit(struct net *net)
net->ipv4.fibnl = NULL; net->ipv4.fibnl = NULL;
} }
static void fib_disable_ip(struct net_device *dev, int force) static void fib_disable_ip(struct net_device *dev, int force, int delay)
{ {
if (fib_sync_down_dev(dev, force)) if (fib_sync_down_dev(dev, force))
fib_flush(dev_net(dev)); fib_flush(dev_net(dev));
rt_cache_flush(dev_net(dev), 0); rt_cache_flush(dev_net(dev), delay);
arp_ifdown(dev); arp_ifdown(dev);
} }
...@@ -922,7 +922,7 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, ...@@ -922,7 +922,7 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event,
/* Last address was deleted from this interface. /* Last address was deleted from this interface.
Disable IP. Disable IP.
*/ */
fib_disable_ip(dev, 1); fib_disable_ip(dev, 1, 0);
} else { } else {
rt_cache_flush(dev_net(dev), -1); rt_cache_flush(dev_net(dev), -1);
} }
...@@ -937,7 +937,7 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo ...@@ -937,7 +937,7 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
struct in_device *in_dev = __in_dev_get_rtnl(dev); struct in_device *in_dev = __in_dev_get_rtnl(dev);
if (event == NETDEV_UNREGISTER) { if (event == NETDEV_UNREGISTER) {
fib_disable_ip(dev, 2); fib_disable_ip(dev, 2, -1);
return NOTIFY_DONE; return NOTIFY_DONE;
} }
...@@ -955,10 +955,11 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo ...@@ -955,10 +955,11 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
rt_cache_flush(dev_net(dev), -1); rt_cache_flush(dev_net(dev), -1);
break; break;
case NETDEV_DOWN: case NETDEV_DOWN:
fib_disable_ip(dev, 0); fib_disable_ip(dev, 0, 0);
break; break;
case NETDEV_CHANGEMTU: case NETDEV_CHANGEMTU:
case NETDEV_CHANGE: case NETDEV_CHANGE:
case NETDEV_UNREGISTER_PERNET:
rt_cache_flush(dev_net(dev), 0); rt_cache_flush(dev_net(dev), 0);
break; break;
} }
......
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