Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sfc: update netdevice statistics to use vadaptor stats

The netdevice statistics (in /proc/net/dev) are per-function
stats so they must use the vadaptor stats. Change the use of
MAC stats to vadaptor stats, and remove any statistics that
can only be measured per-port. All stats that are removed
will be shown as zeroes when these statistics are displayed.

Signed-off-by: Shradha Shah <sshah@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Daniel Pieczko and committed by
David S. Miller
0fc95fca d7788196

+22 -19
+22 -19
drivers/net/ethernet/sfc/ef10.c
··· 1210 1210 } 1211 1211 1212 1212 if (core_stats) { 1213 - core_stats->rx_packets = stats[EF10_STAT_port_rx_packets]; 1214 - core_stats->tx_packets = stats[EF10_STAT_port_tx_packets]; 1215 - core_stats->rx_bytes = stats[EF10_STAT_port_rx_bytes]; 1216 - core_stats->tx_bytes = stats[EF10_STAT_port_tx_bytes]; 1217 - core_stats->rx_dropped = stats[EF10_STAT_port_rx_nodesc_drops] + 1218 - stats[GENERIC_STAT_rx_nodesc_trunc] + 1213 + core_stats->rx_packets = stats[EF10_STAT_rx_unicast] + 1214 + stats[EF10_STAT_rx_multicast] + 1215 + stats[EF10_STAT_rx_broadcast]; 1216 + core_stats->tx_packets = stats[EF10_STAT_tx_unicast] + 1217 + stats[EF10_STAT_tx_multicast] + 1218 + stats[EF10_STAT_tx_broadcast]; 1219 + core_stats->rx_bytes = stats[EF10_STAT_rx_unicast_bytes] + 1220 + stats[EF10_STAT_rx_multicast_bytes] + 1221 + stats[EF10_STAT_rx_broadcast_bytes]; 1222 + core_stats->tx_bytes = stats[EF10_STAT_tx_unicast_bytes] + 1223 + stats[EF10_STAT_tx_multicast_bytes] + 1224 + stats[EF10_STAT_tx_broadcast_bytes]; 1225 + core_stats->rx_dropped = stats[GENERIC_STAT_rx_nodesc_trunc] + 1219 1226 stats[GENERIC_STAT_rx_noskb_drops]; 1220 - core_stats->multicast = stats[EF10_STAT_port_rx_multicast]; 1221 - core_stats->rx_length_errors = 1222 - stats[EF10_STAT_port_rx_gtjumbo] + 1223 - stats[EF10_STAT_port_rx_length_error]; 1224 - core_stats->rx_crc_errors = stats[EF10_STAT_port_rx_bad]; 1225 - core_stats->rx_frame_errors = 1226 - stats[EF10_STAT_port_rx_align_error]; 1227 - core_stats->rx_fifo_errors = stats[EF10_STAT_port_rx_overflow]; 1228 - core_stats->rx_errors = (core_stats->rx_length_errors + 1229 - core_stats->rx_crc_errors + 1230 - core_stats->rx_frame_errors); 1227 + core_stats->multicast = stats[EF10_STAT_rx_multicast]; 1228 + core_stats->rx_crc_errors = stats[EF10_STAT_rx_bad]; 1229 + core_stats->rx_fifo_errors = stats[EF10_STAT_rx_overflow]; 1230 + core_stats->rx_errors = core_stats->rx_crc_errors; 1231 + core_stats->tx_errors = stats[EF10_STAT_tx_bad]; 1231 1232 } 1232 1233 1233 1234 return stats_count; ··· 1311 1310 1312 1311 MCDI_SET_QWORD(inbuf, MAC_STATS_IN_DMA_ADDR, stats_buf.dma_addr); 1313 1312 MCDI_POPULATE_DWORD_1(inbuf, MAC_STATS_IN_CMD, 1314 - MAC_STATS_IN_DMA, true); 1313 + MAC_STATS_IN_DMA, 1); 1315 1314 MCDI_SET_DWORD(inbuf, MAC_STATS_IN_DMA_LEN, dma_len); 1316 1315 MCDI_SET_DWORD(inbuf, MAC_STATS_IN_PORT_ID, EVB_PORT_ID_ASSIGNED); 1317 1316 ··· 1323 1322 goto out; 1324 1323 1325 1324 generation_end = dma_stats[MC_CMD_MAC_GENERATION_END]; 1326 - if (generation_end == EFX_MC_STATS_GENERATION_INVALID) 1325 + if (generation_end == EFX_MC_STATS_GENERATION_INVALID) { 1326 + WARN_ON_ONCE(1); 1327 1327 goto out; 1328 + } 1328 1329 rmb(); 1329 1330 efx_nic_update_stats(efx_ef10_stat_desc, EF10_STAT_COUNT, mask, 1330 1331 stats, stats_buf.addr, false);