diff options
author | Alexander Duyck <alexander.h.duyck@intel.com> | 2009-10-27 19:48:12 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-28 06:25:43 -0400 |
commit | 3f9c01648146a256d8238292ac9c63fed7e00473 (patch) | |
tree | a9c313ab74f20c4dc3705a502aa1f73baac48dc7 | |
parent | a6b623e0e5787ba5ffd2a3c4448ff6d1eaa904a9 (diff) |
igb: only process global stats in igb_update_stats
This patch moves the update of adapter->net_stats.rx/tx values out of the
interrupt routine and into igb_update_stats by just adding together the
tx/rx byte/packet counts for the rings.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/igb/igb_main.c | 61 |
1 files changed, 29 insertions, 32 deletions
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index 54e8f02929d9..62b68769058e 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -3769,7 +3769,10 @@ void igb_update_stats(struct igb_adapter *adapter) | |||
3769 | struct net_device *netdev = adapter->netdev; | 3769 | struct net_device *netdev = adapter->netdev; |
3770 | struct e1000_hw *hw = &adapter->hw; | 3770 | struct e1000_hw *hw = &adapter->hw; |
3771 | struct pci_dev *pdev = adapter->pdev; | 3771 | struct pci_dev *pdev = adapter->pdev; |
3772 | u32 rnbc; | ||
3772 | u16 phy_tmp; | 3773 | u16 phy_tmp; |
3774 | int i; | ||
3775 | u64 bytes, packets; | ||
3773 | 3776 | ||
3774 | #define PHY_IDLE_ERROR_COUNT_MASK 0x00FF | 3777 | #define PHY_IDLE_ERROR_COUNT_MASK 0x00FF |
3775 | 3778 | ||
@@ -3782,6 +3785,29 @@ void igb_update_stats(struct igb_adapter *adapter) | |||
3782 | if (pci_channel_offline(pdev)) | 3785 | if (pci_channel_offline(pdev)) |
3783 | return; | 3786 | return; |
3784 | 3787 | ||
3788 | bytes = 0; | ||
3789 | packets = 0; | ||
3790 | for (i = 0; i < adapter->num_rx_queues; i++) { | ||
3791 | u32 rqdpc_tmp = rd32(E1000_RQDPC(i)) & 0x0FFF; | ||
3792 | adapter->rx_ring[i].rx_stats.drops += rqdpc_tmp; | ||
3793 | netdev->stats.rx_fifo_errors += rqdpc_tmp; | ||
3794 | bytes += adapter->rx_ring[i].rx_stats.bytes; | ||
3795 | packets += adapter->rx_ring[i].rx_stats.packets; | ||
3796 | } | ||
3797 | |||
3798 | netdev->stats.rx_bytes = bytes; | ||
3799 | netdev->stats.rx_packets = packets; | ||
3800 | |||
3801 | bytes = 0; | ||
3802 | packets = 0; | ||
3803 | for (i = 0; i < adapter->num_tx_queues; i++) { | ||
3804 | bytes += adapter->tx_ring[i].tx_stats.bytes; | ||
3805 | packets += adapter->tx_ring[i].tx_stats.packets; | ||
3806 | } | ||
3807 | netdev->stats.tx_bytes = bytes; | ||
3808 | netdev->stats.tx_packets = packets; | ||
3809 | |||
3810 | /* read stats registers */ | ||
3785 | adapter->stats.crcerrs += rd32(E1000_CRCERRS); | 3811 | adapter->stats.crcerrs += rd32(E1000_CRCERRS); |
3786 | adapter->stats.gprc += rd32(E1000_GPRC); | 3812 | adapter->stats.gprc += rd32(E1000_GPRC); |
3787 | adapter->stats.gorc += rd32(E1000_GORCL); | 3813 | adapter->stats.gorc += rd32(E1000_GORCL); |
@@ -3814,7 +3840,9 @@ void igb_update_stats(struct igb_adapter *adapter) | |||
3814 | adapter->stats.gptc += rd32(E1000_GPTC); | 3840 | adapter->stats.gptc += rd32(E1000_GPTC); |
3815 | adapter->stats.gotc += rd32(E1000_GOTCL); | 3841 | adapter->stats.gotc += rd32(E1000_GOTCL); |
3816 | rd32(E1000_GOTCH); /* clear GOTCL */ | 3842 | rd32(E1000_GOTCH); /* clear GOTCL */ |
3817 | adapter->stats.rnbc += rd32(E1000_RNBC); | 3843 | rnbc = rd32(E1000_RNBC); |
3844 | adapter->stats.rnbc += rnbc; | ||
3845 | netdev->stats.rx_fifo_errors += rnbc; | ||
3818 | adapter->stats.ruc += rd32(E1000_RUC); | 3846 | adapter->stats.ruc += rd32(E1000_RUC); |
3819 | adapter->stats.rfc += rd32(E1000_RFC); | 3847 | adapter->stats.rfc += rd32(E1000_RFC); |
3820 | adapter->stats.rjc += rd32(E1000_RJC); | 3848 | adapter->stats.rjc += rd32(E1000_RJC); |
@@ -3861,33 +3889,6 @@ void igb_update_stats(struct igb_adapter *adapter) | |||
3861 | 3889 | ||
3862 | /* Rx Errors */ | 3890 | /* Rx Errors */ |
3863 | 3891 | ||
3864 | if (hw->mac.type != e1000_82575) { | ||
3865 | u32 rqdpc_tmp; | ||
3866 | u64 rqdpc_total = 0; | ||
3867 | int i; | ||
3868 | /* Read out drops stats per RX queue. Notice RQDPC (Receive | ||
3869 | * Queue Drop Packet Count) stats only gets incremented, if | ||
3870 | * the DROP_EN but it set (in the SRRCTL register for that | ||
3871 | * queue). If DROP_EN bit is NOT set, then the some what | ||
3872 | * equivalent count is stored in RNBC (not per queue basis). | ||
3873 | * Also note the drop count is due to lack of available | ||
3874 | * descriptors. | ||
3875 | */ | ||
3876 | for (i = 0; i < adapter->num_rx_queues; i++) { | ||
3877 | rqdpc_tmp = rd32(E1000_RQDPC(i)) & 0xFFF; | ||
3878 | adapter->rx_ring[i].rx_stats.drops += rqdpc_tmp; | ||
3879 | rqdpc_total += adapter->rx_ring[i].rx_stats.drops; | ||
3880 | } | ||
3881 | netdev->stats.rx_fifo_errors = rqdpc_total; | ||
3882 | } | ||
3883 | |||
3884 | /* Note RNBC (Receive No Buffers Count) is an not an exact | ||
3885 | * drop count as the hardware FIFO might save the day. Thats | ||
3886 | * one of the reason for saving it in rx_fifo_errors, as its | ||
3887 | * potentially not a true drop. | ||
3888 | */ | ||
3889 | netdev->stats.rx_fifo_errors += adapter->stats.rnbc; | ||
3890 | |||
3891 | /* RLEC on some newer hardware can be incorrect so build | 3892 | /* RLEC on some newer hardware can be incorrect so build |
3892 | * our own version based on RUC and ROC */ | 3893 | * our own version based on RUC and ROC */ |
3893 | netdev->stats.rx_errors = adapter->stats.rxerrc + | 3894 | netdev->stats.rx_errors = adapter->stats.rxerrc + |
@@ -4818,8 +4819,6 @@ static bool igb_clean_tx_irq(struct igb_q_vector *q_vector) | |||
4818 | tx_ring->total_packets += total_packets; | 4819 | tx_ring->total_packets += total_packets; |
4819 | tx_ring->tx_stats.bytes += total_bytes; | 4820 | tx_ring->tx_stats.bytes += total_bytes; |
4820 | tx_ring->tx_stats.packets += total_packets; | 4821 | tx_ring->tx_stats.packets += total_packets; |
4821 | netdev->stats.tx_bytes += total_bytes; | ||
4822 | netdev->stats.tx_packets += total_packets; | ||
4823 | return (count < tx_ring->count); | 4822 | return (count < tx_ring->count); |
4824 | } | 4823 | } |
4825 | 4824 | ||
@@ -5043,8 +5042,6 @@ next_desc: | |||
5043 | rx_ring->total_bytes += total_bytes; | 5042 | rx_ring->total_bytes += total_bytes; |
5044 | rx_ring->rx_stats.packets += total_packets; | 5043 | rx_ring->rx_stats.packets += total_packets; |
5045 | rx_ring->rx_stats.bytes += total_bytes; | 5044 | rx_ring->rx_stats.bytes += total_bytes; |
5046 | netdev->stats.rx_bytes += total_bytes; | ||
5047 | netdev->stats.rx_packets += total_packets; | ||
5048 | return cleaned; | 5045 | return cleaned; |
5049 | } | 5046 | } |
5050 | 5047 | ||