From owner-svn-src-head@FreeBSD.ORG Sun Feb 22 07:18:39 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E25103C4; Sun, 22 Feb 2015 07:18:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CDD7D87D; Sun, 22 Feb 2015 07:18:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t1M7Id9A063204; Sun, 22 Feb 2015 07:18:39 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t1M7IdI6063203; Sun, 22 Feb 2015 07:18:39 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201502220718.t1M7IdI6063203@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Sun, 22 Feb 2015 07:18:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r279146 - head/sys/dev/sfxge/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Feb 2015 07:18:40 -0000 Author: arybchik Date: Sun Feb 22 07:18:38 2015 New Revision: 279146 URL: https://svnweb.freebsd.org/changeset/base/279146 Log: sfxge: use sparse index to retrieve sensor value Submitted by: Andrew Jackson Sponsored by: Solarflare Communications, Inc. Approved by: gnn (mentor) Modified: head/sys/dev/sfxge/common/siena_mon.c Modified: head/sys/dev/sfxge/common/siena_mon.c ============================================================================== --- head/sys/dev/sfxge/common/siena_mon.c Sun Feb 22 07:17:35 2015 (r279145) +++ head/sys/dev/sfxge/common/siena_mon.c Sun Feb 22 07:18:38 2015 (r279146) @@ -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,