aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorOctavian Purdila <opurdila@ixiacom.com>2009-11-16 08:49:49 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-18 08:03:07 -0500
commite2ce146848c81af2f6d42e67990191c284bf0c33 (patch)
tree481c62f032091fd5dc8933f1ba26f6581c8e1cef /net/ipv4
parent395264d509aec45149745843d9a737140a1ece16 (diff)
ipv4: factorize cache clearing for batched unregister operations
Signed-off-by: Octavian Purdila <opurdila@ixiacom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/fib_frontend.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 816e2180bd60..6c1e56aef1f4 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -895,11 +895,11 @@ static void nl_fib_lookup_exit(struct net *net)
895 net->ipv4.fibnl = NULL; 895 net->ipv4.fibnl = NULL;
896} 896}
897 897
898static void fib_disable_ip(struct net_device *dev, int force) 898static void fib_disable_ip(struct net_device *dev, int force, int delay)
899{ 899{
900 if (fib_sync_down_dev(dev, force)) 900 if (fib_sync_down_dev(dev, force))
901 fib_flush(dev_net(dev)); 901 fib_flush(dev_net(dev));
902 rt_cache_flush(dev_net(dev), 0); 902 rt_cache_flush(dev_net(dev), delay);
903 arp_ifdown(dev); 903 arp_ifdown(dev);
904} 904}
905 905
@@ -922,7 +922,7 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event,
922 /* Last address was deleted from this interface. 922 /* Last address was deleted from this interface.
923 Disable IP. 923 Disable IP.
924 */ 924 */
925 fib_disable_ip(dev, 1); 925 fib_disable_ip(dev, 1, 0);
926 } else { 926 } else {
927 rt_cache_flush(dev_net(dev), -1); 927 rt_cache_flush(dev_net(dev), -1);
928 } 928 }
@@ -937,7 +937,7 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
937 struct in_device *in_dev = __in_dev_get_rtnl(dev); 937 struct in_device *in_dev = __in_dev_get_rtnl(dev);
938 938
939 if (event == NETDEV_UNREGISTER) { 939 if (event == NETDEV_UNREGISTER) {
940 fib_disable_ip(dev, 2); 940 fib_disable_ip(dev, 2, -1);
941 return NOTIFY_DONE; 941 return NOTIFY_DONE;
942 } 942 }
943 943
@@ -955,10 +955,11 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
955 rt_cache_flush(dev_net(dev), -1); 955 rt_cache_flush(dev_net(dev), -1);
956 break; 956 break;
957 case NETDEV_DOWN: 957 case NETDEV_DOWN:
958 fib_disable_ip(dev, 0); 958 fib_disable_ip(dev, 0, 0);
959 break; 959 break;
960 case NETDEV_CHANGEMTU: 960 case NETDEV_CHANGEMTU:
961 case NETDEV_CHANGE: 961 case NETDEV_CHANGE:
962 case NETDEV_UNREGISTER_PERNET:
962 rt_cache_flush(dev_net(dev), 0); 963 rt_cache_flush(dev_net(dev), 0);
963 break; 964 break;
964 } 965 }