summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc/falcon_xmac.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2012-07-04 22:25:07 +0100
committerBen Hutchings <bhutchings@solarflare.com>2012-07-17 16:12:34 +0100
commitb7f514af7d6f36bc2f683e04a909c95e4744b95b (patch)
tree3e8919c3f81d3434d5252ede948d992a1a25deb0 /drivers/net/ethernet/sfc/falcon_xmac.c
parentd4f2cecce138c34960c467d0ae38a6d4bcd6af7b (diff)
downloadlinux-b7f514af7d6f36bc2f683e04a909c95e4744b95b.tar.bz2
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 <bhutchings@solarflare.com>
Diffstat (limited to 'drivers/net/ethernet/sfc/falcon_xmac.c')
-rw-r--r--drivers/net/ethernet/sfc/falcon_xmac.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/net/ethernet/sfc/falcon_xmac.c b/drivers/net/ethernet/sfc/falcon_xmac.c
index 6106ef15dee3..8333865d4c95 100644
--- a/drivers/net/ethernet/sfc/falcon_xmac.c
+++ b/drivers/net/ethernet/sfc/falcon_xmac.c
@@ -341,12 +341,12 @@ void falcon_update_stats_xmac(struct efx_nic *efx)
FALCON_STAT(efx, XgTxIpSrcErrPkt, tx_ip_src_error);
/* Update derived statistics */
- 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);
+ efx_update_diff_stat(&mac_stats->tx_good_bytes,
+ mac_stats->tx_bytes - mac_stats->tx_bad_bytes -
+ mac_stats->tx_control * 64);
+ efx_update_diff_stat(&mac_stats->rx_bad_bytes,
+ mac_stats->rx_bytes - mac_stats->rx_good_bytes -
+ mac_stats->rx_control * 64);
}
void falcon_poll_xmac(struct efx_nic *efx)