diff options
-rw-r--r-- | drivers/net/igb/igb.h | 1 | ||||
-rw-r--r-- | drivers/net/igb/igb_ethtool.c | 20 | ||||
-rw-r--r-- | drivers/net/igb/igb_main.c | 39 |
3 files changed, 30 insertions, 30 deletions
diff --git a/drivers/net/igb/igb.h b/drivers/net/igb/igb.h index 7126fea26fec..b805b1c63f80 100644 --- a/drivers/net/igb/igb.h +++ b/drivers/net/igb/igb.h | |||
@@ -256,7 +256,6 @@ struct igb_adapter { | |||
256 | struct net_device *netdev; | 256 | struct net_device *netdev; |
257 | struct napi_struct napi; | 257 | struct napi_struct napi; |
258 | struct pci_dev *pdev; | 258 | struct pci_dev *pdev; |
259 | struct net_device_stats net_stats; | ||
260 | struct cyclecounter cycles; | 259 | struct cyclecounter cycles; |
261 | struct timecounter clock; | 260 | struct timecounter clock; |
262 | struct timecompare compare; | 261 | struct timecompare compare; |
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c index d004c359244c..d46c3212757b 100644 --- a/drivers/net/igb/igb_ethtool.c +++ b/drivers/net/igb/igb_ethtool.c | |||
@@ -45,6 +45,8 @@ struct igb_stats { | |||
45 | 45 | ||
46 | #define IGB_STAT(m) FIELD_SIZEOF(struct igb_adapter, m), \ | 46 | #define IGB_STAT(m) FIELD_SIZEOF(struct igb_adapter, m), \ |
47 | offsetof(struct igb_adapter, m) | 47 | offsetof(struct igb_adapter, m) |
48 | #define IGB_NETDEV_STAT(m) FIELD_SIZEOF(struct net_device, m), \ | ||
49 | offsetof(struct net_device, m) | ||
48 | static const struct igb_stats igb_gstrings_stats[] = { | 50 | static const struct igb_stats igb_gstrings_stats[] = { |
49 | { "rx_packets", IGB_STAT(stats.gprc) }, | 51 | { "rx_packets", IGB_STAT(stats.gprc) }, |
50 | { "tx_packets", IGB_STAT(stats.gptc) }, | 52 | { "tx_packets", IGB_STAT(stats.gptc) }, |
@@ -54,22 +56,22 @@ static const struct igb_stats igb_gstrings_stats[] = { | |||
54 | { "tx_broadcast", IGB_STAT(stats.bptc) }, | 56 | { "tx_broadcast", IGB_STAT(stats.bptc) }, |
55 | { "rx_multicast", IGB_STAT(stats.mprc) }, | 57 | { "rx_multicast", IGB_STAT(stats.mprc) }, |
56 | { "tx_multicast", IGB_STAT(stats.mptc) }, | 58 | { "tx_multicast", IGB_STAT(stats.mptc) }, |
57 | { "rx_errors", IGB_STAT(net_stats.rx_errors) }, | 59 | { "rx_errors", IGB_NETDEV_STAT(stats.rx_errors) }, |
58 | { "tx_errors", IGB_STAT(net_stats.tx_errors) }, | 60 | { "tx_errors", IGB_NETDEV_STAT(stats.tx_errors) }, |
59 | { "tx_dropped", IGB_STAT(net_stats.tx_dropped) }, | 61 | { "tx_dropped", IGB_NETDEV_STAT(stats.tx_dropped) }, |
60 | { "multicast", IGB_STAT(stats.mprc) }, | 62 | { "multicast", IGB_STAT(stats.mprc) }, |
61 | { "collisions", IGB_STAT(stats.colc) }, | 63 | { "collisions", IGB_STAT(stats.colc) }, |
62 | { "rx_length_errors", IGB_STAT(net_stats.rx_length_errors) }, | 64 | { "rx_length_errors", IGB_NETDEV_STAT(stats.rx_length_errors) }, |
63 | { "rx_over_errors", IGB_STAT(net_stats.rx_over_errors) }, | 65 | { "rx_over_errors", IGB_NETDEV_STAT(stats.rx_over_errors) }, |
64 | { "rx_crc_errors", IGB_STAT(stats.crcerrs) }, | 66 | { "rx_crc_errors", IGB_STAT(stats.crcerrs) }, |
65 | { "rx_frame_errors", IGB_STAT(net_stats.rx_frame_errors) }, | 67 | { "rx_frame_errors", IGB_NETDEV_STAT(stats.rx_frame_errors) }, |
66 | { "rx_no_buffer_count", IGB_STAT(stats.rnbc) }, | 68 | { "rx_no_buffer_count", IGB_STAT(stats.rnbc) }, |
67 | { "rx_queue_drop_packet_count", IGB_STAT(net_stats.rx_fifo_errors) }, | 69 | { "rx_queue_drop_packet_count", IGB_NETDEV_STAT(stats.rx_fifo_errors) }, |
68 | { "rx_missed_errors", IGB_STAT(stats.mpc) }, | 70 | { "rx_missed_errors", IGB_STAT(stats.mpc) }, |
69 | { "tx_aborted_errors", IGB_STAT(stats.ecol) }, | 71 | { "tx_aborted_errors", IGB_STAT(stats.ecol) }, |
70 | { "tx_carrier_errors", IGB_STAT(stats.tncrs) }, | 72 | { "tx_carrier_errors", IGB_STAT(stats.tncrs) }, |
71 | { "tx_fifo_errors", IGB_STAT(net_stats.tx_fifo_errors) }, | 73 | { "tx_fifo_errors", IGB_NETDEV_STAT(stats.tx_fifo_errors) }, |
72 | { "tx_heartbeat_errors", IGB_STAT(net_stats.tx_heartbeat_errors) }, | 74 | { "tx_heartbeat_errors", IGB_NETDEV_STAT(stats.tx_heartbeat_errors) }, |
73 | { "tx_window_errors", IGB_STAT(stats.latecol) }, | 75 | { "tx_window_errors", IGB_STAT(stats.latecol) }, |
74 | { "tx_abort_late_coll", IGB_STAT(stats.latecol) }, | 76 | { "tx_abort_late_coll", IGB_STAT(stats.latecol) }, |
75 | { "tx_deferred_ok", IGB_STAT(stats.dc) }, | 77 | { "tx_deferred_ok", IGB_STAT(stats.dc) }, |
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index 83c083709d32..428d50475351 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -3534,10 +3534,8 @@ static void igb_reset_task(struct work_struct *work) | |||
3534 | **/ | 3534 | **/ |
3535 | static struct net_device_stats *igb_get_stats(struct net_device *netdev) | 3535 | static struct net_device_stats *igb_get_stats(struct net_device *netdev) |
3536 | { | 3536 | { |
3537 | struct igb_adapter *adapter = netdev_priv(netdev); | ||
3538 | |||
3539 | /* only return the current stats */ | 3537 | /* only return the current stats */ |
3540 | return &adapter->net_stats; | 3538 | return &netdev->stats; |
3541 | } | 3539 | } |
3542 | 3540 | ||
3543 | /** | 3541 | /** |
@@ -3623,6 +3621,7 @@ static int igb_change_mtu(struct net_device *netdev, int new_mtu) | |||
3623 | 3621 | ||
3624 | void igb_update_stats(struct igb_adapter *adapter) | 3622 | void igb_update_stats(struct igb_adapter *adapter) |
3625 | { | 3623 | { |
3624 | struct net_device *netdev = adapter->netdev; | ||
3626 | struct e1000_hw *hw = &adapter->hw; | 3625 | struct e1000_hw *hw = &adapter->hw; |
3627 | struct pci_dev *pdev = adapter->pdev; | 3626 | struct pci_dev *pdev = adapter->pdev; |
3628 | u16 phy_tmp; | 3627 | u16 phy_tmp; |
@@ -3712,8 +3711,8 @@ void igb_update_stats(struct igb_adapter *adapter) | |||
3712 | adapter->stats.icrxdmtc += rd32(E1000_ICRXDMTC); | 3711 | adapter->stats.icrxdmtc += rd32(E1000_ICRXDMTC); |
3713 | 3712 | ||
3714 | /* Fill out the OS statistics structure */ | 3713 | /* Fill out the OS statistics structure */ |
3715 | adapter->net_stats.multicast = adapter->stats.mprc; | 3714 | netdev->stats.multicast = adapter->stats.mprc; |
3716 | adapter->net_stats.collisions = adapter->stats.colc; | 3715 | netdev->stats.collisions = adapter->stats.colc; |
3717 | 3716 | ||
3718 | /* Rx Errors */ | 3717 | /* Rx Errors */ |
3719 | 3718 | ||
@@ -3734,7 +3733,7 @@ void igb_update_stats(struct igb_adapter *adapter) | |||
3734 | adapter->rx_ring[i].rx_stats.drops += rqdpc_tmp; | 3733 | adapter->rx_ring[i].rx_stats.drops += rqdpc_tmp; |
3735 | rqdpc_total += adapter->rx_ring[i].rx_stats.drops; | 3734 | rqdpc_total += adapter->rx_ring[i].rx_stats.drops; |
3736 | } | 3735 | } |
3737 | adapter->net_stats.rx_fifo_errors = rqdpc_total; | 3736 | netdev->stats.rx_fifo_errors = rqdpc_total; |
3738 | } | 3737 | } |
3739 | 3738 | ||
3740 | /* Note RNBC (Receive No Buffers Count) is an not an exact | 3739 | /* Note RNBC (Receive No Buffers Count) is an not an exact |
@@ -3742,26 +3741,26 @@ void igb_update_stats(struct igb_adapter *adapter) | |||
3742 | * one of the reason for saving it in rx_fifo_errors, as its | 3741 | * one of the reason for saving it in rx_fifo_errors, as its |
3743 | * potentially not a true drop. | 3742 | * potentially not a true drop. |
3744 | */ | 3743 | */ |
3745 | adapter->net_stats.rx_fifo_errors += adapter->stats.rnbc; | 3744 | netdev->stats.rx_fifo_errors += adapter->stats.rnbc; |
3746 | 3745 | ||
3747 | /* RLEC on some newer hardware can be incorrect so build | 3746 | /* RLEC on some newer hardware can be incorrect so build |
3748 | * our own version based on RUC and ROC */ | 3747 | * our own version based on RUC and ROC */ |
3749 | adapter->net_stats.rx_errors = adapter->stats.rxerrc + | 3748 | netdev->stats.rx_errors = adapter->stats.rxerrc + |
3750 | adapter->stats.crcerrs + adapter->stats.algnerrc + | 3749 | adapter->stats.crcerrs + adapter->stats.algnerrc + |
3751 | adapter->stats.ruc + adapter->stats.roc + | 3750 | adapter->stats.ruc + adapter->stats.roc + |
3752 | adapter->stats.cexterr; | 3751 | adapter->stats.cexterr; |
3753 | adapter->net_stats.rx_length_errors = adapter->stats.ruc + | 3752 | netdev->stats.rx_length_errors = adapter->stats.ruc + |
3754 | adapter->stats.roc; | 3753 | adapter->stats.roc; |
3755 | adapter->net_stats.rx_crc_errors = adapter->stats.crcerrs; | 3754 | netdev->stats.rx_crc_errors = adapter->stats.crcerrs; |
3756 | adapter->net_stats.rx_frame_errors = adapter->stats.algnerrc; | 3755 | netdev->stats.rx_frame_errors = adapter->stats.algnerrc; |
3757 | adapter->net_stats.rx_missed_errors = adapter->stats.mpc; | 3756 | netdev->stats.rx_missed_errors = adapter->stats.mpc; |
3758 | 3757 | ||
3759 | /* Tx Errors */ | 3758 | /* Tx Errors */ |
3760 | adapter->net_stats.tx_errors = adapter->stats.ecol + | 3759 | netdev->stats.tx_errors = adapter->stats.ecol + |
3761 | adapter->stats.latecol; | 3760 | adapter->stats.latecol; |
3762 | adapter->net_stats.tx_aborted_errors = adapter->stats.ecol; | 3761 | netdev->stats.tx_aborted_errors = adapter->stats.ecol; |
3763 | adapter->net_stats.tx_window_errors = adapter->stats.latecol; | 3762 | netdev->stats.tx_window_errors = adapter->stats.latecol; |
3764 | adapter->net_stats.tx_carrier_errors = adapter->stats.tncrs; | 3763 | netdev->stats.tx_carrier_errors = adapter->stats.tncrs; |
3765 | 3764 | ||
3766 | /* Tx Dropped needs to be maintained elsewhere */ | 3765 | /* Tx Dropped needs to be maintained elsewhere */ |
3767 | 3766 | ||
@@ -4640,8 +4639,8 @@ static bool igb_clean_tx_irq(struct igb_ring *tx_ring) | |||
4640 | tx_ring->total_packets += total_packets; | 4639 | tx_ring->total_packets += total_packets; |
4641 | tx_ring->tx_stats.bytes += total_bytes; | 4640 | tx_ring->tx_stats.bytes += total_bytes; |
4642 | tx_ring->tx_stats.packets += total_packets; | 4641 | tx_ring->tx_stats.packets += total_packets; |
4643 | adapter->net_stats.tx_bytes += total_bytes; | 4642 | netdev->stats.tx_bytes += total_bytes; |
4644 | adapter->net_stats.tx_packets += total_packets; | 4643 | netdev->stats.tx_packets += total_packets; |
4645 | return (count < tx_ring->count); | 4644 | return (count < tx_ring->count); |
4646 | } | 4645 | } |
4647 | 4646 | ||
@@ -4884,8 +4883,8 @@ next_desc: | |||
4884 | rx_ring->total_bytes += total_bytes; | 4883 | rx_ring->total_bytes += total_bytes; |
4885 | rx_ring->rx_stats.packets += total_packets; | 4884 | rx_ring->rx_stats.packets += total_packets; |
4886 | rx_ring->rx_stats.bytes += total_bytes; | 4885 | rx_ring->rx_stats.bytes += total_bytes; |
4887 | adapter->net_stats.rx_bytes += total_bytes; | 4886 | netdev->stats.rx_bytes += total_bytes; |
4888 | adapter->net_stats.rx_packets += total_packets; | 4887 | netdev->stats.rx_packets += total_packets; |
4889 | return cleaned; | 4888 | return cleaned; |
4890 | } | 4889 | } |
4891 | 4890 | ||