From patchwork Fri Sep 6 14:34:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 58880 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9E2F61F3FA; Fri, 6 Sep 2019 16:35:46 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id 7F0A71F367 for ; Fri, 6 Sep 2019 16:35:44 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us4.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id BCED2280064; Fri, 6 Sep 2019 14:35:40 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 6 Sep 2019 07:35:37 -0700 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Fri, 6 Sep 2019 07:35:37 -0700 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id x86EZV6b027461; Fri, 6 Sep 2019 15:35:31 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id CFF7D1613D2; Fri, 6 Sep 2019 15:35:31 +0100 (BST) From: Andrew Rybchenko To: Maryam Tahhan , Reshma Pattan , Wenzhuo Lu , Jingjing Wu , Bernard Iremonger , Neil Horman , John McNamara , Marko Kovacevic , Thomas Monjalon , Ferruh Yigit CC: , Igor Romanov Date: Fri, 6 Sep 2019 15:34:53 +0100 Message-ID: <1567780495-14120-2-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1567780495-14120-1-git-send-email-arybchenko@solarflare.com> References: <1567780495-14120-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24892.005 X-TM-AS-Result: No-5.135400-4.000000-10 X-TMASE-MatchedRID: kj6Y84S1kcJWSqhPlGB839WxbZgaqhS00mSc1YzbC53iYlKox3ryNARj Z4/TzBlybaFo1bdWCGbKLWM6wS3Ebn4rfsJAYItJNVRz+HwqL4ILKPaBHScRdT2mEJylgvfBcij MZrr2iZ2t2gtuWr1Lmtr+D80ZNbcyr3XE8Kt+l0KWAT2bUHJRZ4iOlwKRotjG4TWlihdnJ0GRIz A+ae0xXOA2fXxJYlC7s/2j1FYrEUynuow8yO9beUrM69p7lDSs8vvksslXuLcda1Vk3RqxOCRmd HeCks1SzuwxCLJTs5C+Y//ouGCT8oqEDaEbYNOrfp4xmUCrQu/nEl/YQBxicCBQRBOQhaJiyiOy wU4g9AQ4a4PpAihuCNpjYdI8mvH+HxPMjOKY7A8LbigRnpKlKWxlRJiH4397AvrDdnOTTFoxmm0 RVkKgh796Hx4rK5YaS4Wh6UWeBDoNmxDA5xWGpQ== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--5.135400-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24892.005 X-MDID: 1567780541-aAL8mjtxfmRY Subject: [dpdk-dev] [PATCH 1/2] ethdev: change xstats reset function return value to int 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" From: Igor Romanov Change rte_eth_xstats_reset() return value from void to int and return negative errno values in case of error conditions. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- app/proc-info/main.c | 10 +++++++++- app/test-pmd/config.c | 8 +++++++- doc/guides/rel_notes/deprecation.rst | 1 - doc/guides/rel_notes/release_19_11.rst | 3 +++ lib/librte_ethdev/rte_ethdev.c | 8 ++++---- lib/librte_ethdev/rte_ethdev.h | 7 ++++++- 6 files changed, 29 insertions(+), 8 deletions(-) diff --git a/app/proc-info/main.c b/app/proc-info/main.c index 34eb7a7cc4..94e808dc6e 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -580,8 +580,16 @@ nic_xstats_display(uint16_t port_id) static void nic_xstats_clear(uint16_t port_id) { + int ret; + printf("\n Clearing NIC xstats for port %d\n", port_id); - rte_eth_xstats_reset(port_id); + ret = rte_eth_xstats_reset(port_id); + if (ret != 0) { + printf("\n Error clearing xstats for port %d: %s\n", port_id, + strerror(-ret)); + return; + } + printf("\n NIC extended statistics for port %d cleared\n", port_id); } diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 24158e5f7d..857b6dabc9 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -273,7 +273,13 @@ nic_xstats_display(portid_t port_id) void nic_xstats_clear(portid_t port_id) { - rte_eth_xstats_reset(port_id); + int ret; + + ret = rte_eth_xstats_reset(port_id); + if (ret != 0) { + printf("%s: Error: failed to reset xstats (port %u): %s", + __func__, port_id, strerror(ret)); + } } void diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index b2e0a1fc7c..beb9cc3b65 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -92,7 +92,6 @@ Deprecation Notices - ``rte_eth_link_get`` and ``rte_eth_link_get_nowait`` - ``rte_eth_dev_stop`` - ``rte_eth_dev_close`` - - ``rte_eth_xstats_reset`` - ``rte_eth_macaddr_get`` - ``rte_eth_dev_owner_delete`` diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst index 5299157df7..3f492ac20d 100644 --- a/doc/guides/rel_notes/release_19_11.rst +++ b/doc/guides/rel_notes/release_19_11.rst @@ -101,6 +101,9 @@ API Changes ``rte_eth_promiscuous_disable`` return value from ``void`` to ``int`` to provide a way to report various error conditions. +* ethdev: changed ``rte_eth_dev_xstats_reset`` return value from ``void`` to + ``int`` to provide a way to report various error conditions. + ABI Changes ----------- diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 98fe533c5a..b843bbc208 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -2518,22 +2518,22 @@ rte_eth_xstats_get(uint16_t port_id, struct rte_eth_xstat *xstats, } /* reset ethdev extended statistics */ -void +int rte_eth_xstats_reset(uint16_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, -ENODEV); dev = &rte_eth_devices[port_id]; /* implemented by the driver */ if (dev->dev_ops->xstats_reset != NULL) { (*dev->dev_ops->xstats_reset)(dev); - return; + return 0; } /* fallback to default */ - rte_eth_stats_reset(port_id); + return rte_eth_stats_reset(port_id); } static int diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index f07a829b29..328503d1be 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -2284,8 +2284,13 @@ int rte_eth_xstats_get_id_by_name(uint16_t port_id, const char *xstat_name, * * @param port_id * The port identifier of the Ethernet device. + * @return + * - (0) if device notified to reset extended stats. + * - (-ENOTSUP) if pmd doesn't support both + * extended stats and basic stats reset. + * - (-ENODEV) if *port_id* invalid. */ -void rte_eth_xstats_reset(uint16_t port_id); +int rte_eth_xstats_reset(uint16_t port_id); /** * Set a mapping for the specified transmit queue to the specified per-queue