svn commit: r312168 - in stable/10: share/man/man4 sys/dev/sfxge
Andrew Rybchenko
arybchik at FreeBSD.org
Sat Jan 14 10:58:10 UTC 2017
Author: arybchik
Date: Sat Jan 14 10:58:08 2017
New Revision: 312168
URL: https://svnweb.freebsd.org/changeset/base/312168
Log:
MFC r311977
sfxge(4): add tunable to configure MAC stats update period
Sponsored by: Solarflare Communications, Inc.
Modified:
stable/10/share/man/man4/sfxge.4
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/share/man/man4/sfxge.4
==============================================================================
--- stable/10/share/man/man4/sfxge.4 Sat Jan 14 10:50:45 2017 (r312167)
+++ stable/10/share/man/man4/sfxge.4 Sat Jan 14 10:58:08 2017 (r312168)
@@ -158,6 +158,14 @@ port will be the value of
.Va hw.sfxge.mcdi_logging.
The logging may also be enabled or disabled after the driver is loaded using the sysctl
.Va dev.sfxge.%d.mcdi_logging.
+.It Va hw.sfxge.stats_update_period_ms
+Period in milliseconds to refresh interface statistics from hardware.
+The accepted range is 0 to 65535, the default is 1000 (1 second).
+Use zero value to disable periodic statistics update.
+Supported on SFN8xxx series adapters with firmware v6.2.1.1033 and later and
+SFN5xxx and SFN6xxx series adapters.
+SFN7xxx series adapters and SFN8xxx series with earlier firmware use a
+fixed 1000 milliseconds statistics update period.
.El
.Sh SUPPORT
For general information and support,
Modified: stable/10/sys/dev/sfxge/sfxge.c
==============================================================================
--- stable/10/sys/dev/sfxge/sfxge.c Sat Jan 14 10:50:45 2017 (r312167)
+++ stable/10/sys/dev/sfxge/sfxge.c Sat Jan 14 10:58:08 2017 (r312168)
@@ -550,7 +550,8 @@ sfxge_tick(void *arg)
sfxge_port_update_stats(sc);
sfxge_tx_update_stats(sc);
- callout_reset(&sc->tick_callout, hz * SFXGE_STATS_UPDATE_PERIOD_MS / 1000,
+ callout_reset(&sc->tick_callout,
+ hz * sc->port.stats_update_period_ms / 1000,
sfxge_tick, sc);
}
@@ -615,7 +616,8 @@ sfxge_ifnet_init(struct ifnet *ifp, stru
if ((rc = sfxge_port_ifmedia_init(sc)) != 0)
goto fail;
- callout_reset(&sc->tick_callout, hz * SFXGE_STATS_UPDATE_PERIOD_MS / 1000,
+ callout_reset(&sc->tick_callout,
+ hz * sc->port.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:50:45 2017 (r312167)
+++ stable/10/sys/dev/sfxge/sfxge.h Sat Jan 14 10:58:08 2017 (r312168)
@@ -247,6 +247,7 @@ struct sfxge_port {
#endif
struct sfxge_hw_stats phy_stats;
struct sfxge_hw_stats mac_stats;
+ uint16_t stats_update_period_ms;
efx_link_mode_t link_mode;
uint8_t mcast_addrs[EFX_MAC_MULTICAST_LIST_MAX *
EFX_MAC_ADDR_LEN];
Modified: stable/10/sys/dev/sfxge/sfxge_port.c
==============================================================================
--- stable/10/sys/dev/sfxge/sfxge_port.c Sat Jan 14 10:50:45 2017 (r312167)
+++ stable/10/sys/dev/sfxge/sfxge_port.c Sat Jan 14 10:58:08 2017 (r312168)
@@ -43,6 +43,15 @@ __FBSDID("$FreeBSD$");
#include "sfxge.h"
+#define SFXGE_PARAM_STATS_UPDATE_PERIOD_MS \
+ SFXGE_PARAM(stats_update_period_ms)
+static int sfxge_stats_update_period_ms = SFXGE_STATS_UPDATE_PERIOD_MS;
+TUNABLE_INT(SFXGE_PARAM_STATS_UPDATE_PERIOD_MS,
+ &sfxge_stats_update_period_ms);
+SYSCTL_INT(_hw_sfxge, OID_AUTO, stats_update_period_ms, CTLFLAG_RDTUN,
+ &sfxge_stats_update_period_ms, 0,
+ "netstat interface statistics update period in milliseconds");
+
static int sfxge_phy_cap_mask(struct sfxge_softc *, int, uint32_t *);
static int
@@ -62,7 +71,7 @@ sfxge_mac_stat_update(struct sfxge_softc
goto out;
}
- min_ticks = (unsigned int)hz * SFXGE_STATS_UPDATE_PERIOD_MS / 1000;
+ min_ticks = (unsigned int)hz * port->stats_update_period_ms / 1000;
now = ticks;
if ((unsigned int)(now - port->mac_stats.update_time) < min_ticks) {
@@ -488,7 +497,7 @@ sfxge_port_start(struct sfxge_softc *sc)
/* Update MAC stats by DMA every period */
if ((rc = efx_mac_stats_periodic(enp, &port->mac_stats.dma_buf,
- SFXGE_STATS_UPDATE_PERIOD_MS,
+ port->stats_update_period_ms,
B_FALSE)) != 0)
goto fail6;
@@ -646,6 +655,26 @@ sfxge_port_fini(struct sfxge_softc *sc)
port->sc = NULL;
}
+static uint16_t
+sfxge_port_stats_update_period_ms(struct sfxge_softc *sc)
+{
+ int period_ms = sfxge_stats_update_period_ms;
+
+ if (period_ms < 0) {
+ device_printf(sc->dev,
+ "treat negative stats update period %d as 0 (disable)\n",
+ period_ms);
+ period_ms = 0;
+ } else if (period_ms > UINT16_MAX) {
+ device_printf(sc->dev,
+ "treat too big stats update period %d as %u\n",
+ period_ms, UINT16_MAX);
+ period_ms = UINT16_MAX;
+ }
+
+ return period_ms;
+}
+
int
sfxge_port_init(struct sfxge_softc *sc)
{
@@ -694,6 +723,7 @@ sfxge_port_init(struct sfxge_softc *sc)
M_SFXGE, M_WAITOK | M_ZERO);
if ((rc = sfxge_dma_alloc(sc, EFX_MAC_STATS_SIZE, mac_stats_buf)) != 0)
goto fail2;
+ port->stats_update_period_ms = sfxge_port_stats_update_period_ms(sc);
sfxge_mac_stat_init(sc);
port->init_state = SFXGE_PORT_INITIALIZED;
More information about the svn-src-stable
mailing list