Skip to contentSkip to conversation

e1000: Use the instance of net_device_stats from net_device.

PATCH In review Ajit Khaparde 2 participants 2 messages Oct 7, 2009

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

PATCH 1/1 e1000: Use the instance of net_device_stats from net_device.

Since net_device has an instance of net_device_stats, we can remove the instance of this from the adapter structure.

---
 drivers/net/e1000/e1000.h         |    1 -
 drivers/net/e1000/e1000_ethtool.c |   12 ++++++----
 drivers/net/e1000/e1000_main.c    |   41 ++++++++++++++++++-------------------
 3 files changed, 27 insertions(+), 27 deletions(-)
drivers/net/e1000/e1000.h +0 -1
index 42e2b7e..a566528 100644
@@ -302,7 +302,6 @@ struct e1000_adapter {
 	/* OS defined structs */
 	struct net_device *netdev;
 	struct pci_dev *pdev;
-	struct net_device_stats net_stats;
 
 	/* structs defined in e1000_hw.h */
 	struct e1000_hw hw;
drivers/net/e1000/e1000_ethtool.c +7 -5
index 490b2b7..e25b339 100644
@@ -39,6 +39,8 @@ struct e1000_stats {
 
 #define E1000_STAT(m) FIELD_SIZEOF(struct e1000_adapter, m), \
 		      offsetof(struct e1000_adapter, m)
+#define E1000_NETDEV_STAT(m) FIELD_SIZEOF(struct net_device, m), \
+		      offsetof(struct net_device, m)
 static const struct e1000_stats e1000_gstrings_stats[] = {
 	{ "rx_packets", E1000_STAT(stats.gprc) },
 	{ "tx_packets", E1000_STAT(stats.gptc) },
@@ -50,19 +52,19 @@ static const struct e1000_stats e1000_gstrings_stats[] = {
 	{ "tx_multicast", E1000_STAT(stats.mptc) },
 	{ "rx_errors", E1000_STAT(stats.rxerrc) },
 	{ "tx_errors", E1000_STAT(stats.txerrc) },
-	{ "tx_dropped", E1000_STAT(net_stats.tx_dropped) },
+	{ "tx_dropped", E1000_NETDEV_STAT(stats.tx_dropped) },
 	{ "multicast", E1000_STAT(stats.mprc) },
 	{ "collisions", E1000_STAT(stats.colc) },
 	{ "rx_length_errors", E1000_STAT(stats.rlerrc) },
-	{ "rx_over_errors", E1000_STAT(net_stats.rx_over_errors) },
+	{ "rx_over_errors", E1000_NETDEV_STAT(stats.rx_over_errors) },
 	{ "rx_crc_errors", E1000_STAT(stats.crcerrs) },
-	{ "rx_frame_errors", E1000_STAT(net_stats.rx_frame_errors) },
+	{ "rx_frame_errors", E1000_NETDEV_STAT(stats.rx_frame_errors) },
 	{ "rx_no_buffer_count", E1000_STAT(stats.rnbc) },
 	{ "rx_missed_errors", E1000_STAT(stats.mpc) },
 	{ "tx_aborted_errors", E1000_STAT(stats.ecol) },
 	{ "tx_carrier_errors", E1000_STAT(stats.tncrs) },
-	{ "tx_fifo_errors", E1000_STAT(net_stats.tx_fifo_errors) },
-	{ "tx_heartbeat_errors", E1000_STAT(net_stats.tx_heartbeat_errors) },
+	{ "tx_fifo_errors", E1000_NETDEV_STAT(stats.tx_fifo_errors) },
+	{ "tx_heartbeat_errors", E1000_NETDEV_STAT(stats.tx_heartbeat_errors) },
 	{ "tx_window_errors", E1000_STAT(stats.latecol) },
 	{ "tx_abort_late_coll", E1000_STAT(stats.latecol) },
 	{ "tx_deferred_ok", E1000_STAT(stats.dc) },
drivers/net/e1000/e1000_main.c +20 -21

92 lines not on this page · raw message

Signature · 1 line
1.6.0.4
#1 lore raw
Quoted 10 lines · Ajit Khaparde

Since net_device has an instance of net_device_stats, we can remove the instance of this from the adapter structure.

---
 drivers/net/e1000/e1000.h         |    1 - drivers/net/e1000/e1000_ethtool.c |   12 ++++++---- drivers/net/e1000/e1000_main.c    |   41 ++++++++++++++++++-------------------

 3 files changed, 27 insertions(+), 27 deletions(-)

I have added this patch to my tree for testing purposes, thanks.

Signature · 2 lines
Cheers,
Jeff