static void falcon_update_stats_xmac(struct efx_nic *efx) { struct efx_mac_stats *mac_stats = &efx->mac_stats; int rc; rc = falcon_dma_stats(efx, XgDmaDone_offset); if (rc) return; FALCON_STAT(efx, XgRxOctets, rx_bytes); FALCON_STAT(efx, XgRxOctetsOK, rx_good_bytes); FALCON_STAT(efx, XgRxPkts, rx_packets); FALCON_STAT(efx, XgRxPktsOK, rx_good); FALCON_STAT(efx, XgRxBroadcastPkts, rx_broadcast); FALCON_STAT(efx, XgRxMulticastPkts, rx_multicast); FALCON_STAT(efx, XgRxUnicastPkts, rx_unicast); FALCON_STAT(efx, XgRxUndersizePkts, rx_lt64); FALCON_STAT(efx, XgRxOversizePkts, rx_gtjumbo); FALCON_STAT(efx, XgRxJabberPkts, rx_bad_gtjumbo); FALCON_STAT(efx, XgRxUndersizeFCSerrorPkts, rx_bad_lt64); FALCON_STAT(efx, XgRxDropEvents, rx_overflow); FALCON_STAT(efx, XgRxFCSerrorPkts, rx_bad); FALCON_STAT(efx, XgRxAlignError, rx_align_error); FALCON_STAT(efx, XgRxSymbolError, rx_symbol_error); FALCON_STAT(efx, XgRxInternalMACError, rx_internal_error); FALCON_STAT(efx, XgRxControlPkts, rx_control); FALCON_STAT(efx, XgRxPausePkts, rx_pause); FALCON_STAT(efx, XgRxPkts64Octets, rx_64); FALCON_STAT(efx, XgRxPkts65to127Octets, rx_65_to_127); FALCON_STAT(efx, XgRxPkts128to255Octets, rx_128_to_255); FALCON_STAT(efx, XgRxPkts256to511Octets, rx_256_to_511); FALCON_STAT(efx, XgRxPkts512to1023Octets, rx_512_to_1023); FALCON_STAT(efx, XgRxPkts1024to15xxOctets, rx_1024_to_15xx); FALCON_STAT(efx, XgRxPkts15xxtoMaxOctets, rx_15xx_to_jumbo); FALCON_STAT(efx, XgRxLengthError, rx_length_error); FALCON_STAT(efx, XgTxPkts, tx_packets); FALCON_STAT(efx, XgTxOctets, tx_bytes); FALCON_STAT(efx, XgTxMulticastPkts, tx_multicast); FALCON_STAT(efx, XgTxBroadcastPkts, tx_broadcast); FALCON_STAT(efx, XgTxUnicastPkts, tx_unicast); FALCON_STAT(efx, XgTxControlPkts, tx_control); FALCON_STAT(efx, XgTxPausePkts, tx_pause); FALCON_STAT(efx, XgTxPkts64Octets, tx_64); FALCON_STAT(efx, XgTxPkts65to127Octets, tx_65_to_127); FALCON_STAT(efx, XgTxPkts128to255Octets, tx_128_to_255); FALCON_STAT(efx, XgTxPkts256to511Octets, tx_256_to_511); FALCON_STAT(efx, XgTxPkts512to1023Octets, tx_512_to_1023); FALCON_STAT(efx, XgTxPkts1024to15xxOctets, tx_1024_to_15xx); FALCON_STAT(efx, XgTxPkts1519toMaxOctets, tx_15xx_to_jumbo); FALCON_STAT(efx, XgTxUndersizePkts, tx_lt64); FALCON_STAT(efx, XgTxOversizePkts, tx_gtjumbo); FALCON_STAT(efx, XgTxNonTcpUdpPkt, tx_non_tcpudp); FALCON_STAT(efx, XgTxMacSrcErrPkt, tx_mac_src_error); FALCON_STAT(efx, XgTxIpSrcErrPkt, tx_ip_src_error); mac_stats->tx_good_bytes = (mac_stats->tx_bytes - mac_stats->tx_bad_bytes - mac_stats->tx_control * 64); mac_stats->rx_bad_bytes = (mac_stats->rx_bytes - mac_stats->rx_good_bytes - mac_stats->rx_control * 64); }
static void falcon_update_stats_gmac(struct efx_nic *efx) { struct efx_mac_stats *mac_stats = &efx->mac_stats; unsigned long old_rx_pause, old_tx_pause; unsigned long new_rx_pause, new_tx_pause; int rc; rc = falcon_dma_stats(efx, GDmaDone_offset); if (rc) return; /* Pause frames are erroneously counted as errors (SFC bug 3269) */ old_rx_pause = mac_stats->rx_pause; old_tx_pause = mac_stats->tx_pause; /* Update MAC stats from DMAed values */ FALCON_STAT(efx, GRxGoodOct, rx_good_bytes); FALCON_STAT(efx, GRxBadOct, rx_bad_bytes); FALCON_STAT(efx, GRxMissPkt, rx_missed); FALCON_STAT(efx, GRxFalseCRS, rx_false_carrier); FALCON_STAT(efx, GRxPausePkt, rx_pause); FALCON_STAT(efx, GRxBadPkt, rx_bad); FALCON_STAT(efx, GRxUcastPkt, rx_unicast); FALCON_STAT(efx, GRxMcastPkt, rx_multicast); FALCON_STAT(efx, GRxBcastPkt, rx_broadcast); FALCON_STAT(efx, GRxGoodLt64Pkt, rx_good_lt64); FALCON_STAT(efx, GRxBadLt64Pkt, rx_bad_lt64); FALCON_STAT(efx, GRx64Pkt, rx_64); FALCON_STAT(efx, GRx65to127Pkt, rx_65_to_127); FALCON_STAT(efx, GRx128to255Pkt, rx_128_to_255); FALCON_STAT(efx, GRx256to511Pkt, rx_256_to_511); FALCON_STAT(efx, GRx512to1023Pkt, rx_512_to_1023); FALCON_STAT(efx, GRx1024to15xxPkt, rx_1024_to_15xx); FALCON_STAT(efx, GRx15xxtoJumboPkt, rx_15xx_to_jumbo); FALCON_STAT(efx, GRxGtJumboPkt, rx_gtjumbo); FALCON_STAT(efx, GRxFcsErr64to15xxPkt, rx_bad_64_to_15xx); FALCON_STAT(efx, GRxFcsErr15xxtoJumboPkt, rx_bad_15xx_to_jumbo); FALCON_STAT(efx, GRxFcsErrGtJumboPkt, rx_bad_gtjumbo); FALCON_STAT(efx, GTxGoodBadOct, tx_bytes); FALCON_STAT(efx, GTxGoodOct, tx_good_bytes); FALCON_STAT(efx, GTxSglColPkt, tx_single_collision); FALCON_STAT(efx, GTxMultColPkt, tx_multiple_collision); FALCON_STAT(efx, GTxExColPkt, tx_excessive_collision); FALCON_STAT(efx, GTxDefPkt, tx_deferred); FALCON_STAT(efx, GTxLateCol, tx_late_collision); FALCON_STAT(efx, GTxExDefPkt, tx_excessive_deferred); FALCON_STAT(efx, GTxPausePkt, tx_pause); FALCON_STAT(efx, GTxBadPkt, tx_bad); FALCON_STAT(efx, GTxUcastPkt, tx_unicast); FALCON_STAT(efx, GTxMcastPkt, tx_multicast); FALCON_STAT(efx, GTxBcastPkt, tx_broadcast); FALCON_STAT(efx, GTxLt64Pkt, tx_lt64); FALCON_STAT(efx, GTx64Pkt, tx_64); FALCON_STAT(efx, GTx65to127Pkt, tx_65_to_127); FALCON_STAT(efx, GTx128to255Pkt, tx_128_to_255); FALCON_STAT(efx, GTx256to511Pkt, tx_256_to_511); FALCON_STAT(efx, GTx512to1023Pkt, tx_512_to_1023); FALCON_STAT(efx, GTx1024to15xxPkt, tx_1024_to_15xx); FALCON_STAT(efx, GTx15xxtoJumboPkt, tx_15xx_to_jumbo); FALCON_STAT(efx, GTxGtJumboPkt, tx_gtjumbo); FALCON_STAT(efx, GTxNonTcpUdpPkt, tx_non_tcpudp); FALCON_STAT(efx, GTxMacSrcErrPkt, tx_mac_src_error); FALCON_STAT(efx, GTxIpSrcErrPkt, tx_ip_src_error); /* Pause frames are erroneously counted as errors (SFC bug 3269) */ new_rx_pause = mac_stats->rx_pause; new_tx_pause = mac_stats->tx_pause; mac_stats->rx_bad -= (new_rx_pause - old_rx_pause); mac_stats->tx_bad -= (new_tx_pause - old_tx_pause); /* Derive stats that the MAC doesn't provide directly */ mac_stats->tx_bad_bytes = mac_stats->tx_bytes - mac_stats->tx_good_bytes; mac_stats->tx_packets = mac_stats->tx_lt64 + mac_stats->tx_64 + mac_stats->tx_65_to_127 + mac_stats->tx_128_to_255 + mac_stats->tx_256_to_511 + mac_stats->tx_512_to_1023 + mac_stats->tx_1024_to_15xx + mac_stats->tx_15xx_to_jumbo + mac_stats->tx_gtjumbo; mac_stats->tx_collision = mac_stats->tx_single_collision + mac_stats->tx_multiple_collision + mac_stats->tx_excessive_collision + mac_stats->tx_late_collision; mac_stats->rx_bytes = mac_stats->rx_good_bytes + mac_stats->rx_bad_bytes; mac_stats->rx_packets = mac_stats->rx_good_lt64 + mac_stats->rx_bad_lt64 + mac_stats->rx_64 + mac_stats->rx_65_to_127 + mac_stats->rx_128_to_255 + mac_stats->rx_256_to_511 + mac_stats->rx_512_to_1023 + mac_stats->rx_1024_to_15xx + mac_stats->rx_15xx_to_jumbo + mac_stats->rx_gtjumbo; mac_stats->rx_good = mac_stats->rx_packets - mac_stats->rx_bad; mac_stats->rx_lt64 = mac_stats->rx_good_lt64 + mac_stats->rx_bad_lt64; }