From b7f514af7d6f36bc2f683e04a909c95e4744b95b Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Wed, 4 Jul 2012 22:25:07 +0100 Subject: sfc: Fix interface statistics running backward Some interface statistics are computed in such a way that they can sometimes decrease (and even underflow). Since the computed value will never be greater than the true value, we fix this by only storing the computed value when it increases. Signed-off-by: Ben Hutchings --- drivers/net/ethernet/sfc/siena.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/net/ethernet/sfc/siena.c') diff --git a/drivers/net/ethernet/sfc/siena.c b/drivers/net/ethernet/sfc/siena.c index 2354886293d..6bafd216e55 100644 --- a/drivers/net/ethernet/sfc/siena.c +++ b/drivers/net/ethernet/sfc/siena.c @@ -458,8 +458,8 @@ static int siena_try_update_nic_stats(struct efx_nic *efx) MAC_STAT(tx_bytes, TX_BYTES); MAC_STAT(tx_bad_bytes, TX_BAD_BYTES); - mac_stats->tx_good_bytes = (mac_stats->tx_bytes - - mac_stats->tx_bad_bytes); + efx_update_diff_stat(&mac_stats->tx_good_bytes, + mac_stats->tx_bytes - mac_stats->tx_bad_bytes); MAC_STAT(tx_packets, TX_PKTS); MAC_STAT(tx_bad, TX_BAD_FCS_PKTS); MAC_STAT(tx_pause, TX_PAUSE_PKTS); @@ -492,8 +492,8 @@ static int siena_try_update_nic_stats(struct efx_nic *efx) MAC_STAT(tx_ip_src_error, TX_IP_SRC_ERR_PKTS); MAC_STAT(rx_bytes, RX_BYTES); MAC_STAT(rx_bad_bytes, RX_BAD_BYTES); - mac_stats->rx_good_bytes = (mac_stats->rx_bytes - - mac_stats->rx_bad_bytes); + efx_update_diff_stat(&mac_stats->rx_good_bytes, + mac_stats->rx_bytes - mac_stats->rx_bad_bytes); MAC_STAT(rx_packets, RX_PKTS); MAC_STAT(rx_good, RX_GOOD_PKTS); MAC_STAT(rx_bad, RX_BAD_FCS_PKTS); -- cgit v1.2.3-70-g09d2