aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2010-08-17 23:13:08 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-19 03:16:52 -0400
commit6f0bee16d0840c272229f2038a23a9a02dfc803d (patch)
tree67b5147d41d3a9d0dff650c487ea9256c6435c85 /drivers
parentdd57f970f91e2371040db709b3731ac34e43ccdb (diff)
slip: fix get_stats() method
Use integrated net_device_stats instead of a static one, and make sure no transient values are feeded. ndo_get_stats() can be called by concurrent cpus. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/slip.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/drivers/net/slip.c b/drivers/net/slip.c
index fa434fb8fb7c..d5a36f5417cc 100644
--- a/drivers/net/slip.c
+++ b/drivers/net/slip.c
@@ -561,36 +561,36 @@ static int sl_change_mtu(struct net_device *dev, int new_mtu)
561static struct net_device_stats * 561static struct net_device_stats *
562sl_get_stats(struct net_device *dev) 562sl_get_stats(struct net_device *dev)
563{ 563{
564 static struct net_device_stats stats; 564 struct net_device_stats *stats = &dev->stats;
565 struct slip *sl = netdev_priv(dev); 565 struct slip *sl = netdev_priv(dev);
566 unsigned long c_rx_dropped = 0;
566#ifdef SL_INCLUDE_CSLIP 567#ifdef SL_INCLUDE_CSLIP
567 struct slcompress *comp; 568 unsigned long c_rx_fifo_errors = 0;
568#endif 569 unsigned long c_tx_fifo_errors = 0;
570 unsigned long c_collisions = 0;
571 struct slcompress *comp = sl->slcomp;
569 572
570 memset(&stats, 0, sizeof(struct net_device_stats));
571
572 stats.rx_packets = sl->rx_packets;
573 stats.tx_packets = sl->tx_packets;
574 stats.rx_bytes = sl->rx_bytes;
575 stats.tx_bytes = sl->tx_bytes;
576 stats.rx_dropped = sl->rx_dropped;
577 stats.tx_dropped = sl->tx_dropped;
578 stats.tx_errors = sl->tx_errors;
579 stats.rx_errors = sl->rx_errors;
580 stats.rx_over_errors = sl->rx_over_errors;
581#ifdef SL_INCLUDE_CSLIP
582 stats.rx_fifo_errors = sl->rx_compressed;
583 stats.tx_fifo_errors = sl->tx_compressed;
584 stats.collisions = sl->tx_misses;
585 comp = sl->slcomp;
586 if (comp) { 573 if (comp) {
587 stats.rx_fifo_errors += comp->sls_i_compressed; 574 c_rx_fifo_errors = comp->sls_i_compressed;
588 stats.rx_dropped += comp->sls_i_tossed; 575 c_rx_dropped = comp->sls_i_tossed;
589 stats.tx_fifo_errors += comp->sls_o_compressed; 576 c_tx_fifo_errors = comp->sls_o_compressed;
590 stats.collisions += comp->sls_o_misses; 577 c_collisions = comp->sls_o_misses;
591 } 578 }
592#endif /* CONFIG_INET */ 579 stats->rx_fifo_errors = sl->rx_compressed + c_rx_fifo_errors;
593 return (&stats); 580 stats->tx_fifo_errors = sl->tx_compressed + c_tx_fifo_errors;
581 stats->collisions = sl->tx_misses + c_collisions;
582#endif
583
584 stats->rx_packets = sl->rx_packets;
585 stats->tx_packets = sl->tx_packets;
586 stats->rx_bytes = sl->rx_bytes;
587 stats->tx_bytes = sl->tx_bytes;
588 stats->rx_dropped = sl->rx_dropped + c_rx_dropped;
589 stats->tx_dropped = sl->tx_dropped;
590 stats->tx_errors = sl->tx_errors;
591 stats->rx_errors = sl->rx_errors;
592 stats->rx_over_errors = sl->rx_over_errors;
593 return stats;
594} 594}
595 595
596/* Netdevice register callback */ 596/* Netdevice register callback */