]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - net/ipv6/sit.c
ip_tunnel: replace dst_cache with generic implementation
[karo-tx-linux.git] / net / ipv6 / sit.c
index 9a6b407f5840bf7b50344ca37fd8689693bdc198..0625ac6356b59886b4d2e8d74863c3a2d422874b 100644 (file)
@@ -475,7 +475,7 @@ static void ipip6_tunnel_uninit(struct net_device *dev)
                ipip6_tunnel_unlink(sitn, tunnel);
                ipip6_tunnel_del_prl(tunnel, NULL);
        }
-       ip_tunnel_dst_reset_all(tunnel);
+       dst_cache_reset(&tunnel->dst_cache);
        dev_put(dev);
 }
 
@@ -1093,7 +1093,7 @@ static void ipip6_tunnel_update(struct ip_tunnel *t, struct ip_tunnel_parm *p)
                t->parms.link = p->link;
                ipip6_tunnel_bind_dev(t->dev);
        }
-       ip_tunnel_dst_reset_all(t);
+       dst_cache_reset(&t->dst_cache);
        netdev_state_change(t->dev);
 }
 
@@ -1124,7 +1124,7 @@ static int ipip6_tunnel_update_6rd(struct ip_tunnel *t,
        t->ip6rd.relay_prefix = relay_prefix;
        t->ip6rd.prefixlen = ip6rd->prefixlen;
        t->ip6rd.relay_prefixlen = ip6rd->relay_prefixlen;
-       ip_tunnel_dst_reset_all(t);
+       dst_cache_reset(&t->dst_cache);
        netdev_state_change(t->dev);
        return 0;
 }
@@ -1278,7 +1278,7 @@ ipip6_tunnel_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
                        err = ipip6_tunnel_add_prl(t, &prl, cmd == SIOCCHGPRL);
                        break;
                }
-               ip_tunnel_dst_reset_all(t);
+               dst_cache_reset(&t->dst_cache);
                netdev_state_change(dev);
                break;
 
@@ -1339,7 +1339,7 @@ static void ipip6_dev_free(struct net_device *dev)
 {
        struct ip_tunnel *tunnel = netdev_priv(dev);
 
-       free_percpu(tunnel->dst_cache);
+       dst_cache_destroy(&tunnel->dst_cache);
        free_percpu(dev->tstats);
        free_netdev(dev);
 }
@@ -1372,6 +1372,7 @@ static void ipip6_tunnel_setup(struct net_device *dev)
 static int ipip6_tunnel_init(struct net_device *dev)
 {
        struct ip_tunnel *tunnel = netdev_priv(dev);
+       int err;
 
        tunnel->dev = dev;
        tunnel->net = dev_net(dev);
@@ -1382,10 +1383,10 @@ static int ipip6_tunnel_init(struct net_device *dev)
        if (!dev->tstats)
                return -ENOMEM;
 
-       tunnel->dst_cache = alloc_percpu(struct ip_tunnel_dst);
-       if (!tunnel->dst_cache) {
+       err = dst_cache_init(&tunnel->dst_cache, GFP_KERNEL);
+       if (err) {
                free_percpu(dev->tstats);
-               return -ENOMEM;
+               return err;
        }
 
        return 0;