summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarybchik <arybchik@FreeBSD.org>2017-01-14 10:19:03 +0000
committerarybchik <arybchik@FreeBSD.org>2017-01-14 10:19:03 +0000
commit5cc4b854b7ddd056e374dca1a486fdb4bafe361f (patch)
tree1fcd5ebb3dd429788ccf9b8e1128e09df2652d31
parentfd7c4b59e34c575b10ee9c72bfffeb55701721fe (diff)
downloadFreeBSD-src-5cc4b854b7ddd056e374dca1a486fdb4bafe361f.zip
FreeBSD-src-5cc4b854b7ddd056e374dca1a486fdb4bafe361f.tar.gz
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.
-rw-r--r--sys/dev/sfxge/sfxge.h2
-rw-r--r--sys/dev/sfxge/sfxge_port.c10
2 files changed, 9 insertions, 3 deletions
diff --git a/sys/dev/sfxge/sfxge.h b/sys/dev/sfxge/sfxge.h
index 2000652..90914da 100644
--- a/sys/dev/sfxge/sfxge.h
+++ b/sys/dev/sfxge/sfxge.h
@@ -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;
diff --git a/sys/dev/sfxge/sfxge_port.c b/sys/dev/sfxge/sfxge_port.c
index 58793ca..cb574f0 100644
--- a/sys/dev/sfxge/sfxge_port.c
+++ b/sys/dev/sfxge/sfxge_port.c
@@ -51,6 +51,7 @@ sfxge_mac_stat_update(struct sfxge_softc *sc)
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 *sc)
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)
OpenPOWER on IntegriCloud