From patchwork Mon Aug 7 13:41:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Harton X-Patchwork-Id: 27477 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 C09A52BC8; Mon, 7 Aug 2017 15:41:15 +0200 (CEST) Received: from rcdn-iport-7.cisco.com (rcdn-iport-7.cisco.com [173.37.86.78]) by dpdk.org (Postfix) with ESMTP id 9E3472BC8 for ; Mon, 7 Aug 2017 15:41:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1824; q=dns/txt; s=iport; t=1502113273; x=1503322873; h=from:to:cc:subject:date:message-id; bh=lqxuUTnviMMmrrM2vvgNHuSeIlh+8saCYCym3t+XFnc=; b=fzaPxPls84kwx+MyiHULBJXtETctDjtSnBZAuESj+GMSljfSIpHHiFYx XoGPV5WOCUpWDoSFoi9N0XSeTh9DHpuCE1pP02UVFgPNNXhX0qSrpDIHj Pg/UyqdIqlFxKitD66PAxS9crgAtbU9MTPBzk/0LW82JpxgulER1B6ZGI 8=; X-IronPort-AV: E=Sophos;i="5.41,338,1498521600"; d="scan'208";a="277754995" Received: from alln-core-7.cisco.com ([173.36.13.140]) by rcdn-iport-7.cisco.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 07 Aug 2017 13:41:12 +0000 Received: from cpp-rtpbld-31.cisco.com (cpp-rtpbld-31.cisco.com [172.18.5.114]) by alln-core-7.cisco.com (8.14.5/8.14.5) with ESMTP id v77DfChF000381; Mon, 7 Aug 2017 13:41:12 GMT Received: by cpp-rtpbld-31.cisco.com (Postfix, from userid 140087) id 475DD2C1; Mon, 7 Aug 2017 09:41:12 -0400 (EDT) From: David Harton To: thomas@monjalon.net Cc: dev@dpdk.org, David Harton Date: Mon, 7 Aug 2017 09:41:07 -0400 Message-Id: <20170807134107.10771-1-dharton@cisco.com> X-Mailer: git-send-email 2.10.3.dirty Subject: [dpdk-dev] [PATCH v2] ethdev: add return code to rte_eth_stats_reset() 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" Some devices do not support reset of eth stats. An application may need to know not to clear shadow stats if the device cannot. rte_eth_stats_reset is updated to provide a return code to share whether the device supports reset or not. Signed-off-by: David Harton --- v2: * Fixed soft tab issue inserted while moving changes. lib/librte_ether/rte_ethdev.c | 8 +++++--- lib/librte_ether/rte_ethdev.h | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 0597641..3071eea 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1341,17 +1341,19 @@ rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats) return 0; } -void +int rte_eth_stats_reset(uint8_t port_id) { struct rte_eth_dev *dev; - RTE_ETH_VALID_PORTID_OR_RET(port_id); + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id); dev = &rte_eth_devices[port_id]; - RTE_FUNC_PTR_OR_RET(*dev->dev_ops->stats_reset); + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_reset); (*dev->dev_ops->stats_reset)(dev); dev->data->rx_mbuf_alloc_failed = 0; + + return 0; } static int diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 0adf327..d8ccd60 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -2246,8 +2246,10 @@ int rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats); * * @param port_id * The port identifier of the Ethernet device. + * @return + * Zero if successful. Non-zero otherwise. */ -void rte_eth_stats_reset(uint8_t port_id); +int rte_eth_stats_reset(uint8_t port_id); /** * Retrieve names of extended statistics of an Ethernet device.