svn commit: r312161 - in stable/11: share/man/man4 sys/dev/sfxge
Andrew Rybchenko
arybchik at FreeBSD.org
Sat Jan 14 10:20:28 UTC 2017
Author: arybchik
Date: Sat Jan 14 10:20:27 2017
New Revision: 312161
URL: https://svnweb.freebsd.org/changeset/base/312161
Log:
MFC r311983
sfxge(4): add sysctl to change MAC stats update period
The sysctl controls the period per interface.
Sponsored by: Solarflare Communications, Inc.
Modified:
stable/11/share/man/man4/sfxge.4
stable/11/sys/dev/sfxge/sfxge_port.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/share/man/man4/sfxge.4
==============================================================================
--- stable/11/share/man/man4/sfxge.4 Sat Jan 14 10:19:44 2017 (r312160)
+++ stable/11/share/man/man4/sfxge.4 Sat Jan 14 10:20:27 2017 (r312161)
@@ -166,6 +166,8 @@ Supported on SFN8xxx series adapters wit
SFN5xxx and SFN6xxx series adapters.
SFN7xxx series adapters and SFN8xxx series with earlier firmware use a
fixed 1000 milliseconds statistics update period.
+The period may also be changed after the driver is loaded using the sysctl
+.Va dev.sfxge.%d.stats_update_period_ms .
.El
.Sh SUPPORT
For general information and support,
Modified: stable/11/sys/dev/sfxge/sfxge_port.c
==============================================================================
--- stable/11/sys/dev/sfxge/sfxge_port.c Sat Jan 14 10:19:44 2017 (r312160)
+++ stable/11/sys/dev/sfxge/sfxge_port.c Sat Jan 14 10:20:27 2017 (r312161)
@@ -702,6 +702,48 @@ sfxge_port_stats_update_period_ms(struct
return period_ms;
}
+static int
+sfxge_port_stats_update_period_ms_handler(SYSCTL_HANDLER_ARGS)
+{
+ struct sfxge_softc *sc;
+ struct sfxge_port *port;
+ unsigned int period_ms;
+ int error;
+
+ sc = arg1;
+ port = &sc->port;
+
+ if (req->newptr != NULL) {
+ error = SYSCTL_IN(req, &period_ms, sizeof(period_ms));
+ if (error != 0)
+ return (error);
+
+ if (period_ms > UINT16_MAX)
+ return (EINVAL);
+
+ SFXGE_PORT_LOCK(port);
+
+ if (port->stats_update_period_ms != period_ms) {
+ if (port->init_state == SFXGE_PORT_STARTED)
+ error = efx_mac_stats_periodic(sc->enp,
+ &port->mac_stats.dma_buf,
+ period_ms, B_FALSE);
+ if (error == 0)
+ port->stats_update_period_ms = period_ms;
+ }
+
+ SFXGE_PORT_UNLOCK(port);
+ } else {
+ SFXGE_PORT_LOCK(port);
+ period_ms = port->stats_update_period_ms;
+ SFXGE_PORT_UNLOCK(port);
+
+ error = SYSCTL_OUT(req, &period_ms, sizeof(period_ms));
+ }
+
+ return (error);
+}
+
int
sfxge_port_init(struct sfxge_softc *sc)
{
@@ -753,6 +795,11 @@ sfxge_port_init(struct sfxge_softc *sc)
port->stats_update_period_ms = sfxge_port_stats_update_period_ms(sc);
sfxge_mac_stat_init(sc);
+ SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO,
+ "stats_update_period_ms", CTLTYPE_UINT|CTLFLAG_RW, sc, 0,
+ sfxge_port_stats_update_period_ms_handler, "IU",
+ "interface statistics refresh period");
+
port->init_state = SFXGE_PORT_INITIALIZED;
DBGPRINT(sc->dev, "success");
More information about the svn-src-stable
mailing list