From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from alln-iport-3.cisco.com (alln-iport-3.cisco.com [173.37.142.90]) by dpdk.org (Postfix) with ESMTP id D601D1E2F for ; Wed, 23 Aug 2017 04:55:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1014; q=dns/txt; s=iport; t=1503456959; x=1504666559; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=1fQt8vbmX5UmEtiT7dGV8uSIOuSCfJHjHNJCzpzZSmI=; b=iPwUhVXckWz9ePsCcX2e5TIPX1Nu8fPJBufaEYBEzPdP2p7A4N+MXboV nbBdGgBp6kH11x/QfqQlj58IH30hLWJJWl4lHim+hLXRQ8VHuh5PCYHXu iVzo1i2aYwWdm6iuBtw9wq03fX1ObQVjeI/VHeMCBe0ukWhWgXlO+9xkZ 8=; X-IronPort-AV: E=Sophos;i="5.41,415,1498521600"; d="scan'208";a="474901141" Received: from alln-core-2.cisco.com ([173.36.13.135]) by alln-iport-3.cisco.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 23 Aug 2017 02:55:57 +0000 Received: from cpp-rtpbld-31.cisco.com (cpp-rtpbld-31.cisco.com [172.18.5.114]) by alln-core-2.cisco.com (8.14.5/8.14.5) with ESMTP id v7N2tvsn015309; Wed, 23 Aug 2017 02:55:57 GMT Received: by cpp-rtpbld-31.cisco.com (Postfix, from userid 140087) id 860C6591; Tue, 22 Aug 2017 22:55:57 -0400 (EDT) From: David Harton To: thomas@monjalon.net Cc: dev@dpdk.org, David Harton Date: Tue, 22 Aug 2017 22:55:55 -0400 Message-Id: <20170823025555.19022-1-dharton@cisco.com> X-Mailer: git-send-email 2.10.3.dirty In-Reply-To: <20170823011937.37579-1-dharton@cisco.com> References: <20170823011937.37579-1-dharton@cisco.com> Subject: [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 02:55:59 -0000 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; } -- 1.8.3.1