Skip to contentSkip to conversation

igb: fix stats handling

PATCH Applied Jeff Kirsher 2 participants 2 messages Oct 16, 2010 – Oct 18, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 igb: fix stats handling

From: Eric Dumazet <[email protected]>

There are currently some problems with igb.

- On 32bit arches, maintaining 64bit counters without proper synchronization between writers and readers.

- Stats updated every two seconds, as reported by Jesper. (Jesper provided a patch for this)

- Potential problem between worker thread and ethtool -S

This patch uses u64_stats_sync, and convert everything to be 64bit safe, SMP safe, even on 32bit arches. It integrates Jesper idea of providing accurate stats at the time user reads them.

---

 drivers/net/igb/igb.h         |    9 +++
 drivers/net/igb/igb_ethtool.c |   52 ++++++++++++++-----
 drivers/net/igb/igb_main.c    |  113 ++++++++++++++++++++++++++++++-----------
 3 files changed, 129 insertions(+), 45 deletions(-)
drivers/net/igb/igb.h +8 -1
index 44e0ff1..edab9c4 100644
@@ -159,6 +159,7 @@ struct igb_tx_queue_stats {
 	u64 packets;
 	u64 bytes;
 	u64 restart_queue;
+	u64 restart_queue2;
 };
 
 struct igb_rx_queue_stats {
@@ -210,11 +211,14 @@ struct igb_ring {
 		/* TX */
 		struct {
 			struct igb_tx_queue_stats tx_stats;
+			struct u64_stats_sync tx_syncp;
+			struct u64_stats_sync tx_syncp2;
 			bool detect_tx_hung;
 		};
 		/* RX */
 		struct {
 			struct igb_rx_queue_stats rx_stats;
+			struct u64_stats_sync rx_syncp;
 			u32 rx_buffer_len;
 		};
 	};
@@ -288,6 +292,9 @@ struct igb_adapter {
 	struct timecompare compare;
 	struct hwtstamp_config hwtstamp_config;
 
+	spinlock_t stats64_lock;
+	struct rtnl_link_stats64 stats64;
+
 	/* structs defined in e1000_hw.h */
 	struct e1000_hw hw;
 	struct e1000_hw_stats stats;
@@ -357,7 +364,7 @@ extern netdev_tx_t igb_xmit_frame_ring_adv(struct sk_buff *, struct igb_ring *);
 extern void igb_unmap_and_free_tx_resource(struct igb_ring *,
 					   struct igb_buffer *);
 extern void igb_alloc_rx_buffers_adv(struct igb_ring *, int);
-extern void igb_update_stats(struct igb_adapter *);
+extern void igb_update_stats(struct igb_adapter *, struct rtnl_link_stats64 *);
 extern bool igb_has_link(struct igb_adapter *adapter);
 extern void igb_set_ethtool_ops(struct net_device *);
 extern void igb_power_up_link(struct igb_adapter *);
drivers/net/igb/igb_ethtool.c +38 -14

81 lines not on this page · raw message

drivers/net/igb/igb_main.c +83 -30

264 lines not on this page · raw message

maintainer Applied
#1 lore raw

From: Jeff Kirsher <[email protected]>
Date: Fri, 15 Oct 2010 20:27:10 -0700

Quoted 12 lines

From: Eric Dumazet <[email protected]>

There are currently some problems with igb.

- On 32bit arches, maintaining 64bit counters without proper synchronization between writers and readers.

- Stats updated every two seconds, as reported by Jesper. (Jesper provided a patch for this)

- Potential problem between worker thread and ethtool -S

Quoted 7 lines

This patch uses u64_stats_sync, and convert everything to be 64bit safe, SMP safe, even on 32bit arches. It integrates Jesper idea of providing accurate stats at the time user reads them.

Applied.