diff options
author | arybchik <arybchik@FreeBSD.org> | 2015-03-25 11:10:56 +0000 |
---|---|---|
committer | arybchik <arybchik@FreeBSD.org> | 2015-03-25 11:10:56 +0000 |
commit | 5550e7827965084ba1e50e3750ea52b88c93a72c (patch) | |
tree | 78f73822f0017380360e83ec0798b18b4ad11a8a | |
parent | 6155128a58d68cd99567304550c3ec59346b011f (diff) | |
download | FreeBSD-src-5550e7827965084ba1e50e3750ea52b88c93a72c.zip FreeBSD-src-5550e7827965084ba1e50e3750ea52b88c93a72c.tar.gz |
MFC: 279146
sfxge: use sparse index to retrieve sensor value
Submitted by: Andrew Jackson <ajackson at solarflare.com>
Sponsored by: Solarflare Communications, Inc.
Approved by: gnn (mentor)
-rw-r--r-- | sys/dev/sfxge/common/siena_mon.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/dev/sfxge/common/siena_mon.c b/sys/dev/sfxge/common/siena_mon.c index dc3e59e..ed337bd 100644 --- a/sys/dev/sfxge/common/siena_mon.c +++ b/sys/dev/sfxge/common/siena_mon.c @@ -105,6 +105,7 @@ siena_mon_decode_stats( uint16_t mc_sensor; size_t mc_sensor_max; uint32_t vmask = 0; + uint32_t idx = 0; /* Assert the MC_CMD_SENSOR and EFX_MON_STATE namespaces agree */ SIENA_STATIC_SENSOR_ASSERT(OK); @@ -125,18 +126,19 @@ siena_mon_decode_stats( for (mc_sensor = 0; mc_sensor < mc_sensor_max; ++mc_sensor) { uint16_t efx_sensor = sensor_map[mc_sensor]; - if (efx_sensor == SIENA_MON_WRONG_PORT) + if (~dmask & (1 << mc_sensor)) continue; - EFSYS_ASSERT(efx_sensor < EFX_MON_NSTATS); + idx++; - if (~dmask & (1 << mc_sensor)) + if (efx_sensor == SIENA_MON_WRONG_PORT) continue; + EFSYS_ASSERT(efx_sensor < EFX_MON_NSTATS); vmask |= (1 << efx_sensor); if (value != NULL && esmp != NULL && !EFSYS_MEM_IS_NULL(esmp)) { efx_mon_stat_value_t *emsvp = value + efx_sensor; efx_dword_t dword; - EFSYS_MEM_READD(esmp, 4 * mc_sensor, &dword); + EFSYS_MEM_READD(esmp, 4 * (idx - 1), &dword); emsvp->emsv_value = (uint16_t)EFX_DWORD_FIELD( dword, |