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 /drivers/net/xen-netfront.c | |
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 'drivers/net/xen-netfront.c')
-rw-r--r-- | drivers/net/xen-netfront.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index f9daa9e183f..2b62d799bfd 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c @@ -1281,16 +1281,10 @@ static struct net_device *xennet_create_dev(struct xenbus_device *dev) np->rx_refill_timer.function = rx_refill_timeout; err = -ENOMEM; - np->stats = alloc_percpu(struct netfront_stats); + np->stats = netdev_alloc_pcpu_stats(struct netfront_stats); if (np->stats == NULL) goto exit; - for_each_possible_cpu(i) { - struct netfront_stats *xen_nf_stats; - xen_nf_stats = per_cpu_ptr(np->stats, i); - u64_stats_init(&xen_nf_stats->syncp); - } - /* Initialise tx_skbs as a free chain containing every entry. */ np->tx_skb_freelist = 0; for (i = 0; i < NET_TX_RING_SIZE; i++) { |