diff options
author | WANG Cong <xiyou.wangcong@gmail.com> | 2014-02-13 11:46:28 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-02-14 15:49:55 -0500 |
commit | 1c213bd24ad04f4430031d20d740d7783162b099 (patch) | |
tree | eb42b8d216e89008065634185fd6a5fcce5ec4e9 /net/ipv6/ip6_gre.c | |
parent | ed1acc8cd8c22efa919da8d300bab646e01c2dce (diff) | |
download | blackbird-obmc-linux-1c213bd24ad04f4430031d20d740d7783162b099.tar.gz blackbird-obmc-linux-1c213bd24ad04f4430031d20d740d7783162b099.zip |
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_gre.c')
-rw-r--r-- | net/ipv6/ip6_gre.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index f3ffb43f59c0..c98338b81d30 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -1454,7 +1454,6 @@ static void ip6gre_netlink_parms(struct nlattr *data[], static int ip6gre_tap_init(struct net_device *dev) { struct ip6_tnl *tunnel; - int i; tunnel = netdev_priv(dev); @@ -1464,16 +1463,10 @@ static int ip6gre_tap_init(struct net_device *dev) ip6gre_tnl_link_config(tunnel, 1); - 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 *ip6gre_tap_stats; - ip6gre_tap_stats = per_cpu_ptr(dev->tstats, i); - u64_stats_init(&ip6gre_tap_stats->syncp); - } - return 0; } |