Skip to content

Commit fb3a42f

Browse files
qsndavem330
authored andcommitted
atl1e: 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 8560258 commit fb3a42f

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

drivers/net/ethernet/atheros/atl1e/atl1e_main.c

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,32 +1177,40 @@ static struct net_device_stats *atl1e_get_stats(struct net_device *netdev)
11771177
struct atl1e_hw_stats *hw_stats = &adapter->hw_stats;
11781178
struct net_device_stats *net_stats = &netdev->stats;
11791179

1180-
net_stats->rx_packets = hw_stats->rx_ok;
1181-
net_stats->tx_packets = hw_stats->tx_ok;
11821180
net_stats->rx_bytes = hw_stats->rx_byte_cnt;
11831181
net_stats->tx_bytes = hw_stats->tx_byte_cnt;
11841182
net_stats->multicast = hw_stats->rx_mcast;
11851183
net_stats->collisions = hw_stats->tx_1_col +
1186-
hw_stats->tx_2_col * 2 +
1187-
hw_stats->tx_late_col + hw_stats->tx_abort_col;
1184+
hw_stats->tx_2_col +
1185+
hw_stats->tx_late_col +
1186+
hw_stats->tx_abort_col;
1187+
1188+
net_stats->rx_errors = hw_stats->rx_frag +
1189+
hw_stats->rx_fcs_err +
1190+
hw_stats->rx_len_err +
1191+
hw_stats->rx_sz_ov +
1192+
hw_stats->rx_rrd_ov +
1193+
hw_stats->rx_align_err +
1194+
hw_stats->rx_rxf_ov;
11881195

1189-
net_stats->rx_errors = hw_stats->rx_frag + hw_stats->rx_fcs_err +
1190-
hw_stats->rx_len_err + hw_stats->rx_sz_ov +
1191-
hw_stats->rx_rrd_ov + hw_stats->rx_align_err;
11921196
net_stats->rx_fifo_errors = hw_stats->rx_rxf_ov;
11931197
net_stats->rx_length_errors = hw_stats->rx_len_err;
11941198
net_stats->rx_crc_errors = hw_stats->rx_fcs_err;
11951199
net_stats->rx_frame_errors = hw_stats->rx_align_err;
1196-
net_stats->rx_over_errors = hw_stats->rx_rrd_ov + hw_stats->rx_rxf_ov;
1200+
net_stats->rx_dropped = hw_stats->rx_rrd_ov;
11971201

1198-
net_stats->rx_missed_errors = hw_stats->rx_rrd_ov + hw_stats->rx_rxf_ov;
1202+
net_stats->tx_errors = hw_stats->tx_late_col +
1203+
hw_stats->tx_abort_col +
1204+
hw_stats->tx_underrun +
1205+
hw_stats->tx_trunc;
11991206

1200-
net_stats->tx_errors = hw_stats->tx_late_col + hw_stats->tx_abort_col +
1201-
hw_stats->tx_underrun + hw_stats->tx_trunc;
12021207
net_stats->tx_fifo_errors = hw_stats->tx_underrun;
12031208
net_stats->tx_aborted_errors = hw_stats->tx_abort_col;
12041209
net_stats->tx_window_errors = hw_stats->tx_late_col;
12051210

1211+
net_stats->rx_packets = hw_stats->rx_ok + net_stats->rx_errors;
1212+
net_stats->tx_packets = hw_stats->tx_ok + net_stats->tx_errors;
1213+
12061214
return net_stats;
12071215
}
12081216

0 commit comments

Comments
 (0)