diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2009-12-08 02:22:03 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-12-08 23:10:12 -0500 |
commit | 60d51134281fbeb352013d782a440fb338d31f01 (patch) | |
tree | 36df3a263cf024612e1c62c8210bfbfe2d67a0d3 /drivers/net/ixgbe/ixgbe_ethtool.c | |
parent | 3421eecdee750bafc78b12ac25b3e980195265eb (diff) |
ixgbe: Fix TX stats accounting
Here is an updated version, because ixgbe_get_ethtool_stats()
needs to call dev_get_stats() or "ethtool -S" wont give
correct tx_bytes/tx_packets values.
Several cpus can update netdev->stats.tx_bytes & netdev->stats.tx_packets
in parallel. In this case, TX stats are under estimated and false sharing
takes place.
After a pktgen session sending exactly 200000000 packets :
# ifconfig fiber0 | grep TX
TX packets:198501982 errors:0 dropped:0 overruns:0 carrier:0
Multi queue devices should instead use txq->tx_bytes & txq->tx_packets
in their xmit() method (appropriate txq lock already held by caller, no
cache line miss), or use appropriate locking.
After patch, same pktgen session gives :
# ifconfig fiber0 | grep TX
TX packets:200000000 errors:0 dropped:0 overruns:0 carrier:0
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_ethtool.c')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_ethtool.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c index 06a9d18bbdbc..0bd49d3b9f65 100644 --- a/drivers/net/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ixgbe/ixgbe_ethtool.c | |||
@@ -990,6 +990,7 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev, | |||
990 | char *p = NULL; | 990 | char *p = NULL; |
991 | 991 | ||
992 | ixgbe_update_stats(adapter); | 992 | ixgbe_update_stats(adapter); |
993 | dev_get_stats(netdev); | ||
993 | for (i = 0; i < IXGBE_GLOBAL_STATS_LEN; i++) { | 994 | for (i = 0; i < IXGBE_GLOBAL_STATS_LEN; i++) { |
994 | switch (ixgbe_gstrings_stats[i].type) { | 995 | switch (ixgbe_gstrings_stats[i].type) { |
995 | case NETDEV_STATS: | 996 | case NETDEV_STATS: |