From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Harton Subject: [PATCH] ethdev: stop overriding rx_nombuf by rte_eth_stats_get Date: Tue, 22 Aug 2017 21:19:37 -0400 Message-ID: <20170823011937.37579-1-dharton@cisco.com> Cc: dev@dpdk.org, David Harton To: thomas@monjalon.net Return-path: 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) 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; } -- 1.8.3.1