Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Jun 2016 12:29:03 +0000 (UTC)
From:      Andrew Rybchenko <arybchik@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r301724 - head/sys/dev/sfxge
Message-ID:  <201606091229.u59CT3b5053591@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: arybchik
Date: Thu Jun  9 12:29:03 2016
New Revision: 301724
URL: https://svnweb.freebsd.org/changeset/base/301724

Log:
  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.
  MFC after:      1 week
  Differential Revision:  https://reviews.freebsd.org/D6777

Modified:
  head/sys/dev/sfxge/sfxge_ev.c
  head/sys/dev/sfxge/sfxge_port.c

Modified: head/sys/dev/sfxge/sfxge_ev.c
==============================================================================
--- head/sys/dev/sfxge/sfxge_ev.c	Thu Jun  9 11:39:50 2016	(r301723)
+++ head/sys/dev/sfxge/sfxge_ev.c	Thu Jun  9 12:29:03 2016	(r301724)
@@ -453,7 +453,7 @@ sfxge_ev_stat_update(struct sfxge_softc 
 		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;

Modified: head/sys/dev/sfxge/sfxge_port.c
==============================================================================
--- head/sys/dev/sfxge/sfxge_port.c	Thu Jun  9 11:39:50 2016	(r301723)
+++ head/sys/dev/sfxge/sfxge_port.c	Thu Jun  9 12:29:03 2016	(r301724)
@@ -62,7 +62,7 @@ sfxge_mac_stat_update(struct sfxge_softc
 	}
 
 	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;
 	}
@@ -570,7 +570,7 @@ sfxge_phy_stat_update(struct sfxge_softc
 	}
 
 	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;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606091229.u59CT3b5053591>