igb: update ethtool stats to support multiqueue
authorAlexander Duyck <alexander.h.duyck@intel.com>
Tue, 8 Jul 2008 22:07:24 +0000 (15:07 -0700)
committerJeff Garzik <jgarzik@redhat.com>
Fri, 11 Jul 2008 05:20:31 +0000 (01:20 -0400)
Addesses problems seen earlier with igb driver not correctly reporting rx
and tx stats.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
drivers/net/igb/igb.h
drivers/net/igb/igb_ethtool.c
drivers/net/igb/igb_main.c

index a1431c8797b9fa16fc2368efe55d24c56da70458..5915efccbcabdefde06b53c171620fbad1b263d5 100644 (file)
@@ -158,6 +158,7 @@ struct igb_ring {
        union {
                /* TX */
                struct {
+                       struct igb_queue_stats tx_stats;
                        bool detect_tx_hung;
                };
                /* RX */
index 0447f9bcd27abc5fe588c72cf7220fe66534e8aa..ed756c12aba6bcbfea802f0367c3779419dc0e91 100644 (file)
@@ -96,10 +96,8 @@ static const struct igb_stats igb_gstrings_stats[] = {
 };
 
 #define IGB_QUEUE_STATS_LEN \
-       ((((((struct igb_adapter *)netdev->priv)->num_rx_queues > 1) ? \
-         ((struct igb_adapter *)netdev->priv)->num_rx_queues : 0) + \
-        (((((struct igb_adapter *)netdev->priv)->num_tx_queues > 1) ? \
-         ((struct igb_adapter *)netdev->priv)->num_tx_queues : 0))) * \
+       ((((struct igb_adapter *)netdev->priv)->num_rx_queues + \
+        ((struct igb_adapter *)netdev->priv)->num_tx_queues) * \
        (sizeof(struct igb_queue_stats) / sizeof(u64)))
 #define IGB_GLOBAL_STATS_LEN   \
        sizeof(igb_gstrings_stats) / sizeof(struct igb_stats)
@@ -1842,6 +1840,13 @@ static void igb_get_ethtool_stats(struct net_device *netdev,
                data[i] = (igb_gstrings_stats[i].sizeof_stat ==
                        sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
        }
+       for (j = 0; j < adapter->num_tx_queues; j++) {
+               int k;
+               queue_stat = (u64 *)&adapter->tx_ring[j].tx_stats;
+               for (k = 0; k < stat_count; k++)
+                       data[i + k] = queue_stat[k];
+               i += k;
+       }
        for (j = 0; j < adapter->num_rx_queues; j++) {
                int k;
                queue_stat = (u64 *)&adapter->rx_ring[j].rx_stats;
index e11a5dae668a4bc295e9b83840465d4de521f534..f975bfec226525d36cc5e82dbe0e89f406c4a4f3 100644 (file)
@@ -3431,6 +3431,8 @@ done_cleaning:
        }
        tx_ring->total_bytes += total_bytes;
        tx_ring->total_packets += total_packets;
+       tx_ring->tx_stats.bytes += total_bytes;
+       tx_ring->tx_stats.packets += total_packets;
        adapter->net_stats.tx_bytes += total_bytes;
        adapter->net_stats.tx_packets += total_packets;
        return retval;