svn commit: r312159 - stable/11/sys/dev/sfxge
Andrew Rybchenko
arybchik at FreeBSD.org
Sat Jan 14 10:19:04 UTC 2017
Author: arybchik
Date: Sat Jan 14 10:19:03 2017
New Revision: 312159
URL: https://svnweb.freebsd.org/changeset/base/312159
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.
Sponsored by: Solarflare Communications, Inc.
Modified:
stable/11/sys/dev/sfxge/sfxge.h
stable/11/sys/dev/sfxge/sfxge_port.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/dev/sfxge/sfxge.h
==============================================================================
--- stable/11/sys/dev/sfxge/sfxge.h Sat Jan 14 10:17:49 2017 (r312158)
+++ stable/11/sys/dev/sfxge/sfxge.h Sat Jan 14 10:19:03 2017 (r312159)
@@ -159,6 +159,8 @@ enum sfxge_evq_state {
#define SFXGE_EV_BATCH 16384
+#define SFXGE_STATS_UPDATE_PERIOD_MS 1000
+
struct sfxge_evq {
/* Structure members below are sorted by usage order */
struct sfxge_softc *sc;
Modified: stable/11/sys/dev/sfxge/sfxge_port.c
==============================================================================
--- stable/11/sys/dev/sfxge/sfxge_port.c Sat Jan 14 10:17:49 2017 (r312158)
+++ stable/11/sys/dev/sfxge/sfxge_port.c Sat Jan 14 10:19:03 2017 (r312159)
@@ -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;
}
@@ -510,9 +513,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)
More information about the svn-src-stable-11
mailing list