From 4eac20efffb81940408f4f03843acfad58935fe9 Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Tue, 6 Nov 2007 11:33:55 -0800 Subject: [PATCH] cpu alloc: convert loopback statistics Signed-off-by: Christoph Lameter --- drivers/net/loopback.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index 45f30a2..960a36b 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c @@ -156,7 +156,7 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev) /* it's OK to use per_cpu_ptr() because BHs are off */ pcpu_lstats = netdev_priv(dev); - lb_stats = per_cpu_ptr(pcpu_lstats, smp_processor_id()); + lb_stats = THIS_CPU(pcpu_lstats); lb_stats->bytes += skb->len; lb_stats->packets++; @@ -177,7 +177,7 @@ static struct net_device_stats *get_stats(struct net_device *dev) for_each_possible_cpu(i) { const struct pcpu_lstats *lb_stats; - lb_stats = per_cpu_ptr(pcpu_lstats, i); + lb_stats = CPU_PTR(pcpu_lstats, i); bytes += lb_stats->bytes; packets += lb_stats->packets; } @@ -205,7 +205,7 @@ static int loopback_dev_init(struct net_device *dev) { struct pcpu_lstats *lstats; - lstats = alloc_percpu(struct pcpu_lstats); + lstats = CPU_ALLOC(struct pcpu_lstats, GFP_KERNEL | __GFP_ZERO); if (!lstats) return -ENOMEM; @@ -217,7 +217,7 @@ static void loopback_dev_free(struct net_device *dev) { struct pcpu_lstats *lstats = netdev_priv(dev); - free_percpu(lstats); + CPU_FREE(lstats); free_netdev(dev); } -- 1.5.3.4