static void siena_update_nic_stats(struct efx_nic *efx) { int retry; /* If we're unlucky enough to read statistics wduring the DMA, wait * up to 10ms for it to finish (typically takes <500us) */ for (retry = 0; retry < 100; ++retry) { if (siena_try_update_nic_stats(efx) == 0) return; udelay(100); } /* Use the old values instead */ }
static size_t siena_update_nic_stats(struct efx_nic *efx, u64 *full_stats, struct rtnl_link_stats64 *core_stats) { struct siena_nic_data *nic_data = efx->nic_data; u64 *stats = nic_data->stats; int retry; /* If we're unlucky enough to read statistics wduring the DMA, wait * up to 10ms for it to finish (typically takes <500us) */ for (retry = 0; retry < 100; ++retry) { if (siena_try_update_nic_stats(efx) == 0) break; udelay(100); } if (full_stats) memcpy(full_stats, stats, sizeof(u64) * SIENA_STAT_COUNT); if (core_stats) { core_stats->rx_packets = stats[SIENA_STAT_rx_packets]; core_stats->tx_packets = stats[SIENA_STAT_tx_packets]; core_stats->rx_bytes = stats[SIENA_STAT_rx_bytes]; core_stats->tx_bytes = stats[SIENA_STAT_tx_bytes]; core_stats->rx_dropped = stats[SIENA_STAT_rx_nodesc_drop_cnt] + stats[GENERIC_STAT_rx_nodesc_trunc] + stats[GENERIC_STAT_rx_noskb_drops]; core_stats->multicast = stats[SIENA_STAT_rx_multicast]; core_stats->collisions = stats[SIENA_STAT_tx_collision]; core_stats->rx_length_errors = stats[SIENA_STAT_rx_gtjumbo] + stats[SIENA_STAT_rx_length_error]; core_stats->rx_crc_errors = stats[SIENA_STAT_rx_bad]; core_stats->rx_frame_errors = stats[SIENA_STAT_rx_align_error]; core_stats->rx_fifo_errors = stats[SIENA_STAT_rx_overflow]; core_stats->tx_window_errors = stats[SIENA_STAT_tx_late_collision]; core_stats->rx_errors = (core_stats->rx_length_errors + core_stats->rx_crc_errors + core_stats->rx_frame_errors + stats[SIENA_STAT_rx_symbol_error]); core_stats->tx_errors = (core_stats->tx_window_errors + stats[SIENA_STAT_tx_bad]); } return SIENA_STAT_COUNT; }