diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-07-19 09:35:40 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-07-19 09:35:40 -0700 |
commit | bd27290a593f80cb99e95287cb29c72c0d57608b (patch) | |
tree | c12dfb1cb4cfd7f7d65e34fcf53797685ec66670 /net | |
parent | db5dda905759c931ceb8f3f2fcfd7719009acc98 (diff) | |
download | linux-bd27290a593f80cb99e95287cb29c72c0d57608b.tar.bz2 |
net: 64bit stats for netdev_queue
Since struct netdev_queue tx_bytes/tx_packets/tx_dropped are already
protected by _xmit_lock, its easy to convert these fields to u64 instead
of unsigned long.
This completes 64bit stats for devices using them (vlan, macvlan, ...)
Strictly, we could avoid the locking in dev_txq_stats_fold() on 64bit
arches, but its slow path and we prefer keep it simple.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/dev.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 1c002c7ef5d5..9de75cdade56 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -5282,15 +5282,17 @@ void netdev_run_todo(void) void dev_txq_stats_fold(const struct net_device *dev, struct rtnl_link_stats64 *stats) { - unsigned long tx_bytes = 0, tx_packets = 0, tx_dropped = 0; + u64 tx_bytes = 0, tx_packets = 0, tx_dropped = 0; unsigned int i; struct netdev_queue *txq; for (i = 0; i < dev->num_tx_queues; i++) { txq = netdev_get_tx_queue(dev, i); + spin_lock_bh(&txq->_xmit_lock); tx_bytes += txq->tx_bytes; tx_packets += txq->tx_packets; tx_dropped += txq->tx_dropped; + spin_unlock_bh(&txq->_xmit_lock); } if (tx_bytes || tx_packets || tx_dropped) { stats->tx_bytes = tx_bytes; |