From owner-svn-src-stable-10@freebsd.org Sat Jan 14 10:50:46 2017 Return-Path: Delivered-To: svn-src-stable-10@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 92864CA7DDA; Sat, 14 Jan 2017 10:50:46 +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 62092114C; Sat, 14 Jan 2017 10:50:46 +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 v0EAojv2012191; Sat, 14 Jan 2017 10:50:45 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0EAoje9012188; Sat, 14 Jan 2017 10:50:45 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201701141050.v0EAoje9012188@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Sat, 14 Jan 2017 10:50:45 +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: r312167 - 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jan 2017 10:50:46 -0000 Author: arybchik Date: Sat Jan 14 10:50:45 2017 New Revision: 312167 URL: https://svnweb.freebsd.org/changeset/base/312167 Log: MFC r311962 sfxge(4): stats refresh in SW should depend on HW update period The period should be taken into account by the function which refreshes driver stats. Reviewed by: philip Sponsored by: Solarflare Communications, Inc. Modified: stable/10/sys/dev/sfxge/sfxge.c stable/10/sys/dev/sfxge/sfxge.h stable/10/sys/dev/sfxge/sfxge_port.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge.c Sat Jan 14 10:39:42 2017 (r312166) +++ stable/10/sys/dev/sfxge/sfxge.c Sat Jan 14 10:50:45 2017 (r312167) @@ -94,14 +94,6 @@ SYSCTL_INT(_hw_sfxge, OID_AUTO, tx_ring, &sfxge_tx_ring_entries, 0, "Maximum number of descriptors in a transmit ring"); -#define SFXGE_PARAM_STATS_UPDATE_PERIOD SFXGE_PARAM(stats_update_period) -static int sfxge_stats_update_period = SFXGE_CALLOUT_TICKS; -TUNABLE_INT(SFXGE_PARAM_STATS_UPDATE_PERIOD, - &sfxge_stats_update_period); -SYSCTL_INT(_hw_sfxge, OID_AUTO, stats_update_period, CTLFLAG_RDTUN, - &sfxge_stats_update_period, 0, - "netstat interface statistics update period in ticks"); - #define SFXGE_PARAM_RESTART_ATTEMPTS SFXGE_PARAM(restart_attempts) static int sfxge_restart_attempts = 3; TUNABLE_INT(SFXGE_PARAM_RESTART_ATTEMPTS, &sfxge_restart_attempts); @@ -558,7 +550,7 @@ sfxge_tick(void *arg) sfxge_port_update_stats(sc); sfxge_tx_update_stats(sc); - callout_reset(&sc->tick_callout, sfxge_stats_update_period, + callout_reset(&sc->tick_callout, hz * SFXGE_STATS_UPDATE_PERIOD_MS / 1000, sfxge_tick, sc); } @@ -623,7 +615,7 @@ sfxge_ifnet_init(struct ifnet *ifp, stru if ((rc = sfxge_port_ifmedia_init(sc)) != 0) goto fail; - callout_reset(&sc->tick_callout, sfxge_stats_update_period, + callout_reset(&sc->tick_callout, hz * SFXGE_STATS_UPDATE_PERIOD_MS / 1000, sfxge_tick, sc); return (0); Modified: stable/10/sys/dev/sfxge/sfxge.h ============================================================================== --- stable/10/sys/dev/sfxge/sfxge.h Sat Jan 14 10:39:42 2017 (r312166) +++ stable/10/sys/dev/sfxge/sfxge.h Sat Jan 14 10:50:45 2017 (r312167) @@ -158,7 +158,7 @@ enum sfxge_evq_state { #define SFXGE_EV_BATCH 16384 -#define SFXGE_CALLOUT_TICKS 100 +#define SFXGE_STATS_UPDATE_PERIOD_MS 1000 struct sfxge_evq { /* Structure members below are sorted by usage order */ Modified: stable/10/sys/dev/sfxge/sfxge_port.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_port.c Sat Jan 14 10:39:42 2017 (r312166) +++ stable/10/sys/dev/sfxge/sfxge_port.c Sat Jan 14 10:50:45 2017 (r312167) @@ -51,6 +51,7 @@ sfxge_mac_stat_update(struct sfxge_softc struct sfxge_port *port = &sc->port; efsys_mem_t *esmp = &(port->mac_stats.dma_buf); clock_t now; + unsigned int min_ticks; unsigned int count; int rc; @@ -61,8 +62,10 @@ sfxge_mac_stat_update(struct sfxge_softc goto out; } + min_ticks = (unsigned int)hz * SFXGE_STATS_UPDATE_PERIOD_MS / 1000; + now = ticks; - if ((unsigned int)(now - port->mac_stats.update_time) < (unsigned int)hz) { + if ((unsigned int)(now - port->mac_stats.update_time) < min_ticks) { rc = 0; goto out; } @@ -483,9 +486,10 @@ sfxge_port_start(struct sfxge_softc *sc) sfxge_mac_filter_set_locked(sc); - /* Update MAC stats by DMA every second */ + /* Update MAC stats by DMA every period */ if ((rc = efx_mac_stats_periodic(enp, &port->mac_stats.dma_buf, - 1000, B_FALSE)) != 0) + SFXGE_STATS_UPDATE_PERIOD_MS, + B_FALSE)) != 0) goto fail6; if ((rc = efx_mac_drain(enp, B_FALSE)) != 0)