aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2011-01-12 07:13:14 -0500
committerDavid S. Miller <davem@davemloft.net>2011-01-14 00:44:34 -0500
commit1ac9ad1394fa542ac7ae0dc943ee3cda678799fa (patch)
treed846be421ed68f4fc612ae7c061783dab73d5fa2 /net/core
parent1949e084bfd143c76e22c0b37f370d6e7bf4bfdd (diff)
net: remove dev_txq_stats_fold()
After recent changes, (percpu stats on vlan/tunnels...), we dont need anymore per struct netdev_queue tx_bytes/tx_packets/tx_dropped counters. Only remaining users are ixgbe, sch_teql, gianfar & macvlan : 1) ixgbe can be converted to use existing tx_ring counters. 2) macvlan incremented txq->tx_dropped, it can use the dev->stats.tx_dropped counter. 3) sch_teql : almost revert ab35cd4b8f42 (Use net_device internal stats) Now we have ndo_get_stats64(), use it, even for "unsigned long" fields (No need to bring back a struct net_device_stats) 4) gianfar adds a stats structure per tx queue to hold tx_bytes/tx_packets This removes a lockdep warning (and possible lockup) in rndis gadget, calling dev_get_stats() from hard IRQ context. Ref: http://www.spinics.net/lists/netdev/msg149202.html Reported-by: Neil Jones <neiljay@gmail.com> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> CC: Jarek Poplawski <jarkao2@gmail.com> CC: Alexander Duyck <alexander.h.duyck@intel.com> CC: Jeff Kirsher <jeffrey.t.kirsher@intel.com> CC: Sandeep Gopalpet <sandeep.kumar@freescale.com> CC: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c29
1 files changed, 0 insertions, 29 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index a3ef808b5e36..83507c265e48 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5523,34 +5523,6 @@ void netdev_run_todo(void)
5523 } 5523 }
5524} 5524}
5525 5525
5526/**
5527 * dev_txq_stats_fold - fold tx_queues stats
5528 * @dev: device to get statistics from
5529 * @stats: struct rtnl_link_stats64 to hold results
5530 */
5531void dev_txq_stats_fold(const struct net_device *dev,
5532 struct rtnl_link_stats64 *stats)
5533{
5534 u64 tx_bytes = 0, tx_packets = 0, tx_dropped = 0;
5535 unsigned int i;
5536 struct netdev_queue *txq;
5537
5538 for (i = 0; i < dev->num_tx_queues; i++) {
5539 txq = netdev_get_tx_queue(dev, i);
5540 spin_lock_bh(&txq->_xmit_lock);
5541 tx_bytes += txq->tx_bytes;
5542 tx_packets += txq->tx_packets;
5543 tx_dropped += txq->tx_dropped;
5544 spin_unlock_bh(&txq->_xmit_lock);
5545 }
5546 if (tx_bytes || tx_packets || tx_dropped) {
5547 stats->tx_bytes = tx_bytes;
5548 stats->tx_packets = tx_packets;
5549 stats->tx_dropped = tx_dropped;
5550 }
5551}
5552EXPORT_SYMBOL(dev_txq_stats_fold);
5553
5554/* Convert net_device_stats to rtnl_link_stats64. They have the same 5526/* Convert net_device_stats to rtnl_link_stats64. They have the same
5555 * fields in the same order, with only the type differing. 5527 * fields in the same order, with only the type differing.
5556 */ 5528 */
@@ -5594,7 +5566,6 @@ struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
5594 netdev_stats_to_stats64(storage, ops->ndo_get_stats(dev)); 5566 netdev_stats_to_stats64(storage, ops->ndo_get_stats(dev));
5595 } else { 5567 } else {
5596 netdev_stats_to_stats64(storage, &dev->stats); 5568 netdev_stats_to_stats64(storage, &dev->stats);
5597 dev_txq_stats_fold(dev, storage);
5598 } 5569 }
5599 storage->rx_dropped += atomic_long_read(&dev->rx_dropped); 5570 storage->rx_dropped += atomic_long_read(&dev->rx_dropped);
5600 return storage; 5571 return storage;