From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 99B92A0495 for ; Mon, 10 Jun 2019 09:38:57 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 30C3B1BE8E; Mon, 10 Jun 2019 09:38:56 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id B003E1BE8C for ; Mon, 10 Jun 2019 09:38:54 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us5.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id A1B634C0058 for ; Mon, 10 Jun 2019 07:38:53 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 10 Jun 2019 00:38:50 -0700 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Mon, 10 Jun 2019 00:38:50 -0700 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id x5A7cnSV008758; Mon, 10 Jun 2019 08:38:49 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 1FF251616E0; Mon, 10 Jun 2019 08:38:49 +0100 (BST) From: Andrew Rybchenko To: CC: Mark Spender Date: Mon, 10 Jun 2019 08:38:19 +0100 Message-ID: <1560152324-20538-5-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1560152324-20538-1-git-send-email-arybchenko@solarflare.com> References: <1560152324-20538-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24664.003 X-TM-AS-Result: No-5.899400-4.000000-10 X-TMASE-MatchedRID: 0wm7BrAfHYebs6dB9YVkSYVMtEwAWsdcf6iC0fNopZmxHvem8y6Tr8iT Wug2C4DN3iuNqik9NLyNc7lgUuqZsgMj3UjQ3RjvA9lly13c/gEGn3GW6NbnSKjxqhyDxmYjGKf /vWX0b7DlS2BlJV0Y0gXidoJ7b4hPMGg+wgnY/el1e7Xbb6Im2n4kYxhimH/bHWtVZN0asTgCzy IBtbPv6uLzNWBegCW2wgn7iDBesS3fd+P6wwCt81KV6oMVdTepRYRlyrip2AkXDHSPY5k6ntrYU u3n/G2qCoKM2bhtz9kFS+J831mRCX7cGd19dSFd X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--5.899400-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24664.003 X-MDID: 1560152334-G_U_cSSi9Mkk Subject: [dpdk-dev] [PATCH 04/29] net/sfc/base: improve code style in sensors decoding X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Mark Spender Add more comments to simplify code reading and understanding. Signed-off-by: Mark Spender Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/base/mcdi_mon.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/net/sfc/base/mcdi_mon.c b/drivers/net/sfc/base/mcdi_mon.c index d0247dc..824d9ca 100644 --- a/drivers/net/sfc/base/mcdi_mon.c +++ b/drivers/net/sfc/base/mcdi_mon.c @@ -63,34 +63,34 @@ for (sensor = 0; sensor < sensor_max; ++sensor) { efx_mon_stat_t id; efx_mon_stat_portmask_t stat_portmask = 0; - boolean_t decode_ok; efx_mon_stat_unit_t stat_unit; if ((sensor % (MC_CMD_SENSOR_PAGE0_NEXT + 1)) == MC_CMD_SENSOR_PAGE0_NEXT) { + /* This sensor is one of the page boundary bits. */ page++; continue; - /* This sensor is one of the page boundary bits. */ } if (~(sensor_mask[page]) & - (1U << (sensor % (sizeof (sensor_mask[page]) * 8)))) + (1U << (sensor % (sizeof (sensor_mask[page]) * 8)))) { + /* This sensor is not supported. */ continue; - /* This sensor not in DMA buffer */ + } + /* Supported sensor, so it is present in the DMA buffer. */ idx++; - /* - * Valid stat in DMA buffer that we need to increment over, even - * if we couldn't look up the id - */ - decode_ok = efx_mon_mcdi_to_efx_stat(sensor, &id); - decode_ok = - decode_ok && efx_mon_get_stat_portmap(id, &stat_portmask); + if ((efx_mon_mcdi_to_efx_stat(sensor, &id) != B_TRUE) || + (efx_mon_get_stat_portmap(id, &stat_portmask) != B_TRUE)){ + /* The sensor is not known to the driver. */ + continue; + } - if (!(decode_ok && (stat_portmask & port_mask))) + if ((stat_portmask & port_mask) == 0) { + /* The sensor is not for this port. */ continue; - /* Either bad decode, or don't know what port stat is on */ + } EFSYS_ASSERT(id < EFX_MON_NSTATS); -- 1.8.3.1