diff options
author | Ajit Khaparde <ajitkhaparde@gmail.com> | 2009-10-06 22:42:23 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-08 01:00:27 -0400 |
commit | 5fe31deffa097795aed7ab276c90287823d26497 (patch) | |
tree | a7fbbfd16edf08d8795303358e586d9bb634a9cc /drivers/net/e1000/e1000_main.c | |
parent | 8d24e93309d688d59d4b6cf0b9cffc40337e067d (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>
Diffstat (limited to 'drivers/net/e1000/e1000_main.c')
-rw-r--r-- | drivers/net/e1000/e1000_main.c | 41 |
1 files changed, 20 insertions, 21 deletions
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 | ||
3102 | static struct net_device_stats *e1000_get_stats(struct net_device *netdev) | 3102 | static 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 | ||
3197 | void e1000_update_stats(struct e1000_adapter *adapter) | 3195 | void 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 | ||