svn commit: r311962 - head/sys/dev/sfxge
Andrew Rybchenko
arybchik at FreeBSD.org
Thu Jan 12 06:30:46 UTC 2017
Author: arybchik
Date: Thu Jan 12 06:30:44 2017
New Revision: 311962
URL: https://svnweb.freebsd.org/changeset/base/311962
Log:
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.
MFC after: 2 days
Differential Revision: https://reviews.freebsd.org/D9130
Modified:
head/sys/dev/sfxge/sfxge.h
head/sys/dev/sfxge/sfxge_port.c
Modified: head/sys/dev/sfxge/sfxge.h
==============================================================================
--- head/sys/dev/sfxge/sfxge.h Thu Jan 12 06:29:14 2017 (r311961)
+++ head/sys/dev/sfxge/sfxge.h Thu Jan 12 06:30:44 2017 (r311962)
@@ -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: head/sys/dev/sfxge/sfxge_port.c
==============================================================================
--- head/sys/dev/sfxge/sfxge_port.c Thu Jan 12 06:29:14 2017 (r311961)
+++ head/sys/dev/sfxge/sfxge_port.c Thu Jan 12 06:30:44 2017 (r311962)
@@ -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-all
mailing list