From: Jesper Dangaard Brouer <hawk@comx.dk>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next PATCH] igb: update adapter stats when reading /proc/net/dev.
Date: Tue, 05 Oct 2010 16:18:33 +0200 [thread overview]
Message-ID: <20101005141833.20929.10943.stgit@localhost> (raw)
Network driver igb: Improve the accuracy of stats in /proc/net/dev, by
updating the adapter stats when reading /proc/net/dev. Currently the
stats are updated by the watchdog timer every 2 sec, or when getting
stats via ethtool -S.
A number of userspace apps read these /proc/net/dev stats every second,
e.g. ifstat, which then gives a perceived very bursty traffic pattern,
which is actually false.
Signed-off-by: Jesper Dangaard Brouer <hawk@comx.dk>
---
drivers/net/igb/igb_main.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 55edcb7..6cec297 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -4218,11 +4218,17 @@ static void igb_reset_task(struct work_struct *work)
* @netdev: network interface device structure
*
* Returns the address of the device statistics structure.
- * The statistics are actually updated from the timer callback.
+ * The statistics are also updated from the timer callback
+ * igb_watchdog_task().
**/
static struct net_device_stats *igb_get_stats(struct net_device *netdev)
{
- /* only return the current stats */
+ struct igb_adapter *adapter = netdev_priv(netdev);
+
+ /* update stats */
+ igb_update_stats(adapter);
+
+ /* return the current stats */
return &netdev->stats;
}
@@ -4307,7 +4313,7 @@ static int igb_change_mtu(struct net_device *netdev, int new_mtu)
void igb_update_stats(struct igb_adapter *adapter)
{
- struct net_device_stats *net_stats = igb_get_stats(adapter->netdev);
+ struct net_device_stats *net_stats = &adapter->netdev->stats;
struct e1000_hw *hw = &adapter->hw;
struct pci_dev *pdev = adapter->pdev;
u32 reg, mpc;
next reply other threads:[~2010-10-05 14:24 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-05 14:18 Jesper Dangaard Brouer [this message]
2010-10-05 14:41 ` [net-next PATCH] igb: update adapter stats when reading /proc/net/dev Eric Dumazet
2010-10-05 14:53 ` Jesper Dangaard Brouer
2010-10-05 15:19 ` Eric Dumazet
2010-10-05 21:01 ` Eric Dumazet
2010-10-05 21:16 ` Jesper Dangaard Brouer
2010-10-05 22:34 ` Jeff Kirsher
2010-10-06 3:28 ` Eric Dumazet
2010-10-06 4:36 ` [PATCH net-next] igb: fix stats handling Eric Dumazet
2010-10-06 5:49 ` Jeff Kirsher
2010-10-06 11:36 ` Jesper Dangaard Brouer
2010-10-09 23:57 ` Tantilov, Emil S
2010-10-10 8:14 ` [PATCH net-next V2] " Eric Dumazet
2010-10-12 0:12 ` Jeff Kirsher
2010-10-06 5:47 ` [net-next PATCH] igb: update adapter stats when reading /proc/net/dev Jeff Kirsher
2010-10-07 6:36 ` David Miller
2010-10-07 6:44 ` Eric Dumazet
2010-10-07 6:46 ` David Miller
2010-10-07 10:06 ` Jesper Dangaard Brouer
2010-10-07 10:24 ` Eric Dumazet
2010-10-07 11:36 ` Jesper Dangaard Brouer
-- strict thread matches above, loose matches on Subject: below --
2010-01-12 13:41 Jesper Dangaard Brouer
2010-01-14 1:30 ` David Miller
2010-01-14 3:01 ` 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=20101005141833.20929.10943.stgit@localhost \
--to=hawk@comx.dk \
--cc=davem@davemloft.net \
--cc=jeffrey.t.kirsher@intel.com \
--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).