svn commit: r278248 - head/sys/dev/sfxge
Andrew Rybchenko
arybchik at FreeBSD.org
Thu Feb 5 11:37:08 UTC 2015
Author: arybchik
Date: Thu Feb 5 11:37:07 2015
New Revision: 278248
URL: https://svnweb.freebsd.org/changeset/base/278248
Log:
sfxge: access statistics buffers under port lock
Allow access to statistics data not only from sysctl handlers.
Submitted by: Boris Misenov <Boris.Misenov at oktetlabs.ru>
Sponsored by: Solarflare Communications, Inc.
Approved by: gnn (mentor)
Modified:
head/sys/dev/sfxge/sfxge_port.c
Modified: head/sys/dev/sfxge/sfxge_port.c
==============================================================================
--- head/sys/dev/sfxge/sfxge_port.c Thu Feb 5 10:50:51 2015 (r278247)
+++ head/sys/dev/sfxge/sfxge_port.c Thu Feb 5 11:37:07 2015 (r278248)
@@ -48,7 +48,7 @@ sfxge_mac_stat_update(struct sfxge_softc
unsigned int count;
int rc;
- SFXGE_PORT_LOCK(port);
+ SFXGE_PORT_LOCK_ASSERT_OWNED(port);
if (port->init_state != SFXGE_PORT_STARTED) {
rc = 0;
@@ -82,7 +82,6 @@ sfxge_mac_stat_update(struct sfxge_softc
rc = ETIMEDOUT;
out:
- SFXGE_PORT_UNLOCK(port);
return (rc);
}
@@ -93,12 +92,16 @@ sfxge_mac_stat_handler(SYSCTL_HANDLER_AR
unsigned int id = arg2;
int rc;
+ SFXGE_PORT_LOCK(&sc->port);
if ((rc = sfxge_mac_stat_update(sc)) != 0)
- return (rc);
+ goto out;
- return (SYSCTL_OUT(req,
- (uint64_t *)sc->port.mac_stats.decode_buf + id,
- sizeof(uint64_t)));
+ rc = SYSCTL_OUT(req,
+ (uint64_t *)sc->port.mac_stats.decode_buf + id,
+ sizeof(uint64_t));
+out:
+ SFXGE_PORT_UNLOCK(&sc->port);
+ return (rc);
}
static void
@@ -453,7 +456,7 @@ sfxge_phy_stat_update(struct sfxge_softc
unsigned int count;
int rc;
- SFXGE_PORT_LOCK(port);
+ SFXGE_PORT_LOCK_ASSERT_OWNED(port);
if (port->init_state != SFXGE_PORT_STARTED) {
rc = 0;
@@ -487,7 +490,6 @@ sfxge_phy_stat_update(struct sfxge_softc
rc = ETIMEDOUT;
out:
- SFXGE_PORT_UNLOCK(port);
return (rc);
}
@@ -498,12 +500,16 @@ sfxge_phy_stat_handler(SYSCTL_HANDLER_AR
unsigned int id = arg2;
int rc;
+ SFXGE_PORT_LOCK(&sc->port);
if ((rc = sfxge_phy_stat_update(sc)) != 0)
- return (rc);
+ goto out;
- return (SYSCTL_OUT(req,
- (uint32_t *)sc->port.phy_stats.decode_buf + id,
- sizeof(uint32_t)));
+ rc = SYSCTL_OUT(req,
+ (uint32_t *)sc->port.phy_stats.decode_buf + id,
+ sizeof(uint32_t));
+out:
+ SFXGE_PORT_UNLOCK(&sc->port);
+ return (rc);
}
static void
More information about the svn-src-all
mailing list