aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/veth.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index ade5b344f75d..52af5017c46b 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -210,32 +210,29 @@ rx_drop:
210static struct net_device_stats *veth_get_stats(struct net_device *dev) 210static struct net_device_stats *veth_get_stats(struct net_device *dev)
211{ 211{
212 struct veth_priv *priv; 212 struct veth_priv *priv;
213 struct net_device_stats *dev_stats;
214 int cpu; 213 int cpu;
215 struct veth_net_stats *stats; 214 struct veth_net_stats *stats, total = {0};
216 215
217 priv = netdev_priv(dev); 216 priv = netdev_priv(dev);
218 dev_stats = &dev->stats;
219
220 dev_stats->rx_packets = 0;
221 dev_stats->tx_packets = 0;
222 dev_stats->rx_bytes = 0;
223 dev_stats->tx_bytes = 0;
224 dev_stats->tx_dropped = 0;
225 dev_stats->rx_dropped = 0;
226 217
227 for_each_online_cpu(cpu) { 218 for_each_possible_cpu(cpu) {
228 stats = per_cpu_ptr(priv->stats, cpu); 219 stats = per_cpu_ptr(priv->stats, cpu);
229 220
230 dev_stats->rx_packets += stats->rx_packets; 221 total.rx_packets += stats->rx_packets;
231 dev_stats->tx_packets += stats->tx_packets; 222 total.tx_packets += stats->tx_packets;
232 dev_stats->rx_bytes += stats->rx_bytes; 223 total.rx_bytes += stats->rx_bytes;
233 dev_stats->tx_bytes += stats->tx_bytes; 224 total.tx_bytes += stats->tx_bytes;
234 dev_stats->tx_dropped += stats->tx_dropped; 225 total.tx_dropped += stats->tx_dropped;
235 dev_stats->rx_dropped += stats->rx_dropped; 226 total.rx_dropped += stats->rx_dropped;
236 } 227 }
237 228 dev->stats.rx_packets = total.rx_packets;
238 return dev_stats; 229 dev->stats.tx_packets = total.tx_packets;
230 dev->stats.rx_bytes = total.rx_bytes;
231 dev->stats.tx_bytes = total.tx_bytes;
232 dev->stats.tx_dropped = total.tx_dropped;
233 dev->stats.rx_dropped = total.rx_dropped;
234
235 return &dev->stats;
239} 236}
240 237
241static int veth_open(struct net_device *dev) 238static int veth_open(struct net_device *dev)