diff options
author | WANG Cong <xiyou.wangcong@gmail.com> | 2014-02-13 14:46:28 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-02-14 15:49:55 -0500 |
commit | 1c213bd24ad04f4430031d20d740d7783162b099 (patch) | |
tree | eb42b8d216e89008065634185fd6a5fcce5ec4e9 /net/bridge | |
parent | ed1acc8cd8c22efa919da8d300bab646e01c2dce (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/bridge')
-rw-r--r-- | net/bridge/br_device.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index 63f0455c0bc3..bf34451743a1 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c | |||
@@ -88,18 +88,11 @@ out: | |||
88 | static int br_dev_init(struct net_device *dev) | 88 | static int br_dev_init(struct net_device *dev) |
89 | { | 89 | { |
90 | struct net_bridge *br = netdev_priv(dev); | 90 | struct net_bridge *br = netdev_priv(dev); |
91 | int i; | ||
92 | 91 | ||
93 | br->stats = alloc_percpu(struct pcpu_sw_netstats); | 92 | br->stats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); |
94 | if (!br->stats) | 93 | if (!br->stats) |
95 | return -ENOMEM; | 94 | return -ENOMEM; |
96 | 95 | ||
97 | for_each_possible_cpu(i) { | ||
98 | struct pcpu_sw_netstats *br_dev_stats; | ||
99 | br_dev_stats = per_cpu_ptr(br->stats, i); | ||
100 | u64_stats_init(&br_dev_stats->syncp); | ||
101 | } | ||
102 | |||
103 | return 0; | 96 | return 0; |
104 | } | 97 | } |
105 | 98 | ||