diff options
author | Sabrina Dubroca <sd@queasysnail.net> | 2014-01-12 12:50:38 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-14 20:18:05 -0500 |
commit | 8560258f0e67104278816211443e63bda5d300ea (patch) | |
tree | ea9f070298d66424951a059deda02e6dd4e9b650 | |
parent | 88bfe6ea001d9915a3ad57f30a1b2826ef4e5890 (diff) |
atl1c: 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.
Minor whitespace fixes to match the style in alx.
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Reviewed-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c index 29801750f239..4d3258dd0a88 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c | |||
@@ -1500,31 +1500,40 @@ static struct net_device_stats *atl1c_get_stats(struct net_device *netdev) | |||
1500 | struct net_device_stats *net_stats = &netdev->stats; | 1500 | struct net_device_stats *net_stats = &netdev->stats; |
1501 | 1501 | ||
1502 | atl1c_update_hw_stats(adapter); | 1502 | atl1c_update_hw_stats(adapter); |
1503 | net_stats->rx_packets = hw_stats->rx_ok; | ||
1504 | net_stats->tx_packets = hw_stats->tx_ok; | ||
1505 | net_stats->rx_bytes = hw_stats->rx_byte_cnt; | 1503 | net_stats->rx_bytes = hw_stats->rx_byte_cnt; |
1506 | net_stats->tx_bytes = hw_stats->tx_byte_cnt; | 1504 | net_stats->tx_bytes = hw_stats->tx_byte_cnt; |
1507 | net_stats->multicast = hw_stats->rx_mcast; | 1505 | net_stats->multicast = hw_stats->rx_mcast; |
1508 | net_stats->collisions = hw_stats->tx_1_col + | 1506 | net_stats->collisions = hw_stats->tx_1_col + |
1509 | hw_stats->tx_2_col * 2 + | 1507 | hw_stats->tx_2_col + |
1510 | hw_stats->tx_late_col + hw_stats->tx_abort_col; | 1508 | hw_stats->tx_late_col + |
1511 | net_stats->rx_errors = hw_stats->rx_frag + hw_stats->rx_fcs_err + | 1509 | hw_stats->tx_abort_col; |
1512 | hw_stats->rx_len_err + hw_stats->rx_sz_ov + | 1510 | |
1513 | hw_stats->rx_rrd_ov + hw_stats->rx_align_err; | 1511 | net_stats->rx_errors = hw_stats->rx_frag + |
1512 | hw_stats->rx_fcs_err + | ||
1513 | hw_stats->rx_len_err + | ||
1514 | hw_stats->rx_sz_ov + | ||
1515 | hw_stats->rx_rrd_ov + | ||
1516 | hw_stats->rx_align_err + | ||
1517 | hw_stats->rx_rxf_ov; | ||
1518 | |||
1514 | net_stats->rx_fifo_errors = hw_stats->rx_rxf_ov; | 1519 | net_stats->rx_fifo_errors = hw_stats->rx_rxf_ov; |
1515 | net_stats->rx_length_errors = hw_stats->rx_len_err; | 1520 | net_stats->rx_length_errors = hw_stats->rx_len_err; |
1516 | net_stats->rx_crc_errors = hw_stats->rx_fcs_err; | 1521 | net_stats->rx_crc_errors = hw_stats->rx_fcs_err; |
1517 | net_stats->rx_frame_errors = hw_stats->rx_align_err; | 1522 | net_stats->rx_frame_errors = hw_stats->rx_align_err; |
1518 | net_stats->rx_over_errors = hw_stats->rx_rrd_ov + hw_stats->rx_rxf_ov; | 1523 | net_stats->rx_dropped = hw_stats->rx_rrd_ov; |
1519 | 1524 | ||
1520 | net_stats->rx_missed_errors = hw_stats->rx_rrd_ov + hw_stats->rx_rxf_ov; | 1525 | net_stats->tx_errors = hw_stats->tx_late_col + |
1526 | hw_stats->tx_abort_col + | ||
1527 | hw_stats->tx_underrun + | ||
1528 | hw_stats->tx_trunc; | ||
1521 | 1529 | ||
1522 | net_stats->tx_errors = hw_stats->tx_late_col + hw_stats->tx_abort_col + | ||
1523 | hw_stats->tx_underrun + hw_stats->tx_trunc; | ||
1524 | net_stats->tx_fifo_errors = hw_stats->tx_underrun; | 1530 | net_stats->tx_fifo_errors = hw_stats->tx_underrun; |
1525 | net_stats->tx_aborted_errors = hw_stats->tx_abort_col; | 1531 | net_stats->tx_aborted_errors = hw_stats->tx_abort_col; |
1526 | net_stats->tx_window_errors = hw_stats->tx_late_col; | 1532 | net_stats->tx_window_errors = hw_stats->tx_late_col; |
1527 | 1533 | ||
1534 | net_stats->rx_packets = hw_stats->rx_ok + net_stats->rx_errors; | ||
1535 | net_stats->tx_packets = hw_stats->tx_ok + net_stats->tx_errors; | ||
1536 | |||
1528 | return net_stats; | 1537 | return net_stats; |
1529 | } | 1538 | } |
1530 | 1539 | ||