aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorEric Dumazet <dada1@cosmosbay.com>2006-10-20 03:32:41 -0400
committerDavid S. Miller <davem@davemloft.net>2006-10-20 03:32:41 -0400
commit58f539740b1ccfc5ef4e509ec2efe82621b546e3 (patch)
treef0e24b555808ce919528a0c5950e188768e97f23 /drivers/net
parent78d79423179c0efc7ec34b55d287e7be4ca07da6 (diff)
[NET]: Can use __get_cpu_var() instead of per_cpu() in loopback driver.
As BHs are off in loopback_xmit(), preemption cannot occurs, so we can use __get_cpu_var() instead of per_cpu() (and avoid a preempt_enable()/preempt_disable() pair) Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/loopback.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 93fbea1c9271..82c10dec1b5a 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -153,14 +153,14 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev)
153#endif 153#endif
154 dev->last_rx = jiffies; 154 dev->last_rx = jiffies;
155 155
156 lb_stats = &per_cpu(pcpu_lstats, get_cpu()); 156 /* it's OK to use __get_cpu_var() because BHs are off */
157 lb_stats = &__get_cpu_var(pcpu_lstats);
157 lb_stats->bytes += skb->len; 158 lb_stats->bytes += skb->len;
158 lb_stats->packets++; 159 lb_stats->packets++;
159 put_cpu();
160 160
161 netif_rx(skb); 161 netif_rx(skb);
162 162
163 return(0); 163 return 0;
164} 164}
165 165
166static struct net_device_stats loopback_stats; 166static struct net_device_stats loopback_stats;