aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAjit Khaparde <ajitkhaparde@gmail.com>2009-10-06 22:42:23 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-08 01:00:27 -0400
commit5fe31deffa097795aed7ab276c90287823d26497 (patch)
treea7fbbfd16edf08d8795303358e586d9bb634a9cc
parent8d24e93309d688d59d4b6cf0b9cffc40337e067d (diff)
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. Signed-off-by: Ajit Khaparde <ajitk@serverengines.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/e1000/e1000.h1
-rw-r--r--drivers/net/e1000/e1000_ethtool.c12
-rw-r--r--drivers/net/e1000/e1000_main.c41
3 files changed, 27 insertions, 27 deletions
diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
index 42e2b7e21c29..a5665287bd64 100644
--- a/drivers/net/e1000/e1000.h
+++ b/drivers/net/e1000/e1000.h
@@ -302,7 +302,6 @@ struct e1000_adapter {
302 /* OS defined structs */ 302 /* OS defined structs */
303 struct net_device *netdev; 303 struct net_device *netdev;
304 struct pci_dev *pdev; 304 struct pci_dev *pdev;
305 struct net_device_stats net_stats;
306 305
307 /* structs defined in e1000_hw.h */ 306 /* structs defined in e1000_hw.h */
308 struct e1000_hw hw; 307 struct e1000_hw hw;
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index 490b2b7cd3ab..e25b339eb5bd 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -39,6 +39,8 @@ struct e1000_stats {
39 39
40#define E1000_STAT(m) FIELD_SIZEOF(struct e1000_adapter, m), \ 40#define E1000_STAT(m) FIELD_SIZEOF(struct e1000_adapter, m), \
41 offsetof(struct e1000_adapter, m) 41 offsetof(struct e1000_adapter, m)
42#define E1000_NETDEV_STAT(m) FIELD_SIZEOF(struct net_device, m), \
43 offsetof(struct net_device, m)
42static const struct e1000_stats e1000_gstrings_stats[] = { 44static const struct e1000_stats e1000_gstrings_stats[] = {
43 { "rx_packets", E1000_STAT(stats.gprc) }, 45 { "rx_packets", E1000_STAT(stats.gprc) },
44 { "tx_packets", E1000_STAT(stats.gptc) }, 46 { "tx_packets", E1000_STAT(stats.gptc) },
@@ -50,19 +52,19 @@ static const struct e1000_stats e1000_gstrings_stats[] = {
50 { "tx_multicast", E1000_STAT(stats.mptc) }, 52 { "tx_multicast", E1000_STAT(stats.mptc) },
51 { "rx_errors", E1000_STAT(stats.rxerrc) }, 53 { "rx_errors", E1000_STAT(stats.rxerrc) },
52 { "tx_errors", E1000_STAT(stats.txerrc) }, 54 { "tx_errors", E1000_STAT(stats.txerrc) },
53 { "tx_dropped", E1000_STAT(net_stats.tx_dropped) }, 55 { "tx_dropped", E1000_NETDEV_STAT(stats.tx_dropped) },
54 { "multicast", E1000_STAT(stats.mprc) }, 56 { "multicast", E1000_STAT(stats.mprc) },
55 { "collisions", E1000_STAT(stats.colc) }, 57 { "collisions", E1000_STAT(stats.colc) },
56 { "rx_length_errors", E1000_STAT(stats.rlerrc) }, 58 { "rx_length_errors", E1000_STAT(stats.rlerrc) },
57 { "rx_over_errors", E1000_STAT(net_stats.rx_over_errors) }, 59 { "rx_over_errors", E1000_NETDEV_STAT(stats.rx_over_errors) },
58 { "rx_crc_errors", E1000_STAT(stats.crcerrs) }, 60 { "rx_crc_errors", E1000_STAT(stats.crcerrs) },
59 { "rx_frame_errors", E1000_STAT(net_stats.rx_frame_errors) }, 61 { "rx_frame_errors", E1000_NETDEV_STAT(stats.rx_frame_errors) },
60 { "rx_no_buffer_count", E1000_STAT(stats.rnbc) }, 62 { "rx_no_buffer_count", E1000_STAT(stats.rnbc) },
61 { "rx_missed_errors", E1000_STAT(stats.mpc) }, 63 { "rx_missed_errors", E1000_STAT(stats.mpc) },
62 { "tx_aborted_errors", E1000_STAT(stats.ecol) }, 64 { "tx_aborted_errors", E1000_STAT(stats.ecol) },
63 { "tx_carrier_errors", E1000_STAT(stats.tncrs) }, 65 { "tx_carrier_errors", E1000_STAT(stats.tncrs) },
64 { "tx_fifo_errors", E1000_STAT(net_stats.tx_fifo_errors) }, 66 { "tx_fifo_errors", E1000_NETDEV_STAT(stats.tx_fifo_errors) },
65 { "tx_heartbeat_errors", E1000_STAT(net_stats.tx_heartbeat_errors) }, 67 { "tx_heartbeat_errors", E1000_NETDEV_STAT(stats.tx_heartbeat_errors) },
66 { "tx_window_errors", E1000_STAT(stats.latecol) }, 68 { "tx_window_errors", E1000_STAT(stats.latecol) },
67 { "tx_abort_late_coll", E1000_STAT(stats.latecol) }, 69 { "tx_abort_late_coll", E1000_STAT(stats.latecol) },
68 { "tx_deferred_ok", E1000_STAT(stats.dc) }, 70 { "tx_deferred_ok", E1000_STAT(stats.dc) },
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index bcd192ca47b0..6a6141482979 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3101,10 +3101,8 @@ static void e1000_reset_task(struct work_struct *work)
3101 3101
3102static struct net_device_stats *e1000_get_stats(struct net_device *netdev) 3102static struct net_device_stats *e1000_get_stats(struct net_device *netdev)
3103{ 3103{
3104 struct e1000_adapter *adapter = netdev_priv(netdev);
3105
3106 /* only return the current stats */ 3104 /* only return the current stats */
3107 return &adapter->net_stats; 3105 return &netdev->stats;
3108} 3106}
3109 3107
3110/** 3108/**
@@ -3196,6 +3194,7 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
3196 3194
3197void e1000_update_stats(struct e1000_adapter *adapter) 3195void e1000_update_stats(struct e1000_adapter *adapter)
3198{ 3196{
3197 struct net_device *netdev = adapter->netdev;
3199 struct e1000_hw *hw = &adapter->hw; 3198 struct e1000_hw *hw = &adapter->hw;
3200 struct pci_dev *pdev = adapter->pdev; 3199 struct pci_dev *pdev = adapter->pdev;
3201 unsigned long flags; 3200 unsigned long flags;
@@ -3288,32 +3287,32 @@ void e1000_update_stats(struct e1000_adapter *adapter)
3288 } 3287 }
3289 3288
3290 /* Fill out the OS statistics structure */ 3289 /* Fill out the OS statistics structure */
3291 adapter->net_stats.multicast = adapter->stats.mprc; 3290 netdev->stats.multicast = adapter->stats.mprc;
3292 adapter->net_stats.collisions = adapter->stats.colc; 3291 netdev->stats.collisions = adapter->stats.colc;
3293 3292
3294 /* Rx Errors */ 3293 /* Rx Errors */
3295 3294
3296 /* RLEC on some newer hardware can be incorrect so build 3295 /* RLEC on some newer hardware can be incorrect so build
3297 * our own version based on RUC and ROC */ 3296 * our own version based on RUC and ROC */
3298 adapter->net_stats.rx_errors = adapter->stats.rxerrc + 3297 netdev->stats.rx_errors = adapter->stats.rxerrc +
3299 adapter->stats.crcerrs + adapter->stats.algnerrc + 3298 adapter->stats.crcerrs + adapter->stats.algnerrc +
3300 adapter->stats.ruc + adapter->stats.roc + 3299 adapter->stats.ruc + adapter->stats.roc +
3301 adapter->stats.cexterr; 3300 adapter->stats.cexterr;
3302 adapter->stats.rlerrc = adapter->stats.ruc + adapter->stats.roc; 3301 adapter->stats.rlerrc = adapter->stats.ruc + adapter->stats.roc;
3303 adapter->net_stats.rx_length_errors = adapter->stats.rlerrc; 3302 netdev->stats.rx_length_errors = adapter->stats.rlerrc;
3304 adapter->net_stats.rx_crc_errors = adapter->stats.crcerrs; 3303 netdev->stats.rx_crc_errors = adapter->stats.crcerrs;
3305 adapter->net_stats.rx_frame_errors = adapter->stats.algnerrc; 3304 netdev->stats.rx_frame_errors = adapter->stats.algnerrc;
3306 adapter->net_stats.rx_missed_errors = adapter->stats.mpc; 3305 netdev->stats.rx_missed_errors = adapter->stats.mpc;
3307 3306
3308 /* Tx Errors */ 3307 /* Tx Errors */
3309 adapter->stats.txerrc = adapter->stats.ecol + adapter->stats.latecol; 3308 adapter->stats.txerrc = adapter->stats.ecol + adapter->stats.latecol;
3310 adapter->net_stats.tx_errors = adapter->stats.txerrc; 3309 netdev->stats.tx_errors = adapter->stats.txerrc;
3311 adapter->net_stats.tx_aborted_errors = adapter->stats.ecol; 3310 netdev->stats.tx_aborted_errors = adapter->stats.ecol;
3312 adapter->net_stats.tx_window_errors = adapter->stats.latecol; 3311 netdev->stats.tx_window_errors = adapter->stats.latecol;
3313 adapter->net_stats.tx_carrier_errors = adapter->stats.tncrs; 3312 netdev->stats.tx_carrier_errors = adapter->stats.tncrs;
3314 if (hw->bad_tx_carr_stats_fd && 3313 if (hw->bad_tx_carr_stats_fd &&
3315 adapter->link_duplex == FULL_DUPLEX) { 3314 adapter->link_duplex == FULL_DUPLEX) {
3316 adapter->net_stats.tx_carrier_errors = 0; 3315 netdev->stats.tx_carrier_errors = 0;
3317 adapter->stats.tncrs = 0; 3316 adapter->stats.tncrs = 0;
3318 } 3317 }
3319 3318
@@ -3514,8 +3513,8 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter,
3514 } 3513 }
3515 adapter->total_tx_bytes += total_tx_bytes; 3514 adapter->total_tx_bytes += total_tx_bytes;
3516 adapter->total_tx_packets += total_tx_packets; 3515 adapter->total_tx_packets += total_tx_packets;
3517 adapter->net_stats.tx_bytes += total_tx_bytes; 3516 netdev->stats.tx_bytes += total_tx_bytes;
3518 adapter->net_stats.tx_packets += total_tx_packets; 3517 netdev->stats.tx_packets += total_tx_packets;
3519 return (count < tx_ring->count); 3518 return (count < tx_ring->count);
3520} 3519}
3521 3520
@@ -3767,8 +3766,8 @@ next_desc:
3767 3766
3768 adapter->total_rx_packets += total_rx_packets; 3767 adapter->total_rx_packets += total_rx_packets;
3769 adapter->total_rx_bytes += total_rx_bytes; 3768 adapter->total_rx_bytes += total_rx_bytes;
3770 adapter->net_stats.rx_bytes += total_rx_bytes; 3769 netdev->stats.rx_bytes += total_rx_bytes;
3771 adapter->net_stats.rx_packets += total_rx_packets; 3770 netdev->stats.rx_packets += total_rx_packets;
3772 return cleaned; 3771 return cleaned;
3773} 3772}
3774 3773
@@ -3916,8 +3915,8 @@ next_desc:
3916 3915
3917 adapter->total_rx_packets += total_rx_packets; 3916 adapter->total_rx_packets += total_rx_packets;
3918 adapter->total_rx_bytes += total_rx_bytes; 3917 adapter->total_rx_bytes += total_rx_bytes;
3919 adapter->net_stats.rx_bytes += total_rx_bytes; 3918 netdev->stats.rx_bytes += total_rx_bytes;
3920 adapter->net_stats.rx_packets += total_rx_packets; 3919 netdev->stats.rx_packets += total_rx_packets;
3921 return cleaned; 3920 return cleaned;
3922} 3921}
3923 3922