netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: jeff@garzik.org, davem@davemloft.net
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	akpm@linux-foundation.org,
	Alexander Duyck <alexander.h.duyck@intel.com>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [RESEND NET-NEXT PATCH 09/20] igb: update ethtool stats to support multiqueue
Date: Tue, 08 Jul 2008 15:07:24 -0700	[thread overview]
Message-ID: <20080708220656.1518.42888.stgit@localhost.localdomain> (raw)
In-Reply-To: <20080708220046.1518.88457.stgit@localhost.localdomain>

From: Alexander Duyck <alexander.h.duyck@intel.com>

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>
---

 drivers/net/igb/igb.h         |    1 +
 drivers/net/igb/igb_ethtool.c |   13 +++++++++----
 drivers/net/igb/igb_main.c    |    2 ++
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/net/igb/igb.h b/drivers/net/igb/igb.h
index a1431c8..5915efc 100644
--- a/drivers/net/igb/igb.h
+++ b/drivers/net/igb/igb.h
@@ -158,6 +158,7 @@ struct igb_ring {
 	union {
 		/* TX */
 		struct {
+			struct igb_queue_stats tx_stats;
 			bool detect_tx_hung;
 		};
 		/* RX */
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c
index 0447f9b..ed756c1 100644
--- a/drivers/net/igb/igb_ethtool.c
+++ b/drivers/net/igb/igb_ethtool.c
@@ -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;
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index e11a5da..f975bfe 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -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;


  parent reply	other threads:[~2008-07-08 22:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-08 22:06 [RESEND NET-NEXT PATCH 00/20] igb update for net-next Jeff Kirsher
2008-07-08 22:06 ` [RESEND NET-NEXT PATCH 08/20] igb: Introduce multiple TX queues with infrastructure Jeff Kirsher
2008-07-11  5:22   ` Jeff Garzik
2008-07-08 22:07 ` Jeff Kirsher [this message]
2008-07-08 22:07 ` [RESEND NET-NEXT PATCH 10/20] igb: add DCA support Jeff Kirsher
2008-07-08 22:08 ` [RESEND NET-NEXT PATCH 11/20] igb: reenable CRC stripping in hardware Jeff Kirsher
2008-07-08 22:09 ` [RESEND NET-NEXT PATCH 12/20] igb: Increment driver version Jeff Kirsher
2008-07-08 22:10 ` [RESEND NET-NEXT PATCH 13/20] igb: add 82576 MAC support Jeff Kirsher
2008-07-08 22:10 ` [RESEND NET-NEXT PATCH 14/20] igb: Add support for quad port WOL and feature flags Jeff Kirsher
2008-07-08 22:11 ` [RESEND NET-NEXT PATCH 15/20] igb: add page recycling support Jeff Kirsher
2008-07-08 22:12 ` [RESEND NET-NEXT PATCH 16/20] igb: add support for in kernel LRO Jeff Kirsher
2008-07-08 22:13 ` [RESEND NET-NEXT PATCH 17/20] net: add netif_napi_del function to allow for removal of napistructs Jeff Kirsher
2008-07-08 22:13 ` [RESEND NET-NEXT PATCH 18/20] igb: update suspend resume Jeff Kirsher
2008-07-08 22:14 ` [NET-NEXT PATCH 19/20] [cosmetic] igb: unused variable warning in igb remove Jeff Kirsher
2008-07-08 22:14 ` [NET-NEXT PATCH 20/20] igb: Improve multiqueue AIM support Jeff Kirsher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080708220656.1518.42888.stgit@localhost.localdomain \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.h.duyck@intel.com \
    --cc=davem@davemloft.net \
    --cc=jeff@garzik.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).