net: introduce netdev_alloc_pcpu_stats() for drivers
[deliverable/linux.git] / net / ipv6 / sit.c
index 3dfbcf1dcb1cbdb38a2a0b17a328bb424b139eb0..958027be0e941f50853f865b006ad121aa5025d2 100644 (file)
@@ -1356,7 +1356,6 @@ 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 i;
 
        tunnel->dev = dev;
        tunnel->net = dev_net(dev);
@@ -1365,16 +1364,10 @@ static int ipip6_tunnel_init(struct net_device *dev)
        memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4);
 
        ipip6_tunnel_bind_dev(dev);
-       dev->tstats = alloc_percpu(struct pcpu_sw_netstats);
+       dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
        if (!dev->tstats)
                return -ENOMEM;
 
-       for_each_possible_cpu(i) {
-               struct pcpu_sw_netstats *ipip6_tunnel_stats;
-               ipip6_tunnel_stats = per_cpu_ptr(dev->tstats, i);
-               u64_stats_init(&ipip6_tunnel_stats->syncp);
-       }
-
        return 0;
 }
 
@@ -1384,7 +1377,6 @@ static int __net_init ipip6_fb_tunnel_init(struct net_device *dev)
        struct iphdr *iph = &tunnel->parms.iph;
        struct net *net = dev_net(dev);
        struct sit_net *sitn = net_generic(net, sit_net_id);
-       int i;
 
        tunnel->dev = dev;
        tunnel->net = dev_net(dev);
@@ -1395,16 +1387,10 @@ static int __net_init ipip6_fb_tunnel_init(struct net_device *dev)
        iph->ihl                = 5;
        iph->ttl                = 64;
 
-       dev->tstats = alloc_percpu(struct pcpu_sw_netstats);
+       dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
        if (!dev->tstats)
                return -ENOMEM;
 
-       for_each_possible_cpu(i) {
-               struct pcpu_sw_netstats *ipip6_fb_stats;
-               ipip6_fb_stats = per_cpu_ptr(dev->tstats, i);
-               u64_stats_init(&ipip6_fb_stats->syncp);
-       }
-
        dev_hold(dev);
        rcu_assign_pointer(sitn->tunnels_wc[0], tunnel);
        return 0;
This page took 0.029226 seconds and 5 git commands to generate.