Skip to content

Commit 8560258

Browse files
qsndavem330
authored andcommitted
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 <[email protected]> Reviewed-by: Ben Hutchings <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 88bfe6e commit 8560258

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

drivers/net/ethernet/atheros/atl1c/atl1c_main.c

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,31 +1500,40 @@ static struct net_device_stats *atl1c_get_stats(struct net_device *netdev)
15001500
struct net_device_stats *net_stats = &netdev->stats;
15011501

15021502
atl1c_update_hw_stats(adapter);
1503-
net_stats->rx_packets = hw_stats->rx_ok;
1504-
net_stats->tx_packets = hw_stats->tx_ok;
15051503
net_stats->rx_bytes = hw_stats->rx_byte_cnt;
15061504
net_stats->tx_bytes = hw_stats->tx_byte_cnt;
15071505
net_stats->multicast = hw_stats->rx_mcast;
15081506
net_stats->collisions = hw_stats->tx_1_col +
1509-
hw_stats->tx_2_col * 2 +
1510-
hw_stats->tx_late_col + hw_stats->tx_abort_col;
1511-
net_stats->rx_errors = hw_stats->rx_frag + hw_stats->rx_fcs_err +
1512-
hw_stats->rx_len_err + hw_stats->rx_sz_ov +
1513-
hw_stats->rx_rrd_ov + hw_stats->rx_align_err;
1507+
hw_stats->tx_2_col +
1508+
hw_stats->tx_late_col +
1509+
hw_stats->tx_abort_col;
1510+
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+
15141519
net_stats->rx_fifo_errors = hw_stats->rx_rxf_ov;
15151520
net_stats->rx_length_errors = hw_stats->rx_len_err;
15161521
net_stats->rx_crc_errors = hw_stats->rx_fcs_err;
15171522
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;
15191524

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;
15211529

1522-
net_stats->tx_errors = hw_stats->tx_late_col + hw_stats->tx_abort_col +
1523-
hw_stats->tx_underrun + hw_stats->tx_trunc;
15241530
net_stats->tx_fifo_errors = hw_stats->tx_underrun;
15251531
net_stats->tx_aborted_errors = hw_stats->tx_abort_col;
15261532
net_stats->tx_window_errors = hw_stats->tx_late_col;
15271533

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+
15281537
return net_stats;
15291538
}
15301539

0 commit comments

Comments
 (0)