From owner-svn-src-stable@freebsd.org Tue Aug 23 13:51:56 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B937EBC3DE2; Tue, 23 Aug 2016 13:51:56 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 71C73183D; Tue, 23 Aug 2016 13:51:56 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7NDpt5l092920; Tue, 23 Aug 2016 13:51:55 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7NDptpP092918; Tue, 23 Aug 2016 13:51:55 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201608231351.u7NDptpP092918@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Tue, 23 Aug 2016 13:51:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r304679 - stable/10/sys/dev/sfxge X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 13:51:56 -0000 Author: arybchik Date: Tue Aug 23 13:51:55 2016 New Revision: 304679 URL: https://svnweb.freebsd.org/changeset/base/304679 Log: 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. Modified: stable/10/sys/dev/sfxge/sfxge_ev.c stable/10/sys/dev/sfxge/sfxge_port.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge_ev.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_ev.c Tue Aug 23 13:43:43 2016 (r304678) +++ stable/10/sys/dev/sfxge/sfxge_ev.c Tue Aug 23 13:51:55 2016 (r304679) @@ -448,7 +448,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: stable/10/sys/dev/sfxge/sfxge_port.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_port.c Tue Aug 23 13:43:43 2016 (r304678) +++ stable/10/sys/dev/sfxge/sfxge_port.c Tue Aug 23 13:51:55 2016 (r304679) @@ -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; } @@ -543,7 +543,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; }