diff options
author | Sabrina Dubroca <sd@queasysnail.net> | 2014-01-12 12:50:40 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-14 20:18:06 -0500 |
commit | e3d21ea1a119ec31673d94f26c68d922bbd3d211 (patch) | |
tree | a814cc5ea16154154aa421890759dd8567bab8bc | |
parent | fb3a42fc39bf4453dc6fab25bbbf6f0416936887 (diff) |
atl1: update statistics code
As Ben Hutchings pointed out for the stats in alx, some
hardware-specific stats aren't matched to the right net_device_stats
field. Also fix the collision field and include errors in the total
number of RX/TX packets. Add a rx_dropped field and use it where
netdev->stats was modified directly out of the stats update function.
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/atheros/atlx/atl1.c | 43 | ||||
-rw-r--r-- | drivers/net/ethernet/atheros/atlx/atl1.h | 1 |
2 files changed, 26 insertions, 18 deletions
diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c index 55d86ecdacfe..287272dd69da 100644 --- a/drivers/net/ethernet/atheros/atlx/atl1.c +++ b/drivers/net/ethernet/atheros/atlx/atl1.c | |||
@@ -1678,33 +1678,42 @@ static void atl1_inc_smb(struct atl1_adapter *adapter) | |||
1678 | struct net_device *netdev = adapter->netdev; | 1678 | struct net_device *netdev = adapter->netdev; |
1679 | struct stats_msg_block *smb = adapter->smb.smb; | 1679 | struct stats_msg_block *smb = adapter->smb.smb; |
1680 | 1680 | ||
1681 | u64 new_rx_errors = smb->rx_frag + | ||
1682 | smb->rx_fcs_err + | ||
1683 | smb->rx_len_err + | ||
1684 | smb->rx_sz_ov + | ||
1685 | smb->rx_rxf_ov + | ||
1686 | smb->rx_rrd_ov + | ||
1687 | smb->rx_align_err; | ||
1688 | u64 new_tx_errors = smb->tx_late_col + | ||
1689 | smb->tx_abort_col + | ||
1690 | smb->tx_underrun + | ||
1691 | smb->tx_trunc; | ||
1692 | |||
1681 | /* Fill out the OS statistics structure */ | 1693 | /* Fill out the OS statistics structure */ |
1682 | adapter->soft_stats.rx_packets += smb->rx_ok; | 1694 | adapter->soft_stats.rx_packets += smb->rx_ok + new_rx_errors; |
1683 | adapter->soft_stats.tx_packets += smb->tx_ok; | 1695 | adapter->soft_stats.tx_packets += smb->tx_ok + new_tx_errors; |
1684 | adapter->soft_stats.rx_bytes += smb->rx_byte_cnt; | 1696 | adapter->soft_stats.rx_bytes += smb->rx_byte_cnt; |
1685 | adapter->soft_stats.tx_bytes += smb->tx_byte_cnt; | 1697 | adapter->soft_stats.tx_bytes += smb->tx_byte_cnt; |
1686 | adapter->soft_stats.multicast += smb->rx_mcast; | 1698 | adapter->soft_stats.multicast += smb->rx_mcast; |
1687 | adapter->soft_stats.collisions += (smb->tx_1_col + smb->tx_2_col * 2 + | 1699 | adapter->soft_stats.collisions += smb->tx_1_col + |
1688 | smb->tx_late_col + smb->tx_abort_col * adapter->hw.max_retry); | 1700 | smb->tx_2_col + |
1701 | smb->tx_late_col + | ||
1702 | smb->tx_abort_col; | ||
1689 | 1703 | ||
1690 | /* Rx Errors */ | 1704 | /* Rx Errors */ |
1691 | adapter->soft_stats.rx_errors += (smb->rx_frag + smb->rx_fcs_err + | 1705 | adapter->soft_stats.rx_errors += new_rx_errors; |
1692 | smb->rx_len_err + smb->rx_sz_ov + smb->rx_rxf_ov + | ||
1693 | smb->rx_rrd_ov + smb->rx_align_err); | ||
1694 | adapter->soft_stats.rx_fifo_errors += smb->rx_rxf_ov; | 1706 | adapter->soft_stats.rx_fifo_errors += smb->rx_rxf_ov; |
1695 | adapter->soft_stats.rx_length_errors += smb->rx_len_err; | 1707 | adapter->soft_stats.rx_length_errors += smb->rx_len_err; |
1696 | adapter->soft_stats.rx_crc_errors += smb->rx_fcs_err; | 1708 | adapter->soft_stats.rx_crc_errors += smb->rx_fcs_err; |
1697 | adapter->soft_stats.rx_frame_errors += smb->rx_align_err; | 1709 | adapter->soft_stats.rx_frame_errors += smb->rx_align_err; |
1698 | adapter->soft_stats.rx_missed_errors += (smb->rx_rrd_ov + | ||
1699 | smb->rx_rxf_ov); | ||
1700 | 1710 | ||
1701 | adapter->soft_stats.rx_pause += smb->rx_pause; | 1711 | adapter->soft_stats.rx_pause += smb->rx_pause; |
1702 | adapter->soft_stats.rx_rrd_ov += smb->rx_rrd_ov; | 1712 | adapter->soft_stats.rx_rrd_ov += smb->rx_rrd_ov; |
1703 | adapter->soft_stats.rx_trunc += smb->rx_sz_ov; | 1713 | adapter->soft_stats.rx_trunc += smb->rx_sz_ov; |
1704 | 1714 | ||
1705 | /* Tx Errors */ | 1715 | /* Tx Errors */ |
1706 | adapter->soft_stats.tx_errors += (smb->tx_late_col + | 1716 | adapter->soft_stats.tx_errors += new_tx_errors; |
1707 | smb->tx_abort_col + smb->tx_underrun + smb->tx_trunc); | ||
1708 | adapter->soft_stats.tx_fifo_errors += smb->tx_underrun; | 1717 | adapter->soft_stats.tx_fifo_errors += smb->tx_underrun; |
1709 | adapter->soft_stats.tx_aborted_errors += smb->tx_abort_col; | 1718 | adapter->soft_stats.tx_aborted_errors += smb->tx_abort_col; |
1710 | adapter->soft_stats.tx_window_errors += smb->tx_late_col; | 1719 | adapter->soft_stats.tx_window_errors += smb->tx_late_col; |
@@ -1718,23 +1727,18 @@ static void atl1_inc_smb(struct atl1_adapter *adapter) | |||
1718 | adapter->soft_stats.tx_trunc += smb->tx_trunc; | 1727 | adapter->soft_stats.tx_trunc += smb->tx_trunc; |
1719 | adapter->soft_stats.tx_pause += smb->tx_pause; | 1728 | adapter->soft_stats.tx_pause += smb->tx_pause; |
1720 | 1729 | ||
1721 | netdev->stats.rx_packets = adapter->soft_stats.rx_packets; | ||
1722 | netdev->stats.tx_packets = adapter->soft_stats.tx_packets; | ||
1723 | netdev->stats.rx_bytes = adapter->soft_stats.rx_bytes; | 1730 | netdev->stats.rx_bytes = adapter->soft_stats.rx_bytes; |
1724 | netdev->stats.tx_bytes = adapter->soft_stats.tx_bytes; | 1731 | netdev->stats.tx_bytes = adapter->soft_stats.tx_bytes; |
1725 | netdev->stats.multicast = adapter->soft_stats.multicast; | 1732 | netdev->stats.multicast = adapter->soft_stats.multicast; |
1726 | netdev->stats.collisions = adapter->soft_stats.collisions; | 1733 | netdev->stats.collisions = adapter->soft_stats.collisions; |
1727 | netdev->stats.rx_errors = adapter->soft_stats.rx_errors; | 1734 | netdev->stats.rx_errors = adapter->soft_stats.rx_errors; |
1728 | netdev->stats.rx_over_errors = | ||
1729 | adapter->soft_stats.rx_missed_errors; | ||
1730 | netdev->stats.rx_length_errors = | 1735 | netdev->stats.rx_length_errors = |
1731 | adapter->soft_stats.rx_length_errors; | 1736 | adapter->soft_stats.rx_length_errors; |
1732 | netdev->stats.rx_crc_errors = adapter->soft_stats.rx_crc_errors; | 1737 | netdev->stats.rx_crc_errors = adapter->soft_stats.rx_crc_errors; |
1733 | netdev->stats.rx_frame_errors = | 1738 | netdev->stats.rx_frame_errors = |
1734 | adapter->soft_stats.rx_frame_errors; | 1739 | adapter->soft_stats.rx_frame_errors; |
1735 | netdev->stats.rx_fifo_errors = adapter->soft_stats.rx_fifo_errors; | 1740 | netdev->stats.rx_fifo_errors = adapter->soft_stats.rx_fifo_errors; |
1736 | netdev->stats.rx_missed_errors = | 1741 | netdev->stats.rx_dropped = adapter->soft_stats.rx_rrd_ov; |
1737 | adapter->soft_stats.rx_missed_errors; | ||
1738 | netdev->stats.tx_errors = adapter->soft_stats.tx_errors; | 1742 | netdev->stats.tx_errors = adapter->soft_stats.tx_errors; |
1739 | netdev->stats.tx_fifo_errors = adapter->soft_stats.tx_fifo_errors; | 1743 | netdev->stats.tx_fifo_errors = adapter->soft_stats.tx_fifo_errors; |
1740 | netdev->stats.tx_aborted_errors = | 1744 | netdev->stats.tx_aborted_errors = |
@@ -1743,6 +1747,9 @@ static void atl1_inc_smb(struct atl1_adapter *adapter) | |||
1743 | adapter->soft_stats.tx_window_errors; | 1747 | adapter->soft_stats.tx_window_errors; |
1744 | netdev->stats.tx_carrier_errors = | 1748 | netdev->stats.tx_carrier_errors = |
1745 | adapter->soft_stats.tx_carrier_errors; | 1749 | adapter->soft_stats.tx_carrier_errors; |
1750 | |||
1751 | netdev->stats.rx_packets = adapter->soft_stats.rx_packets; | ||
1752 | netdev->stats.tx_packets = adapter->soft_stats.tx_packets; | ||
1746 | } | 1753 | } |
1747 | 1754 | ||
1748 | static void atl1_update_mailbox(struct atl1_adapter *adapter) | 1755 | static void atl1_update_mailbox(struct atl1_adapter *adapter) |
@@ -1872,7 +1879,7 @@ static u16 atl1_alloc_rx_buffers(struct atl1_adapter *adapter) | |||
1872 | adapter->rx_buffer_len); | 1879 | adapter->rx_buffer_len); |
1873 | if (unlikely(!skb)) { | 1880 | if (unlikely(!skb)) { |
1874 | /* Better luck next round */ | 1881 | /* Better luck next round */ |
1875 | adapter->netdev->stats.rx_dropped++; | 1882 | adapter->soft_stats.rx_dropped++; |
1876 | break; | 1883 | break; |
1877 | } | 1884 | } |
1878 | 1885 | ||
diff --git a/drivers/net/ethernet/atheros/atlx/atl1.h b/drivers/net/ethernet/atheros/atlx/atl1.h index 3bf79a56220d..34a58cd846a0 100644 --- a/drivers/net/ethernet/atheros/atlx/atl1.h +++ b/drivers/net/ethernet/atheros/atlx/atl1.h | |||
@@ -666,6 +666,7 @@ struct atl1_sft_stats { | |||
666 | u64 rx_errors; | 666 | u64 rx_errors; |
667 | u64 rx_length_errors; | 667 | u64 rx_length_errors; |
668 | u64 rx_crc_errors; | 668 | u64 rx_crc_errors; |
669 | u64 rx_dropped; | ||
669 | u64 rx_frame_errors; | 670 | u64 rx_frame_errors; |
670 | u64 rx_fifo_errors; | 671 | u64 rx_fifo_errors; |
671 | u64 rx_missed_errors; | 672 | u64 rx_missed_errors; |