diff options
-rw-r--r-- | drivers/net/loopback.c | 8 | ||||
-rw-r--r-- | include/linux/netdevice.h | 4 |
2 files changed, 7 insertions, 5 deletions
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index 41b774baac4d..49f6bc036a92 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c | |||
@@ -153,7 +153,7 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev) | |||
153 | dev->last_rx = jiffies; | 153 | dev->last_rx = jiffies; |
154 | 154 | ||
155 | /* it's OK to use per_cpu_ptr() because BHs are off */ | 155 | /* it's OK to use per_cpu_ptr() because BHs are off */ |
156 | pcpu_lstats = netdev_priv(dev); | 156 | pcpu_lstats = dev->ml_priv; |
157 | lb_stats = per_cpu_ptr(pcpu_lstats, smp_processor_id()); | 157 | lb_stats = per_cpu_ptr(pcpu_lstats, smp_processor_id()); |
158 | lb_stats->bytes += skb->len; | 158 | lb_stats->bytes += skb->len; |
159 | lb_stats->packets++; | 159 | lb_stats->packets++; |
@@ -171,7 +171,7 @@ static struct net_device_stats *get_stats(struct net_device *dev) | |||
171 | unsigned long packets = 0; | 171 | unsigned long packets = 0; |
172 | int i; | 172 | int i; |
173 | 173 | ||
174 | pcpu_lstats = netdev_priv(dev); | 174 | pcpu_lstats = dev->ml_priv; |
175 | for_each_possible_cpu(i) { | 175 | for_each_possible_cpu(i) { |
176 | const struct pcpu_lstats *lb_stats; | 176 | const struct pcpu_lstats *lb_stats; |
177 | 177 | ||
@@ -207,13 +207,13 @@ static int loopback_dev_init(struct net_device *dev) | |||
207 | if (!lstats) | 207 | if (!lstats) |
208 | return -ENOMEM; | 208 | return -ENOMEM; |
209 | 209 | ||
210 | dev->priv = lstats; | 210 | dev->ml_priv = lstats; |
211 | return 0; | 211 | return 0; |
212 | } | 212 | } |
213 | 213 | ||
214 | static void loopback_dev_free(struct net_device *dev) | 214 | static void loopback_dev_free(struct net_device *dev) |
215 | { | 215 | { |
216 | struct pcpu_lstats *lstats = netdev_priv(dev); | 216 | struct pcpu_lstats *lstats = dev->ml_priv; |
217 | 217 | ||
218 | free_percpu(lstats); | 218 | free_percpu(lstats); |
219 | free_netdev(dev); | 219 | free_netdev(dev); |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index a1c2c2204498..fdac1159253e 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -808,7 +808,9 @@ void dev_net_set(struct net_device *dev, struct net *net) | |||
808 | */ | 808 | */ |
809 | static inline void *netdev_priv(const struct net_device *dev) | 809 | static inline void *netdev_priv(const struct net_device *dev) |
810 | { | 810 | { |
811 | return dev->priv; | 811 | return (char *)dev + ((sizeof(struct net_device) |
812 | + NETDEV_ALIGN_CONST) | ||
813 | & ~NETDEV_ALIGN_CONST); | ||
812 | } | 814 | } |
813 | 815 | ||
814 | /* Set the sysfs physical device reference for the network logical device | 816 | /* Set the sysfs physical device reference for the network logical device |