netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next PATCH] igb: update adapter stats when reading /proc/net/dev.
@ 2010-01-12 13:41 Jesper Dangaard Brouer
  2010-01-14  1:30 ` David Miller
  0 siblings, 1 reply; 18+ messages in thread
From: Jesper Dangaard Brouer @ 2010-01-12 13:41 UTC (permalink / raw)
  To: Jeff Kirsher, Alexander Duyck; +Cc: Jesper Dangaard Brouer, netdev

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 d967949..7207dd3 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -3862,11 +3862,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;
 }
 
@@ -3940,7 +3946,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 rnbc;


^ permalink raw reply related	[flat|nested] 18+ messages in thread
* [net-next PATCH] igb: update adapter stats when reading /proc/net/dev.
@ 2010-10-05 14:18 Jesper Dangaard Brouer
  2010-10-05 14:41 ` Eric Dumazet
  2010-10-07  6:36 ` David Miller
  0 siblings, 2 replies; 18+ messages in thread
From: Jesper Dangaard Brouer @ 2010-10-05 14:18 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Jeff Kirsher

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;


^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2010-10-07 11:36 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-12 13:41 [net-next PATCH] igb: update adapter stats when reading /proc/net/dev Jesper Dangaard Brouer
2010-01-14  1:30 ` David Miller
2010-01-14  3:01   ` Jeff Kirsher
  -- strict thread matches above, loose matches on Subject: below --
2010-10-05 14:18 Jesper Dangaard Brouer
2010-10-05 14:41 ` 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  5:47               ` 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

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