aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000e
diff options
context:
space:
mode:
authorAjit Khaparde <ajitkhaparde@gmail.com>2009-10-06 22:44:26 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-08 01:00:24 -0400
commit7274c20f7b6a7bd6e3e8441e1727bf9cfd8235bb (patch)
treea46cdcbea0a4cee1952b539b742aaf1ac1bc590c /drivers/net/e1000e
parent72dad218f872dbd53f5dc5df9df45709e4b77870 (diff)
e1000e: 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 private adapter structure. Signed-off-by: Ajit Khaparde <ajitk@serverengines.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/e1000e')
-rw-r--r--drivers/net/e1000e/e1000.h1
-rw-r--r--drivers/net/e1000e/ethtool.c18
-rw-r--r--drivers/net/e1000e/netdev.c43
3 files changed, 31 insertions, 31 deletions
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
index 981936c1fb46..1211df9ae883 100644
--- a/drivers/net/e1000e/e1000.h
+++ b/drivers/net/e1000e/e1000.h
@@ -315,7 +315,6 @@ struct e1000_adapter {
315 /* OS defined structs */ 315 /* OS defined structs */
316 struct net_device *netdev; 316 struct net_device *netdev;
317 struct pci_dev *pdev; 317 struct pci_dev *pdev;
318 struct net_device_stats net_stats;
319 318
320 /* structs defined in e1000_hw.h */ 319 /* structs defined in e1000_hw.h */
321 struct e1000_hw hw; 320 struct e1000_hw hw;
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index 1bf4d2a5d34f..8a78a143e591 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -43,6 +43,8 @@ struct e1000_stats {
43 43
44#define E1000_STAT(m) sizeof(((struct e1000_adapter *)0)->m), \ 44#define E1000_STAT(m) sizeof(((struct e1000_adapter *)0)->m), \
45 offsetof(struct e1000_adapter, m) 45 offsetof(struct e1000_adapter, m)
46#define E1000_NETDEV_STAT(m) sizeof(((struct net_device *)0)->m), \
47 offsetof(struct net_device, m)
46static const struct e1000_stats e1000_gstrings_stats[] = { 48static const struct e1000_stats e1000_gstrings_stats[] = {
47 { "rx_packets", E1000_STAT(stats.gprc) }, 49 { "rx_packets", E1000_STAT(stats.gprc) },
48 { "tx_packets", E1000_STAT(stats.gptc) }, 50 { "tx_packets", E1000_STAT(stats.gptc) },
@@ -52,21 +54,21 @@ static const struct e1000_stats e1000_gstrings_stats[] = {
52 { "tx_broadcast", E1000_STAT(stats.bptc) }, 54 { "tx_broadcast", E1000_STAT(stats.bptc) },
53 { "rx_multicast", E1000_STAT(stats.mprc) }, 55 { "rx_multicast", E1000_STAT(stats.mprc) },
54 { "tx_multicast", E1000_STAT(stats.mptc) }, 56 { "tx_multicast", E1000_STAT(stats.mptc) },
55 { "rx_errors", E1000_STAT(net_stats.rx_errors) }, 57 { "rx_errors", E1000_NETDEV_STAT(stats.rx_errors) },
56 { "tx_errors", E1000_STAT(net_stats.tx_errors) }, 58 { "tx_errors", E1000_NETDEV_STAT(stats.tx_errors) },
57 { "tx_dropped", E1000_STAT(net_stats.tx_dropped) }, 59 { "tx_dropped", E1000_NETDEV_STAT(stats.tx_dropped) },
58 { "multicast", E1000_STAT(stats.mprc) }, 60 { "multicast", E1000_STAT(stats.mprc) },
59 { "collisions", E1000_STAT(stats.colc) }, 61 { "collisions", E1000_STAT(stats.colc) },
60 { "rx_length_errors", E1000_STAT(net_stats.rx_length_errors) }, 62 { "rx_length_errors", E1000_NETDEV_STAT(stats.rx_length_errors) },
61 { "rx_over_errors", E1000_STAT(net_stats.rx_over_errors) }, 63 { "rx_over_errors", E1000_NETDEV_STAT(stats.rx_over_errors) },
62 { "rx_crc_errors", E1000_STAT(stats.crcerrs) }, 64 { "rx_crc_errors", E1000_STAT(stats.crcerrs) },
63 { "rx_frame_errors", E1000_STAT(net_stats.rx_frame_errors) }, 65 { "rx_frame_errors", E1000_NETDEV_STAT(stats.rx_frame_errors) },
64 { "rx_no_buffer_count", E1000_STAT(stats.rnbc) }, 66 { "rx_no_buffer_count", E1000_STAT(stats.rnbc) },
65 { "rx_missed_errors", E1000_STAT(stats.mpc) }, 67 { "rx_missed_errors", E1000_STAT(stats.mpc) },
66 { "tx_aborted_errors", E1000_STAT(stats.ecol) }, 68 { "tx_aborted_errors", E1000_STAT(stats.ecol) },
67 { "tx_carrier_errors", E1000_STAT(stats.tncrs) }, 69 { "tx_carrier_errors", E1000_STAT(stats.tncrs) },
68 { "tx_fifo_errors", E1000_STAT(net_stats.tx_fifo_errors) }, 70 { "tx_fifo_errors", E1000_NETDEV_STAT(stats.tx_fifo_errors) },
69 { "tx_heartbeat_errors", E1000_STAT(net_stats.tx_heartbeat_errors) }, 71 { "tx_heartbeat_errors", E1000_NETDEV_STAT(stats.tx_heartbeat_errors) },
70 { "tx_window_errors", E1000_STAT(stats.latecol) }, 72 { "tx_window_errors", E1000_STAT(stats.latecol) },
71 { "tx_abort_late_coll", E1000_STAT(stats.latecol) }, 73 { "tx_abort_late_coll", E1000_STAT(stats.latecol) },
72 { "tx_deferred_ok", E1000_STAT(stats.dc) }, 74 { "tx_deferred_ok", E1000_STAT(stats.dc) },
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 0687c6aa4e46..21af3984e5c2 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -560,8 +560,8 @@ next_desc:
560 560
561 adapter->total_rx_bytes += total_rx_bytes; 561 adapter->total_rx_bytes += total_rx_bytes;
562 adapter->total_rx_packets += total_rx_packets; 562 adapter->total_rx_packets += total_rx_packets;
563 adapter->net_stats.rx_bytes += total_rx_bytes; 563 netdev->stats.rx_bytes += total_rx_bytes;
564 adapter->net_stats.rx_packets += total_rx_packets; 564 netdev->stats.rx_packets += total_rx_packets;
565 return cleaned; 565 return cleaned;
566} 566}
567 567
@@ -690,8 +690,8 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter)
690 } 690 }
691 adapter->total_tx_bytes += total_tx_bytes; 691 adapter->total_tx_bytes += total_tx_bytes;
692 adapter->total_tx_packets += total_tx_packets; 692 adapter->total_tx_packets += total_tx_packets;
693 adapter->net_stats.tx_bytes += total_tx_bytes; 693 netdev->stats.tx_bytes += total_tx_bytes;
694 adapter->net_stats.tx_packets += total_tx_packets; 694 netdev->stats.tx_packets += total_tx_packets;
695 return (count < tx_ring->count); 695 return (count < tx_ring->count);
696} 696}
697 697
@@ -871,8 +871,8 @@ next_desc:
871 871
872 adapter->total_rx_bytes += total_rx_bytes; 872 adapter->total_rx_bytes += total_rx_bytes;
873 adapter->total_rx_packets += total_rx_packets; 873 adapter->total_rx_packets += total_rx_packets;
874 adapter->net_stats.rx_bytes += total_rx_bytes; 874 netdev->stats.rx_bytes += total_rx_bytes;
875 adapter->net_stats.rx_packets += total_rx_packets; 875 netdev->stats.rx_packets += total_rx_packets;
876 return cleaned; 876 return cleaned;
877} 877}
878 878
@@ -1051,8 +1051,8 @@ next_desc:
1051 1051
1052 adapter->total_rx_bytes += total_rx_bytes; 1052 adapter->total_rx_bytes += total_rx_bytes;
1053 adapter->total_rx_packets += total_rx_packets; 1053 adapter->total_rx_packets += total_rx_packets;
1054 adapter->net_stats.rx_bytes += total_rx_bytes; 1054 netdev->stats.rx_bytes += total_rx_bytes;
1055 adapter->net_stats.rx_packets += total_rx_packets; 1055 netdev->stats.rx_packets += total_rx_packets;
1056 return cleaned; 1056 return cleaned;
1057} 1057}
1058 1058
@@ -3287,6 +3287,7 @@ static void e1000_update_phy_info(unsigned long data)
3287 **/ 3287 **/
3288void e1000e_update_stats(struct e1000_adapter *adapter) 3288void e1000e_update_stats(struct e1000_adapter *adapter)
3289{ 3289{
3290 struct net_device *netdev = adapter->netdev;
3290 struct e1000_hw *hw = &adapter->hw; 3291 struct e1000_hw *hw = &adapter->hw;
3291 struct pci_dev *pdev = adapter->pdev; 3292 struct pci_dev *pdev = adapter->pdev;
3292 u16 phy_data; 3293 u16 phy_data;
@@ -3381,8 +3382,8 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
3381 adapter->stats.tsctfc += er32(TSCTFC); 3382 adapter->stats.tsctfc += er32(TSCTFC);
3382 3383
3383 /* Fill out the OS statistics structure */ 3384 /* Fill out the OS statistics structure */
3384 adapter->net_stats.multicast = adapter->stats.mprc; 3385 netdev->stats.multicast = adapter->stats.mprc;
3385 adapter->net_stats.collisions = adapter->stats.colc; 3386 netdev->stats.collisions = adapter->stats.colc;
3386 3387
3387 /* Rx Errors */ 3388 /* Rx Errors */
3388 3389
@@ -3390,22 +3391,22 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
3390 * RLEC on some newer hardware can be incorrect so build 3391 * RLEC on some newer hardware can be incorrect so build
3391 * our own version based on RUC and ROC 3392 * our own version based on RUC and ROC
3392 */ 3393 */
3393 adapter->net_stats.rx_errors = adapter->stats.rxerrc + 3394 netdev->stats.rx_errors = adapter->stats.rxerrc +
3394 adapter->stats.crcerrs + adapter->stats.algnerrc + 3395 adapter->stats.crcerrs + adapter->stats.algnerrc +
3395 adapter->stats.ruc + adapter->stats.roc + 3396 adapter->stats.ruc + adapter->stats.roc +
3396 adapter->stats.cexterr; 3397 adapter->stats.cexterr;
3397 adapter->net_stats.rx_length_errors = adapter->stats.ruc + 3398 netdev->stats.rx_length_errors = adapter->stats.ruc +
3398 adapter->stats.roc; 3399 adapter->stats.roc;
3399 adapter->net_stats.rx_crc_errors = adapter->stats.crcerrs; 3400 netdev->stats.rx_crc_errors = adapter->stats.crcerrs;
3400 adapter->net_stats.rx_frame_errors = adapter->stats.algnerrc; 3401 netdev->stats.rx_frame_errors = adapter->stats.algnerrc;
3401 adapter->net_stats.rx_missed_errors = adapter->stats.mpc; 3402 netdev->stats.rx_missed_errors = adapter->stats.mpc;
3402 3403
3403 /* Tx Errors */ 3404 /* Tx Errors */
3404 adapter->net_stats.tx_errors = adapter->stats.ecol + 3405 netdev->stats.tx_errors = adapter->stats.ecol +
3405 adapter->stats.latecol; 3406 adapter->stats.latecol;
3406 adapter->net_stats.tx_aborted_errors = adapter->stats.ecol; 3407 netdev->stats.tx_aborted_errors = adapter->stats.ecol;
3407 adapter->net_stats.tx_window_errors = adapter->stats.latecol; 3408 netdev->stats.tx_window_errors = adapter->stats.latecol;
3408 adapter->net_stats.tx_carrier_errors = adapter->stats.tncrs; 3409 netdev->stats.tx_carrier_errors = adapter->stats.tncrs;
3409 3410
3410 /* Tx Dropped needs to be maintained elsewhere */ 3411 /* Tx Dropped needs to be maintained elsewhere */
3411 3412
@@ -4254,10 +4255,8 @@ static void e1000_reset_task(struct work_struct *work)
4254 **/ 4255 **/
4255static struct net_device_stats *e1000_get_stats(struct net_device *netdev) 4256static struct net_device_stats *e1000_get_stats(struct net_device *netdev)
4256{ 4257{
4257 struct e1000_adapter *adapter = netdev_priv(netdev);
4258
4259 /* only return the current stats */ 4258 /* only return the current stats */
4260 return &adapter->net_stats; 4259 return &netdev->stats;
4261} 4260}
4262 4261
4263/** 4262/**