From patchwork Wed Aug 23 01:19:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Harton X-Patchwork-Id: 27731 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id BFCAE7CEB; Wed, 23 Aug 2017 03:19:41 +0200 (CEST) Received: from alln-iport-7.cisco.com (alln-iport-7.cisco.com [173.37.142.94]) by dpdk.org (Postfix) with ESMTP id C277C7CE8 for ; Wed, 23 Aug 2017 03:19:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=950; q=dns/txt; s=iport; t=1503451180; x=1504660780; h=from:to:cc:subject:date:message-id; bh=mck+6bZcOgJc3X2a06riPVAJx2AY4oTEnBIMlfGX2R4=; b=c1Gsa2Qpk/pe7AAlnri/lH89QMs06mxr//ybXkH0uy9HENLCAgWH/bC7 G9bbGiE+gfIxGOMGTIhi4KJnTfQUEQJ4VcU+CflB5TMI+kaz8beByWzTV puRoR+7/8QJdUYA2WfuoYEhShEQ40ld6pEnpVqis6imQi1cA2ABh6Uxnp I=; X-IronPort-AV: E=Sophos;i="5.41,415,1498521600"; d="scan'208";a="475523507" Received: from alln-core-9.cisco.com ([173.36.13.129]) by alln-iport-7.cisco.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 23 Aug 2017 01:19:39 +0000 Received: from cpp-rtpbld-31.cisco.com (cpp-rtpbld-31.cisco.com [172.18.5.114]) by alln-core-9.cisco.com (8.14.5/8.14.5) with ESMTP id v7N1Jd9P011476; Wed, 23 Aug 2017 01:19:39 GMT Received: by cpp-rtpbld-31.cisco.com (Postfix, from userid 140087) id 5E3185AB; Tue, 22 Aug 2017 21:19:39 -0400 (EDT) From: David Harton To: thomas@monjalon.net Cc: dev@dpdk.org, David Harton Date: Tue, 22 Aug 2017 21:19:37 -0400 Message-Id: <20170823011937.37579-1-dharton@cisco.com> X-Mailer: git-send-email 2.10.3.dirty Subject: [dpdk-dev] [PATCH] 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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..0319e39 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; }