diff options
author | arybchik <arybchik@FreeBSD.org> | 2016-08-23 13:51:55 +0000 |
---|---|---|
committer | arybchik <arybchik@FreeBSD.org> | 2016-08-23 13:51:55 +0000 |
commit | 8b080b5d18b14e2d595f39d28450f52328cdb834 (patch) | |
tree | ad937769133ff43615fd92d3b0a8c7c5029403a3 | |
parent | 69c00374f5e54f7261605bde1bcecd7946a30d7d (diff) | |
download | FreeBSD-src-8b080b5d18b14e2d595f39d28450f52328cdb834.zip FreeBSD-src-8b080b5d18b14e2d595f39d28450f52328cdb834.tar.gz |
MFC r301724
sfxge(4): handle negative ticks difference correctly
ticks are signed int and if statistics is not updated for a long time
(more than INT_MAX ticks, but less than UINT_MAX) difference becomes
negative and less than hz for a long time.
Other option to repeat is simply load driver (which initializes
timestamps to 0) when ticks are negative.
Sponsored by: Solarflare Communications, Inc.
-rw-r--r-- | sys/dev/sfxge/sfxge_ev.c | 2 | ||||
-rw-r--r-- | sys/dev/sfxge/sfxge_port.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/sfxge/sfxge_ev.c b/sys/dev/sfxge/sfxge_ev.c index d5aff5f..06ffed2 100644 --- a/sys/dev/sfxge/sfxge_ev.c +++ b/sys/dev/sfxge/sfxge_ev.c @@ -448,7 +448,7 @@ sfxge_ev_stat_update(struct sfxge_softc *sc) goto out; now = ticks; - if (now - sc->ev_stats_update_time < hz) + if ((unsigned int)(now - sc->ev_stats_update_time) < (unsigned int)hz) goto out; sc->ev_stats_update_time = now; diff --git a/sys/dev/sfxge/sfxge_port.c b/sys/dev/sfxge/sfxge_port.c index 709ed78..a4f671f 100644 --- a/sys/dev/sfxge/sfxge_port.c +++ b/sys/dev/sfxge/sfxge_port.c @@ -62,7 +62,7 @@ sfxge_mac_stat_update(struct sfxge_softc *sc) } now = ticks; - if (now - port->mac_stats.update_time < hz) { + if ((unsigned int)(now - port->mac_stats.update_time) < (unsigned int)hz) { rc = 0; goto out; } @@ -543,7 +543,7 @@ sfxge_phy_stat_update(struct sfxge_softc *sc) } now = ticks; - if (now - port->phy_stats.update_time < hz) { + if ((unsigned int)(now - port->phy_stats.update_time) < (unsigned int)hz) { rc = 0; goto out; } |