From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f51.google.com (mail-pg0-f51.google.com [74.125.83.51]) by dpdk.org (Postfix) with ESMTP id A05A87D5E for ; Wed, 23 Aug 2017 23:56:39 +0200 (CEST) Received: by mail-pg0-f51.google.com with SMTP id u191so5972043pgc.2 for ; Wed, 23 Aug 2017 14:56:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZXHx7v8Z5wbojGwmNGp+dz+ZIToU6HAVcO8tymSpv7I=; b=pMJjcm654b6nWqroHcxR7EO2e2ZEL4ZwA2LhW6SjiopZQz3YIHVx6DNF+tu3cjUweS iawoLI1snkeWnZWe9QfzJ58BdlhSl+C4jfLT4/IccMud+F8XrPwIvrPa9WFrYIMd05+h jVmI39qFjPFJXd684aOI8E0OoGuPwSTN1S2LuuTTMMAymeP+1saGT63JU+Qbv36zXjHR GnIokIJLLKQza2jE0AtIHH2HqlvNjAyMHs6ofugt9mxP3/cpnfvxhQVGSBrlx6/UGXIk HRdCdMFeOp3E1cwfsLP7Faf8y+me4mTMimhNpOOW2pu+ZTmzkLlTqbuR23RtOpUdTw6/ AZog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZXHx7v8Z5wbojGwmNGp+dz+ZIToU6HAVcO8tymSpv7I=; b=TQpKymXfOAIrQ65iyC7LrFGqVS2CdMHepNjIDHlfhQVh5C5ZHJobSMBRbwn3Cg7ogr 4gk1N8ccHiX6MnfOavcVJhPV/MOKtXESa8EkbLMSc0wEtBWvJzM7VHZVacHYCFNbwWAf pgtyxfnO6FBRz5nRZJTa5j6g9oKrRMX24U67+JyR/4nbxUU6cnJq73uy/zVk2E+PXXn0 aUHNJIqwCxo76Zyr+aUjuWvYWQqbbdwDXYqowe889KReYYWNhxUdI8wu14c0OY9ZG07I WCwF7qN56zY6eAJ8Nhg2EcE+b8yZIcqOv0WOzB7r6MqHqxEx72oV77K/QZ/CH4/cG1g9 mBCA== X-Gm-Message-State: AHYfb5gaBzbLLK5uptzmXTqKUwmVBdzceGvk7mka7vV/ksiw65tsTYnW CaAuEYY6GuE06jqAZ4OlTg== X-Received: by 10.99.96.84 with SMTP id u81mr4257318pgb.345.1503525398836; Wed, 23 Aug 2017 14:56:38 -0700 (PDT) Received: from xeon-e3 (76-14-207-240.or.wavecable.com. [76.14.207.240]) by smtp.gmail.com with ESMTPSA id n26sm4225976pgd.29.2017.08.23.14.56.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 Aug 2017 14:56:38 -0700 (PDT) Date: Wed, 23 Aug 2017 14:56:31 -0700 From: Stephen Hemminger To: David Harton Cc: thomas@monjalon.net, dev@dpdk.org Message-ID: <20170823145631.5fce68dc@xeon-e3> In-Reply-To: <20170823025555.19022-1-dharton@cisco.com> References: <20170823011937.37579-1-dharton@cisco.com> <20170823025555.19022-1-dharton@cisco.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2 1/2] ethdev: stop overriding rx_nombuf by rte_eth_stats_get 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: , X-List-Received-Date: Wed, 23 Aug 2017 21:56:40 -0000 On Tue, 22 Aug 2017 22:55:55 -0400 David Harton wrote: > rte_eth_stats_get() unconditonally would set rx_nombuf > even if the device was setting the value. A check has > been added in rte_eth_stats_get() to leave the device > value in-tact when non-zero. > > Signed-off-by: David Harton > --- > > v2: Fixed braces complaint required by other coding standards. > > lib/librte_ether/rte_ethdev.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > index 0597641..0a1d3b8 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -1336,8 +1336,11 @@ struct rte_eth_dev * > memset(stats, 0, sizeof(*stats)); > > RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP); > - stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed; > (*dev->dev_ops->stats_get)(dev, stats); > + /* only set rx_nombuf if not set by the device */ > + if (!stats->rx_nombuf) > + stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed; > + > return 0; > } > This seems backwards. It seems like the original way worked fine. If device specific code wanted to override rx_nombuf it could do so either by adding it's additional value or just setting rx_nombuf. Adding special cases seems like it would start a bad precedent and the could would end up quite complex as some values had one semantic and others were only from driver.