aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ip6_tunnel.c
diff options
context:
space:
mode:
authorWANG Cong <xiyou.wangcong@gmail.com>2014-02-13 14:46:28 -0500
committerDavid S. Miller <davem@davemloft.net>2014-02-14 15:49:55 -0500
commit1c213bd24ad04f4430031d20d740d7783162b099 (patch)
treeeb42b8d216e89008065634185fd6a5fcce5ec4e9 /net/ipv6/ip6_tunnel.c
parented1acc8cd8c22efa919da8d300bab646e01c2dce (diff)
net: introduce netdev_alloc_pcpu_stats() for drivers
There are many drivers calling alloc_percpu() to allocate pcpu stats and then initializing ->syncp. So just introduce a helper function for them. Cc: David S. Miller <davem@davemloft.net> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ip6_tunnel.c')
-rw-r--r--net/ipv6/ip6_tunnel.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 5db8d310f9c0..8ad59f4811df 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -1502,19 +1502,12 @@ static inline int
1502ip6_tnl_dev_init_gen(struct net_device *dev) 1502ip6_tnl_dev_init_gen(struct net_device *dev)
1503{ 1503{
1504 struct ip6_tnl *t = netdev_priv(dev); 1504 struct ip6_tnl *t = netdev_priv(dev);
1505 int i;
1506 1505
1507 t->dev = dev; 1506 t->dev = dev;
1508 t->net = dev_net(dev); 1507 t->net = dev_net(dev);
1509 dev->tstats = alloc_percpu(struct pcpu_sw_netstats); 1508 dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
1510 if (!dev->tstats) 1509 if (!dev->tstats)
1511 return -ENOMEM; 1510 return -ENOMEM;
1512
1513 for_each_possible_cpu(i) {
1514 struct pcpu_sw_netstats *ip6_tnl_stats;
1515 ip6_tnl_stats = per_cpu_ptr(dev->tstats, i);
1516 u64_stats_init(&ip6_tnl_stats->syncp);
1517 }
1518 return 0; 1511 return 0;
1519} 1512}
1520 1513