From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4319BA046B for ; Thu, 27 Jun 2019 01:34:06 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9D05B49DF; Thu, 27 Jun 2019 01:33:59 +0200 (CEST) Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by dpdk.org (Postfix) with ESMTP id 5E60937A2 for ; Thu, 27 Jun 2019 01:33:56 +0200 (CEST) Received: by mail-pl1-f193.google.com with SMTP id cl9so177486plb.10 for ; Wed, 26 Jun 2019 16:33:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AQgEGBY4Y26AC15xbnPM6T8FR6p2CYz6B+3FZqaA17g=; b=VtvNHmy9QDF2Z8muF/QGtFuaLI0+9DbYmlKO+HLfXMNSabgGB1X6SMtw8JtcDIbsBa zG4glO+RBMIv9MM8ldx+zOlLpMc41twr8ZFkoiqmJ3GSuhLkDBGz8uMzgOpjj9Gvm+bK pQHGNCArChKm+KTcehwcPBUobLomR3h4GzJRU/3gaBs7HtgF2kLB6ihQK1LnVRcaRzQH GY2374DPhr++g8UszYizuMj4xJR/z6zPvKM6yol2WHgNJc/yLYbTaEoIAPG3XIiA0xAr Pqb7ZAeZiTW8YHElL42uF7ZguAElHz2T7LZ2gzQxO2nqYOBS7pZ4covW9Ywb1KpRirdk cg7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AQgEGBY4Y26AC15xbnPM6T8FR6p2CYz6B+3FZqaA17g=; b=Ntht0NFE04IG1ygTT9ositFKxgeflBhPRIlVd0S4BX7qPoYbAG53FI0i4VFtd4Svzi uDPmv4Dw0ft0Xr/pxPP58apXlo3uSx3b3kJOluM8nRTbWwu8r2CPIo4NxnrLpvwaAAc3 KjzeEsDkfVY5nu3YTfuDkPK6NN/Sa8EghifXijFNAPE4zhIlNIGXNxufThCmUi16lZNl rfaL7BwtmjlAij/V0WuABmLGlnvB2RBmchMDoebaWxZUSiTFv+OJfN5ZSqYNGZawcnCf Tds4RMNNfs6SOktyzbn2LQMAlt6NOVSwIukPfzDlCD+4c8wxoNvsTGHJthMQuImK+yVU 7jWg== X-Gm-Message-State: APjAAAXvZmDvhma3uQGVPAz3oqC85tY2cr4cO1q2Kw3kjeKHqhMTPCAZ NuRSCZeSjuJs1qXzgEPJECuLhQ== X-Google-Smtp-Source: APXvYqyXEYvb7SidPTl9ZkIEbB95JrZ/Om8vyqPgviygqOMJFzLif3b79yVEyELJvWwixY4snTiaiQ== X-Received: by 2002:a17:902:b093:: with SMTP id p19mr768988plr.141.1561592035605; Wed, 26 Jun 2019 16:33:55 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id g2sm357028pfb.95.2019.06.26.16.33.54 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 26 Jun 2019 16:33:54 -0700 (PDT) From: Stephen Hemminger To: gaetan.rivet@6wind.com Cc: dev@dpdk.org, Stephen Hemminger , Stephen Hemminger Date: Wed, 26 Jun 2019 16:33:45 -0700 Message-Id: <20190626233346.4719-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190626233346.4719-1-stephen@networkplumber.org> References: <20190626222135.11368-1-stephen@networkplumber.org> <20190626233346.4719-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 1/2] ethdev: expose basic xstats for driver use 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" Avoid duplication by having generic basic xstats available for use by drivers. A later patch uses this for failsafe driver. Signed-off-by: Stephen Hemminger --- lib/librte_ethdev/rte_ethdev.c | 17 ++++++++--------- lib/librte_ethdev/rte_ethdev_core.h | 14 ++++++++++++++ lib/librte_ethdev/rte_ethdev_version.map | 3 +++ 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 8ac301608b9c..a83e9727c144 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -1996,8 +1996,8 @@ rte_eth_stats_reset(uint16_t port_id) return 0; } -static inline int -get_xstats_basic_count(struct rte_eth_dev *dev) +int +rte_eth_basic_stats_count(struct rte_eth_dev *dev) { uint16_t nb_rxqs, nb_txqs; int count; @@ -2034,7 +2034,7 @@ get_xstats_count(uint16_t port_id) count = 0; - count += get_xstats_basic_count(dev); + count += rte_eth_basic_stats_count(dev); return count; } @@ -2084,7 +2084,7 @@ rte_eth_xstats_get_id_by_name(uint16_t port_id, const char *xstat_name, } /* retrieve basic stats names */ -static int +int rte_eth_basic_stats_get_names(struct rte_eth_dev *dev, struct rte_eth_xstat_name *xstats_names) { @@ -2140,7 +2140,7 @@ rte_eth_xstats_get_names_by_id(uint16_t port_id, RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); dev = &rte_eth_devices[port_id]; - basic_count = get_xstats_basic_count(dev); + basic_count = rte_eth_basic_stats_count(dev); ret = get_xstats_count(port_id); if (ret < 0) return ret; @@ -2268,8 +2268,7 @@ rte_eth_xstats_get_names(uint16_t port_id, return cnt_used_entries; } - -static int +int rte_eth_basic_stats_get(uint16_t port_id, struct rte_eth_xstat *xstats) { struct rte_eth_dev *dev; @@ -2341,7 +2340,7 @@ rte_eth_xstats_get_by_id(uint16_t port_id, const uint64_t *ids, expected_entries = (uint16_t)ret; struct rte_eth_xstat xstats[expected_entries]; dev = &rte_eth_devices[port_id]; - basic_count = get_xstats_basic_count(dev); + basic_count = rte_eth_basic_stats_count(dev); /* Return max number of stats if no ids given */ if (!ids) { @@ -2355,7 +2354,7 @@ rte_eth_xstats_get_by_id(uint16_t port_id, const uint64_t *ids, return -EINVAL; if (ids && dev->dev_ops->xstats_get_by_id != NULL && size) { - unsigned int basic_count = get_xstats_basic_count(dev); + unsigned int basic_count = rte_eth_basic_stats_count(dev); uint64_t ids_copy[size]; for (i = 0; i < size; i++) { diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h index 2922d5b7cc95..91ce1880d1c6 100644 --- a/lib/librte_ethdev/rte_ethdev_core.h +++ b/lib/librte_ethdev/rte_ethdev_core.h @@ -517,6 +517,20 @@ struct eth_dev_ops { /**< Test if a port supports specific mempool ops */ }; +/** + * @internal + * Get basic stats for ethdev + */ +int __rte_experimental +rte_eth_basic_stats_count(struct rte_eth_dev *dev); + +int __rte_experimental +rte_eth_basic_stats_get_names(struct rte_eth_dev *dev, + struct rte_eth_xstat_name *xstats_names); + +int __rte_experimental +rte_eth_basic_stats_get(uint16_t port_id, struct rte_eth_xstat *xstats); + /** * @internal * Structure used to hold information about the callbacks to be called for a diff --git a/lib/librte_ethdev/rte_ethdev_version.map b/lib/librte_ethdev/rte_ethdev_version.map index df9141825c3f..949a79800cbc 100644 --- a/lib/librte_ethdev/rte_ethdev_version.map +++ b/lib/librte_ethdev/rte_ethdev_version.map @@ -239,6 +239,9 @@ DPDK_19.05 { EXPERIMENTAL { global: + rte_eth_basic_stats_count; + rte_eth_basic_stats_get; + rte_eth_basic_stats_get_names; rte_eth_devargs_parse; rte_eth_dev_create; rte_eth_dev_destroy; -- 2.20.1