From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
To: Igor Russkikh <irusskikh@marvell.com>,
Somalapuram Amaranath <asomalap@amd.com>,
Rasesh Mody <rmody@marvell.com>,
Shahed Shaikh <shshaikh@marvell.com>,
Ajit Khaparde <ajit.khaparde@broadcom.com>,
Somnath Kotur <somnath.kotur@broadcom.com>,
Nithin Dabilpuram <ndabilpuram@marvell.com>,
Kiran Kumar K <kirankumark@marvell.com>,
Sunil Kumar Kori <skori@marvell.com>,
Satha Rao <skoteshwar@marvell.com>,
Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>,
Hemant Agrawal <hemant.agrawal@nxp.com>,
Sachin Saxena <sachin.saxena@oss.nxp.com>,
Haiyue Wang <haiyue.wang@intel.com>,
Marcin Wojtas <mw@semihalf.com>,
Michal Krawczyk <mk@semihalf.com>,
Shai Brandes <shaibran@amazon.com>,
Evgeny Schemeilin <evgenys@amazon.com>,
Igor Chauskin <igorch@amazon.com>, Gaetan Rivet <grive@u256.net>,
Qi Zhang <qi.z.zhang@intel.com>,
Xiao Wang <xiao.w.wang@intel.com>,
Ziyang Xuan <xuanziyang2@huawei.com>,
Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>,
Guoyang Zhou <zhouguoyang@huawei.com>,
"Min Hu (Connor)" <humin29@huawei.com>,
Yisen Zhuang <yisen.zhuang@huawei.com>,
Lijun Ou <oulijun@huawei.com>,
Beilei Xing <beilei.xing@intel.com>,
Jingjing Wu <jingjing.wu@intel.com>,
Qiming Yang <qiming.yang@intel.com>,
Andrew Boyer <aboyer@pensando.io>, Rosen Xu <rosen.xu@intel.com>,
Shijith Thotton <sthotton@marvell.com>,
Srisivasubramanian Srinivasan <srinivasan@marvell.com>,
Matan Azrad <matan@nvidia.com>,
Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
Liron Himi <lironh@marvell.com>,
Stephen Hemminger <sthemmin@microsoft.com>,
Long Li <longli@microsoft.com>, Jerin Jacob <jerinj@marvell.com>,
Devendra Singh Rawat <dsinghrawat@marvell.com>,
Jiawen Wu <jiawenwu@trustnetic.com>,
Jian Wang <jianwang@trustnetic.com>,
Maxime Coquelin <maxime.coquelin@redhat.com>,
Chenbo Xia <chenbo.xia@intel.com>,
Yong Wang <yongwang@vmware.com>,
Thomas Monjalon <thomas@monjalon.net>,
Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v9 5/5] ethdev: merge driver ops to get all xstats names and by ID
Date: Fri, 1 Oct 2021 12:07:23 +0300 [thread overview]
Message-ID: <20211001090723.1414911-5-andrew.rybchenko@oktetlabs.ru> (raw)
In-Reply-To: <20211001090723.1414911-1-andrew.rybchenko@oktetlabs.ru>
All xstats names may be retrieved passing NULL ids.
If a driver does not support getting names by IDs, the callback should
return -ENOTSUP on attempt to use it. If so, the request is handled
on ethdev layer by getting all names and filtering out requested only.
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
v9:
- document -ENOTSUP in callback
- simplify documentation about supported cases
v8:
- handle -ENOTSUP on ethdev to fallback to by-IDs handling in ethdev
doc/guides/nics/features.rst | 2 +-
drivers/net/atlantic/atl_ethdev.c | 5 ++
drivers/net/axgbe/axgbe_ethdev.c | 30 ++++-----
drivers/net/bnx2x/bnx2x_ethdev.c | 4 ++
drivers/net/bnxt/bnxt_stats.c | 4 ++
drivers/net/bnxt/bnxt_stats.h | 1 +
drivers/net/cnxk/cnxk_ethdev.c | 1 -
drivers/net/cnxk/cnxk_ethdev.h | 5 +-
drivers/net/cnxk/cnxk_stats.c | 18 +++---
drivers/net/cxgbe/cxgbe_ethdev.c | 17 ++---
drivers/net/dpaa/dpaa_ethdev.c | 13 ++--
drivers/net/dpaa2/dpaa2_ethdev.c | 13 ++--
drivers/net/e1000/igb_ethdev.c | 36 +++--------
drivers/net/ena/ena_ethdev.c | 6 +-
drivers/net/failsafe/failsafe_ops.c | 5 +-
drivers/net/fm10k/fm10k_ethdev.c | 4 ++
drivers/net/hinic/hinic_pmd_ethdev.c | 4 ++
drivers/net/hns3/hns3_ethdev.c | 1 -
drivers/net/hns3/hns3_ethdev_vf.c | 1 -
drivers/net/hns3/hns3_stats.c | 22 +++----
drivers/net/hns3/hns3_stats.h | 10 +--
drivers/net/i40e/i40e_ethdev.c | 5 ++
drivers/net/iavf/iavf_ethdev.c | 13 ++--
drivers/net/ice/ice_ethdev.c | 5 ++
drivers/net/igc/igc_ethdev.c | 10 +--
drivers/net/ionic/ionic_ethdev.c | 25 +-------
drivers/net/ipn3ke/ipn3ke_representor.c | 5 +-
drivers/net/ixgbe/ixgbe_ethdev.c | 71 +++------------------
drivers/net/liquidio/lio_ethdev.c | 4 ++
drivers/net/mlx5/mlx5.h | 1 +
drivers/net/mlx5/mlx5_stats.c | 7 ++-
drivers/net/mvpp2/mrvl_ethdev.c | 4 ++
drivers/net/netvsc/hn_ethdev.c | 5 +-
drivers/net/octeontx2/otx2_ethdev.c | 1 -
drivers/net/octeontx2/otx2_ethdev.h | 5 +-
drivers/net/octeontx2/otx2_stats.c | 14 ++---
drivers/net/qede/qede_ethdev.c | 4 ++
drivers/net/sfc/sfc_ethdev.c | 84 ++++++++++++-------------
drivers/net/txgbe/txgbe_ethdev.c | 7 +--
drivers/net/txgbe/txgbe_ethdev_vf.c | 4 ++
drivers/net/vhost/rte_eth_vhost.c | 4 ++
drivers/net/virtio/virtio_ethdev.c | 5 ++
drivers/net/vmxnet3/vmxnet3_ethdev.c | 5 ++
lib/ethdev/ethdev_driver.h | 21 ++++---
lib/ethdev/rte_ethdev.c | 17 +++--
45 files changed, 245 insertions(+), 283 deletions(-)
diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst
index 4fce8cd1c9..8fef2939fb 100644
--- a/doc/guides/nics/features.rst
+++ b/doc/guides/nics/features.rst
@@ -708,7 +708,7 @@ Extended stats
Supports Extended Statistics, changes from driver to driver.
* **[implements] eth_dev_ops**: ``xstats_get``, ``xstats_reset``, ``xstats_get_names``.
-* **[implements] eth_dev_ops**: ``xstats_get_by_id``, ``xstats_get_names_by_id``.
+* **[implements] eth_dev_ops**: ``xstats_get_by_id``.
* **[related] API**: ``rte_eth_xstats_get()``, ``rte_eth_xstats_reset()``,
``rte_eth_xstats_get_names``, ``rte_eth_xstats_get_by_id()``,
``rte_eth_xstats_get_names_by_id()``, ``rte_eth_xstats_get_id_by_name()``.
diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c
index 0ce35eb519..f55d18ae9a 100644
--- a/drivers/net/atlantic/atl_ethdev.c
+++ b/drivers/net/atlantic/atl_ethdev.c
@@ -29,6 +29,7 @@ static int atl_dev_allmulticast_disable(struct rte_eth_dev *dev);
static int atl_dev_link_update(struct rte_eth_dev *dev, int wait);
static int atl_dev_xstats_get_names(struct rte_eth_dev *dev __rte_unused,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
unsigned int size);
@@ -1003,12 +1004,16 @@ atl_dev_xstats_get_count(struct rte_eth_dev *dev)
static int
atl_dev_xstats_get_names(struct rte_eth_dev *dev __rte_unused,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
unsigned int size)
{
unsigned int i;
unsigned int count = atl_dev_xstats_get_count(dev);
+ if (ids != NULL)
+ return -ENOTSUP;
+
if (xstats_names) {
for (i = 0; i < size && i < count; i++) {
snprintf(xstats_names[i].name,
diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
index ebd5411fdd..6a55a211df 100644
--- a/drivers/net/axgbe/axgbe_ethdev.c
+++ b/drivers/net/axgbe/axgbe_ethdev.c
@@ -47,19 +47,14 @@ static int axgbe_dev_xstats_get(struct rte_eth_dev *dev,
struct rte_eth_xstat *stats,
unsigned int n);
static int
-axgbe_dev_xstats_get_names(struct rte_eth_dev *dev,
- struct rte_eth_xstat_name *xstats_names,
- unsigned int size);
-static int
axgbe_dev_xstats_get_by_id(struct rte_eth_dev *dev,
const uint64_t *ids,
uint64_t *values,
unsigned int n);
static int
-axgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
- const uint64_t *ids,
- struct rte_eth_xstat_name *xstats_names,
- unsigned int size);
+axgbe_dev_xstats_get_names(struct rte_eth_dev *dev, const uint64_t *ids,
+ struct rte_eth_xstat_name *xstats_names,
+ unsigned int size);
static int axgbe_dev_xstats_reset(struct rte_eth_dev *dev);
static int axgbe_dev_rss_reta_update(struct rte_eth_dev *dev,
struct rte_eth_rss_reta_entry64 *reta_conf,
@@ -239,7 +234,6 @@ static const struct eth_dev_ops axgbe_eth_dev_ops = {
.xstats_get = axgbe_dev_xstats_get,
.xstats_reset = axgbe_dev_xstats_reset,
.xstats_get_names = axgbe_dev_xstats_get_names,
- .xstats_get_names_by_id = axgbe_dev_xstats_get_names_by_id,
.xstats_get_by_id = axgbe_dev_xstats_get_by_id,
.reta_update = axgbe_dev_rss_reta_update,
.reta_query = axgbe_dev_rss_reta_query,
@@ -1022,9 +1016,9 @@ axgbe_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *stats,
}
static int
-axgbe_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
- struct rte_eth_xstat_name *xstats_names,
- unsigned int n)
+axgbe_dev_xstats_get_all_names(__rte_unused struct rte_eth_dev *dev,
+ struct rte_eth_xstat_name *xstats_names,
+ unsigned int n)
{
unsigned int i;
@@ -1075,18 +1069,18 @@ axgbe_dev_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
}
static int
-axgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
- const uint64_t *ids,
- struct rte_eth_xstat_name *xstats_names,
- unsigned int size)
+axgbe_dev_xstats_get_names(struct rte_eth_dev *dev,
+ const uint64_t *ids,
+ struct rte_eth_xstat_name *xstats_names,
+ unsigned int size)
{
struct rte_eth_xstat_name xstats_names_copy[AXGBE_XSTATS_COUNT];
unsigned int i;
if (!ids)
- return axgbe_dev_xstats_get_names(dev, xstats_names, size);
+ return axgbe_dev_xstats_get_all_names(dev, xstats_names, size);
- axgbe_dev_xstats_get_names(dev, xstats_names_copy, size);
+ axgbe_dev_xstats_get_all_names(dev, xstats_names_copy, size);
for (i = 0; i < size; i++) {
if (ids[i] >= AXGBE_XSTATS_COUNT) {
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index 463886f17a..b18d14d735 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -484,11 +484,15 @@ bnx2x_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
static int
bnx2x_get_xstats_names(__rte_unused struct rte_eth_dev *dev,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
__rte_unused unsigned limit)
{
unsigned int i, stat_cnt = RTE_DIM(bnx2x_xstats_strings);
+ if (ids != NULL)
+ return -ENOTSUP;
+
if (xstats_names != NULL)
for (i = 0; i < stat_cnt; i++)
strlcpy(xstats_names[i].name,
diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index 991eafc644..aca350402b 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -845,6 +845,7 @@ int bnxt_flow_stats_cnt(struct bnxt *bp)
}
int bnxt_dev_xstats_get_names_op(struct rte_eth_dev *eth_dev,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
__rte_unused unsigned int limit)
{
@@ -862,6 +863,9 @@ int bnxt_dev_xstats_get_names_op(struct rte_eth_dev *eth_dev,
if (rc)
return rc;
+ if (ids != NULL)
+ return -ENOTSUP;
+
if (xstats_names != NULL) {
count = 0;
diff --git a/drivers/net/bnxt/bnxt_stats.h b/drivers/net/bnxt/bnxt_stats.h
index 1ca9b9c594..497380ae2d 100644
--- a/drivers/net/bnxt/bnxt_stats.h
+++ b/drivers/net/bnxt/bnxt_stats.h
@@ -13,6 +13,7 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
struct rte_eth_stats *bnxt_stats);
int bnxt_stats_reset_op(struct rte_eth_dev *eth_dev);
int bnxt_dev_xstats_get_names_op(struct rte_eth_dev *eth_dev,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
__rte_unused unsigned int limit);
int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c
index 8629193d50..c208611e88 100644
--- a/drivers/net/cnxk/cnxk_ethdev.c
+++ b/drivers/net/cnxk/cnxk_ethdev.c
@@ -1258,7 +1258,6 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
.xstats_get_names = cnxk_nix_xstats_get_names,
.xstats_reset = cnxk_nix_xstats_reset,
.xstats_get_by_id = cnxk_nix_xstats_get_by_id,
- .xstats_get_names_by_id = cnxk_nix_xstats_get_names_by_id,
.fw_version_get = cnxk_nix_fw_version_get,
.rxq_info_get = cnxk_nix_rxq_info_get,
.txq_info_get = cnxk_nix_txq_info_get,
diff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h
index 946629f72e..1165482baf 100644
--- a/drivers/net/cnxk/cnxk_ethdev.h
+++ b/drivers/net/cnxk/cnxk_ethdev.h
@@ -362,12 +362,9 @@ int cnxk_nix_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats);
int cnxk_nix_xstats_get(struct rte_eth_dev *eth_dev,
struct rte_eth_xstat *xstats, unsigned int n);
int cnxk_nix_xstats_get_names(struct rte_eth_dev *eth_dev,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
unsigned int limit);
-int cnxk_nix_xstats_get_names_by_id(struct rte_eth_dev *eth_dev,
- const uint64_t *ids,
- struct rte_eth_xstat_name *xstats_names,
- unsigned int limit);
int cnxk_nix_xstats_get_by_id(struct rte_eth_dev *eth_dev, const uint64_t *ids,
uint64_t *values, unsigned int n);
int cnxk_nix_xstats_reset(struct rte_eth_dev *eth_dev);
diff --git a/drivers/net/cnxk/cnxk_stats.c b/drivers/net/cnxk/cnxk_stats.c
index 4b0deac05e..ae3eef3628 100644
--- a/drivers/net/cnxk/cnxk_stats.c
+++ b/drivers/net/cnxk/cnxk_stats.c
@@ -162,10 +162,10 @@ cnxk_nix_xstats_get(struct rte_eth_dev *eth_dev, struct rte_eth_xstat *xstats,
return size;
}
-int
-cnxk_nix_xstats_get_names(struct rte_eth_dev *eth_dev,
- struct rte_eth_xstat_name *xstats_names,
- unsigned int limit)
+static int
+cnxk_nix_xstats_get_all_names(struct rte_eth_dev *eth_dev,
+ struct rte_eth_xstat_name *xstats_names,
+ unsigned int limit)
{
struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
struct roc_nix_xstat_name roc_xstats_name[limit];
@@ -226,10 +226,10 @@ cnxk_nix_xstats_get_names(struct rte_eth_dev *eth_dev,
}
int
-cnxk_nix_xstats_get_names_by_id(struct rte_eth_dev *eth_dev,
- const uint64_t *ids,
- struct rte_eth_xstat_name *xstats_names,
- unsigned int limit)
+cnxk_nix_xstats_get_names(struct rte_eth_dev *eth_dev,
+ const uint64_t *ids,
+ struct rte_eth_xstat_name *xstats_names,
+ unsigned int limit)
{
struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
uint32_t nix_cnt = roc_nix_num_xstats_get(&dev->nix);
@@ -247,7 +247,7 @@ cnxk_nix_xstats_get_names_by_id(struct rte_eth_dev *eth_dev,
if (xstats_names == NULL)
return -ENOMEM;
- cnxk_nix_xstats_get_names(eth_dev, xnames, stat_cnt);
+ cnxk_nix_xstats_get_all_names(eth_dev, xnames, stat_cnt);
for (i = 0; i < limit; i++) {
if (ids[i] >= stat_cnt)
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 4929766d9a..371550069e 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -1005,10 +1005,10 @@ static int cxgbe_dev_xstats_get_by_id(struct rte_eth_dev *dev,
}
/* Get names of port extended statistics by ID. */
-static int cxgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
- const uint64_t *ids,
- struct rte_eth_xstat_name *xnames,
- unsigned int n)
+static int cxgbe_dev_xstats_get_names(struct rte_eth_dev *dev,
+ const uint64_t *ids,
+ struct rte_eth_xstat_name *xnames,
+ unsigned int n)
{
struct port_info *pi = dev->data->dev_private;
struct rte_eth_xstat_name *xnames_copy;
@@ -1048,14 +1048,6 @@ static int cxgbe_dev_xstats_get(struct rte_eth_dev *dev,
return cxgbe_dev_xstats(dev, NULL, xstats, n);
}
-/* Get names of port extended statistics. */
-static int cxgbe_dev_xstats_get_names(struct rte_eth_dev *dev,
- struct rte_eth_xstat_name *xstats_names,
- unsigned int n)
-{
- return cxgbe_dev_xstats(dev, xstats_names, NULL, n);
-}
-
/* Reset port extended statistics. */
static int cxgbe_dev_xstats_reset(struct rte_eth_dev *dev)
{
@@ -1620,7 +1612,6 @@ static const struct eth_dev_ops cxgbe_eth_dev_ops = {
.xstats_get = cxgbe_dev_xstats_get,
.xstats_get_by_id = cxgbe_dev_xstats_get_by_id,
.xstats_get_names = cxgbe_dev_xstats_get_names,
- .xstats_get_names_by_id = cxgbe_dev_xstats_get_names_by_id,
.xstats_reset = cxgbe_dev_xstats_reset,
.flow_ctrl_get = cxgbe_flow_ctrl_get,
.flow_ctrl_set = cxgbe_flow_ctrl_set,
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 1f80e8d744..06e293b17f 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -758,9 +758,9 @@ dpaa_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
}
static int
-dpaa_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
- struct rte_eth_xstat_name *xstats_names,
- unsigned int limit)
+dpaa_xstats_get_all_names(__rte_unused struct rte_eth_dev *dev,
+ struct rte_eth_xstat_name *xstats_names,
+ unsigned int limit)
{
unsigned int i, stat_cnt = RTE_DIM(dpaa_xstats_strings);
@@ -813,7 +813,7 @@ dpaa_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
}
static int
-dpaa_xstats_get_names_by_id(
+dpaa_xstats_get_names(
struct rte_eth_dev *dev,
const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
@@ -823,9 +823,9 @@ dpaa_xstats_get_names_by_id(
struct rte_eth_xstat_name xstats_names_copy[stat_cnt];
if (!ids)
- return dpaa_xstats_get_names(dev, xstats_names, limit);
+ return dpaa_xstats_get_all_names(dev, xstats_names, limit);
- dpaa_xstats_get_names(dev, xstats_names_copy, limit);
+ dpaa_xstats_get_all_names(dev, xstats_names_copy, limit);
for (i = 0; i < limit; i++) {
if (ids[i] >= stat_cnt) {
@@ -1585,7 +1585,6 @@ static struct eth_dev_ops dpaa_devops = {
.stats_get = dpaa_eth_stats_get,
.xstats_get = dpaa_dev_xstats_get,
.xstats_get_by_id = dpaa_xstats_get_by_id,
- .xstats_get_names_by_id = dpaa_xstats_get_names_by_id,
.xstats_get_names = dpaa_xstats_get_names,
.xstats_reset = dpaa_eth_stats_reset,
.stats_reset = dpaa_eth_stats_reset,
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index ea191564fc..9aaeb0bc17 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1711,9 +1711,9 @@ dpaa2_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
}
static int
-dpaa2_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
- struct rte_eth_xstat_name *xstats_names,
- unsigned int limit)
+dpaa2_xstats_get_all_names(__rte_unused struct rte_eth_dev *dev,
+ struct rte_eth_xstat_name *xstats_names,
+ unsigned int limit)
{
unsigned int i, stat_cnt = RTE_DIM(dpaa2_xstats_strings);
@@ -1793,7 +1793,7 @@ dpaa2_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
}
static int
-dpaa2_xstats_get_names_by_id(
+dpaa2_xstats_get_names(
struct rte_eth_dev *dev,
const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
@@ -1803,9 +1803,9 @@ dpaa2_xstats_get_names_by_id(
struct rte_eth_xstat_name xstats_names_copy[stat_cnt];
if (!ids)
- return dpaa2_xstats_get_names(dev, xstats_names, limit);
+ return dpaa2_xstats_get_all_names(dev, xstats_names, limit);
- dpaa2_xstats_get_names(dev, xstats_names_copy, limit);
+ dpaa2_xstats_get_all_names(dev, xstats_names_copy, limit);
for (i = 0; i < limit; i++) {
if (ids[i] >= stat_cnt) {
@@ -2413,7 +2413,6 @@ static struct eth_dev_ops dpaa2_ethdev_ops = {
.stats_get = dpaa2_dev_stats_get,
.xstats_get = dpaa2_dev_xstats_get,
.xstats_get_by_id = dpaa2_xstats_get_by_id,
- .xstats_get_names_by_id = dpaa2_xstats_get_names_by_id,
.xstats_get_names = dpaa2_xstats_get_names,
.stats_reset = dpaa2_dev_stats_reset,
.xstats_reset = dpaa2_dev_stats_reset,
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 6510cd7ceb..8bf254a802 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -93,9 +93,6 @@ static int eth_igb_xstats_get_by_id(struct rte_eth_dev *dev,
const uint64_t *ids,
uint64_t *values, unsigned int n);
static int eth_igb_xstats_get_names(struct rte_eth_dev *dev,
- struct rte_eth_xstat_name *xstats_names,
- unsigned int size);
-static int eth_igb_xstats_get_names_by_id(struct rte_eth_dev *dev,
const uint64_t *ids, struct rte_eth_xstat_name *xstats_names,
unsigned int limit);
static int eth_igb_stats_reset(struct rte_eth_dev *dev);
@@ -166,6 +163,7 @@ static int eth_igbvf_stats_get(struct rte_eth_dev *dev,
static int eth_igbvf_xstats_get(struct rte_eth_dev *dev,
struct rte_eth_xstat *xstats, unsigned n);
static int eth_igbvf_xstats_get_names(struct rte_eth_dev *dev,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
unsigned limit);
static int eth_igbvf_stats_reset(struct rte_eth_dev *dev);
@@ -343,7 +341,6 @@ static const struct eth_dev_ops eth_igb_ops = {
.stats_get = eth_igb_stats_get,
.xstats_get = eth_igb_xstats_get,
.xstats_get_by_id = eth_igb_xstats_get_by_id,
- .xstats_get_names_by_id = eth_igb_xstats_get_names_by_id,
.xstats_get_names = eth_igb_xstats_get_names,
.stats_reset = eth_igb_stats_reset,
.xstats_reset = eth_igb_xstats_reset,
@@ -1863,26 +1860,7 @@ eth_igb_xstats_reset(struct rte_eth_dev *dev)
return 0;
}
-static int eth_igb_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
- struct rte_eth_xstat_name *xstats_names,
- __rte_unused unsigned int size)
-{
- unsigned i;
-
- if (xstats_names == NULL)
- return IGB_NB_XSTATS;
-
- /* Note: limit checked in rte_eth_xstats_names() */
-
- for (i = 0; i < IGB_NB_XSTATS; i++) {
- strlcpy(xstats_names[i].name, rte_igb_stats_strings[i].name,
- sizeof(xstats_names[i].name));
- }
-
- return IGB_NB_XSTATS;
-}
-
-static int eth_igb_xstats_get_names_by_id(struct rte_eth_dev *dev,
+static int eth_igb_xstats_get_names(struct rte_eth_dev *dev,
const uint64_t *ids, struct rte_eth_xstat_name *xstats_names,
unsigned int limit)
{
@@ -1902,7 +1880,7 @@ static int eth_igb_xstats_get_names_by_id(struct rte_eth_dev *dev,
} else {
struct rte_eth_xstat_name xstats_names_copy[IGB_NB_XSTATS];
- eth_igb_xstats_get_names_by_id(dev, NULL, xstats_names_copy,
+ eth_igb_xstats_get_names(dev, NULL, xstats_names_copy,
IGB_NB_XSTATS);
for (i = 0; i < limit; i++) {
@@ -2035,11 +2013,15 @@ igbvf_read_stats_registers(struct e1000_hw *hw, struct e1000_vf_stats *hw_stats)
}
static int eth_igbvf_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
- struct rte_eth_xstat_name *xstats_names,
- __rte_unused unsigned limit)
+ const uint64_t *ids,
+ struct rte_eth_xstat_name *xstats_names,
+ __rte_unused unsigned limit)
{
unsigned i;
+ if (ids != NULL)
+ return -ENOTSUP;
+
if (xstats_names != NULL)
for (i = 0; i < IGBVF_NB_XSTATS; i++) {
strlcpy(xstats_names[i].name,
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 4cebf60a68..a807e50dba 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -212,7 +212,7 @@ static void ena_interrupt_handler_rte(void *cb_arg);
static void ena_timer_wd_callback(struct rte_timer *timer, void *arg);
static void ena_destroy_device(struct rte_eth_dev *eth_dev);
static int eth_ena_dev_init(struct rte_eth_dev *eth_dev);
-static int ena_xstats_get_names(struct rte_eth_dev *dev,
+static int ena_xstats_get_names(struct rte_eth_dev *dev, const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
unsigned int n);
static int ena_xstats_get(struct rte_eth_dev *dev,
@@ -2585,12 +2585,16 @@ int ena_copy_eni_stats(struct ena_adapter *adapter)
* Number of xstats names.
*/
static int ena_xstats_get_names(struct rte_eth_dev *dev,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
unsigned int n)
{
unsigned int xstats_count = ena_xstats_calc_num(dev->data);
unsigned int stat, i, count = 0;
+ if (ids != NULL)
+ return -ENOTSUP;
+
if (n < xstats_count || !xstats_names)
return xstats_count;
diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c
index 5ff33e03e0..dae85b7677 100644
--- a/drivers/net/failsafe/failsafe_ops.c
+++ b/drivers/net/failsafe/failsafe_ops.c
@@ -990,12 +990,15 @@ __fs_xstats_get_names(struct rte_eth_dev *dev,
}
static int
-fs_xstats_get_names(struct rte_eth_dev *dev,
+fs_xstats_get_names(struct rte_eth_dev *dev, const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
unsigned int limit)
{
int ret;
+ if (ids != NULL)
+ return -ENOTSUP;
+
fs_lock(dev, 0);
ret = __fs_xstats_get_names(dev, xstats_names, limit);
fs_unlock(dev, 0);
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 3236290e40..16af1751f9 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -1232,11 +1232,15 @@ fm10k_link_update(struct rte_eth_dev *dev,
}
static int fm10k_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names, __rte_unused unsigned limit)
{
unsigned i, q;
unsigned count = 0;
+ if (ids != NULL)
+ return -ENOTSUP;
+
if (xstats_names != NULL) {
/* Note: limit checked in rte_eth_xstats_names() */
diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index c01e2ec1d4..bc6f07d070 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -2280,6 +2280,7 @@ static void hinic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
* Number of xstats names.
*/
static int hinic_dev_xstats_get_names(struct rte_eth_dev *dev,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
__rte_unused unsigned int limit)
{
@@ -2287,6 +2288,9 @@ static int hinic_dev_xstats_get_names(struct rte_eth_dev *dev,
int count = 0;
u16 i = 0, q_num;
+ if (ids != NULL)
+ return -ENOTSUP;
+
if (xstats_names == NULL)
return hinic_xstats_calc_num(nic_dev);
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 7d37004972..87ae92080f 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -7413,7 +7413,6 @@ static const struct eth_dev_ops hns3_eth_dev_ops = {
.xstats_get_names = hns3_dev_xstats_get_names,
.xstats_reset = hns3_dev_xstats_reset,
.xstats_get_by_id = hns3_dev_xstats_get_by_id,
- .xstats_get_names_by_id = hns3_dev_xstats_get_names_by_id,
.dev_infos_get = hns3_dev_infos_get,
.fw_version_get = hns3_fw_version_get,
.rx_queue_setup = hns3_rx_queue_setup,
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 8d9b7979c8..d65236e003 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -2905,7 +2905,6 @@ static const struct eth_dev_ops hns3vf_eth_dev_ops = {
.xstats_get_names = hns3_dev_xstats_get_names,
.xstats_reset = hns3_dev_xstats_reset,
.xstats_get_by_id = hns3_dev_xstats_get_by_id,
- .xstats_get_names_by_id = hns3_dev_xstats_get_names_by_id,
.dev_infos_get = hns3vf_dev_infos_get,
.fw_version_get = hns3vf_fw_version_get,
.rx_queue_setup = hns3_rx_queue_setup,
diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c
index 0fe853d626..abb2d42144 100644
--- a/drivers/net/hns3/hns3_stats.c
+++ b/drivers/net/hns3/hns3_stats.c
@@ -1189,7 +1189,7 @@ hns3_imissed_stats_name_get(struct rte_eth_dev *dev,
}
/*
- * Retrieve names of extended statistics of an Ethernet device.
+ * Retrieve all names of extended statistics of an Ethernet device.
*
* There is an assumption that 'xstat_names' and 'xstats' arrays are matched
* by array index:
@@ -1212,10 +1212,10 @@ hns3_imissed_stats_name_get(struct rte_eth_dev *dev,
* - A positive value lower or equal to size: success. The return value
* is the number of entries filled in the stats table.
*/
-int
-hns3_dev_xstats_get_names(struct rte_eth_dev *dev,
- struct rte_eth_xstat_name *xstats_names,
- __rte_unused unsigned int size)
+static int
+hns3_dev_xstats_get_all_names(struct rte_eth_dev *dev,
+ struct rte_eth_xstat_name *xstats_names,
+ __rte_unused unsigned int size)
{
struct hns3_adapter *hns = dev->data->dev_private;
int cnt_stats = hns3_xstats_calc_num(dev);
@@ -1382,10 +1382,9 @@ hns3_dev_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
* shall not be used by the caller.
*/
int
-hns3_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
- const uint64_t *ids,
- struct rte_eth_xstat_name *xstats_names,
- uint32_t size)
+hns3_dev_xstats_get_names(struct rte_eth_dev *dev, const uint64_t *ids,
+ struct rte_eth_xstat_name *xstats_names,
+ uint32_t size)
{
const uint32_t cnt_stats = hns3_xstats_calc_num(dev);
struct hns3_adapter *hns = dev->data->dev_private;
@@ -1401,7 +1400,8 @@ hns3_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
if (size < cnt_stats)
return cnt_stats;
- return hns3_dev_xstats_get_names(dev, xstats_names, cnt_stats);
+ return hns3_dev_xstats_get_all_names(dev, xstats_names,
+ cnt_stats);
}
len = cnt_stats * sizeof(struct rte_eth_xstat_name);
@@ -1412,7 +1412,7 @@ hns3_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
return -ENOMEM;
}
- (void)hns3_dev_xstats_get_names(dev, names_copy, cnt_stats);
+ (void)hns3_dev_xstats_get_all_names(dev, names_copy, cnt_stats);
for (i = 0; i < size; i++) {
if (ids[i] >= cnt_stats) {
diff --git a/drivers/net/hns3/hns3_stats.h b/drivers/net/hns3/hns3_stats.h
index d1230f94cb..53fd1572f0 100644
--- a/drivers/net/hns3/hns3_stats.h
+++ b/drivers/net/hns3/hns3_stats.h
@@ -153,17 +153,13 @@ int hns3_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats);
int hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
unsigned int n);
int hns3_dev_xstats_reset(struct rte_eth_dev *dev);
-int hns3_dev_xstats_get_names(struct rte_eth_dev *dev,
- struct rte_eth_xstat_name *xstats_names,
- __rte_unused unsigned int size);
int hns3_dev_xstats_get_by_id(struct rte_eth_dev *dev,
const uint64_t *ids,
uint64_t *values,
uint32_t size);
-int hns3_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
- const uint64_t *ids,
- struct rte_eth_xstat_name *xstats_names,
- uint32_t size);
+int hns3_dev_xstats_get_names(struct rte_eth_dev *dev, const uint64_t *ids,
+ struct rte_eth_xstat_name *xstats_names,
+ unsigned int size);
int hns3_stats_reset(struct rte_eth_dev *dev);
int hns3_tqp_stats_init(struct hns3_hw *hw);
void hns3_tqp_stats_uninit(struct hns3_hw *hw);
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 7a2a8281d2..832c9bff01 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -258,6 +258,7 @@ static int i40e_dev_stats_get(struct rte_eth_dev *dev,
static int i40e_dev_xstats_get(struct rte_eth_dev *dev,
struct rte_eth_xstat *xstats, unsigned n);
static int i40e_dev_xstats_get_names(struct rte_eth_dev *dev,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
unsigned limit);
static int i40e_dev_stats_reset(struct rte_eth_dev *dev);
@@ -3567,12 +3568,16 @@ i40e_xstats_calc_num(void)
}
static int i40e_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
__rte_unused unsigned limit)
{
unsigned count = 0;
unsigned i, prio;
+ if (ids != NULL)
+ return -ENOTSUP;
+
if (xstats_names == NULL)
return i40e_xstats_calc_num();
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 5a5a7f59e1..a7be7abf1a 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -87,8 +87,9 @@ static int iavf_dev_stats_reset(struct rte_eth_dev *dev);
static int iavf_dev_xstats_get(struct rte_eth_dev *dev,
struct rte_eth_xstat *xstats, unsigned int n);
static int iavf_dev_xstats_get_names(struct rte_eth_dev *dev,
- struct rte_eth_xstat_name *xstats_names,
- unsigned int limit);
+ const uint64_t *ids,
+ struct rte_eth_xstat_name *xstats_names,
+ unsigned int limit);
static int iavf_dev_promiscuous_enable(struct rte_eth_dev *dev);
static int iavf_dev_promiscuous_disable(struct rte_eth_dev *dev);
static int iavf_dev_allmulticast_enable(struct rte_eth_dev *dev);
@@ -1611,11 +1612,15 @@ iavf_dev_stats_reset(struct rte_eth_dev *dev)
}
static int iavf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
- struct rte_eth_xstat_name *xstats_names,
- __rte_unused unsigned int limit)
+ const uint64_t *ids,
+ struct rte_eth_xstat_name *xstats_names,
+ __rte_unused unsigned int limit)
{
unsigned int i;
+ if (ids != NULL)
+ return -ENOTSUP;
+
if (xstats_names != NULL)
for (i = 0; i < IAVF_NB_XSTATS; i++) {
snprintf(xstats_names[i].name,
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index ea3b5c02aa..adeb5a00f3 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -145,6 +145,7 @@ static int ice_stats_reset(struct rte_eth_dev *dev);
static int ice_xstats_get(struct rte_eth_dev *dev,
struct rte_eth_xstat *xstats, unsigned int n);
static int ice_xstats_get_names(struct rte_eth_dev *dev,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
unsigned int limit);
static int ice_dev_flow_ops_get(struct rte_eth_dev *dev,
@@ -5420,12 +5421,16 @@ ice_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
}
static int ice_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
__rte_unused unsigned int limit)
{
unsigned int count = 0;
unsigned int i;
+ if (ids != NULL)
+ return -ENOTSUP;
+
if (!xstats_names)
return ice_xstats_calc_num();
diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c
index be2c066111..969e515a5f 100644
--- a/drivers/net/igc/igc_ethdev.c
+++ b/drivers/net/igc/igc_ethdev.c
@@ -213,9 +213,6 @@ static int eth_igc_xstats_get_by_id(struct rte_eth_dev *dev,
const uint64_t *ids,
uint64_t *values, unsigned int n);
static int eth_igc_xstats_get_names(struct rte_eth_dev *dev,
- struct rte_eth_xstat_name *xstats_names,
- unsigned int size);
-static int eth_igc_xstats_get_names_by_id(struct rte_eth_dev *dev,
const uint64_t *ids, struct rte_eth_xstat_name *xstats_names,
unsigned int limit);
static int eth_igc_xstats_reset(struct rte_eth_dev *dev);
@@ -280,7 +277,6 @@ static const struct eth_dev_ops eth_igc_ops = {
.stats_get = eth_igc_stats_get,
.xstats_get = eth_igc_xstats_get,
.xstats_get_by_id = eth_igc_xstats_get_by_id,
- .xstats_get_names_by_id = eth_igc_xstats_get_names_by_id,
.xstats_get_names = eth_igc_xstats_get_names,
.stats_reset = eth_igc_xstats_reset,
.xstats_reset = eth_igc_xstats_reset,
@@ -1991,7 +1987,7 @@ eth_igc_xstats_reset(struct rte_eth_dev *dev)
}
static int
-eth_igc_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
+eth_igc_xstats_get_all_names(__rte_unused struct rte_eth_dev *dev,
struct rte_eth_xstat_name *xstats_names, unsigned int size)
{
unsigned int i;
@@ -2012,14 +2008,14 @@ eth_igc_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
}
static int
-eth_igc_xstats_get_names_by_id(struct rte_eth_dev *dev,
+eth_igc_xstats_get_names(struct rte_eth_dev *dev,
const uint64_t *ids, struct rte_eth_xstat_name *xstats_names,
unsigned int limit)
{
unsigned int i;
if (!ids)
- return eth_igc_xstats_get_names(dev, xstats_names, limit);
+ return eth_igc_xstats_get_all_names(dev, xstats_names, limit);
for (i = 0; i < limit; i++) {
if (ids[i] >= IGC_NB_XSTATS) {
diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c
index 344c076f30..d813e9f909 100644
--- a/drivers/net/ionic/ionic_ethdev.c
+++ b/drivers/net/ionic/ionic_ethdev.c
@@ -50,8 +50,6 @@ static int ionic_dev_xstats_get_by_id(struct rte_eth_dev *dev,
const uint64_t *ids, uint64_t *values, unsigned int n);
static int ionic_dev_xstats_reset(struct rte_eth_dev *dev);
static int ionic_dev_xstats_get_names(struct rte_eth_dev *dev,
- struct rte_eth_xstat_name *xstats_names, unsigned int size);
-static int ionic_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
const uint64_t *ids, struct rte_eth_xstat_name *xstats_names,
unsigned int limit);
static int ionic_dev_fw_version_get(struct rte_eth_dev *eth_dev,
@@ -119,7 +117,6 @@ static const struct eth_dev_ops ionic_eth_dev_ops = {
.xstats_get_by_id = ionic_dev_xstats_get_by_id,
.xstats_reset = ionic_dev_xstats_reset,
.xstats_get_names = ionic_dev_xstats_get_names,
- .xstats_get_names_by_id = ionic_dev_xstats_get_names_by_id,
.fw_version_get = ionic_dev_fw_version_get,
};
@@ -714,25 +711,7 @@ ionic_dev_stats_reset(struct rte_eth_dev *eth_dev)
}
static int
-ionic_dev_xstats_get_names(__rte_unused struct rte_eth_dev *eth_dev,
- struct rte_eth_xstat_name *xstats_names,
- __rte_unused unsigned int size)
-{
- unsigned int i;
-
- if (xstats_names != NULL) {
- for (i = 0; i < IONIC_NB_HW_STATS; i++) {
- snprintf(xstats_names[i].name,
- sizeof(xstats_names[i].name),
- "%s", rte_ionic_xstats_strings[i].name);
- }
- }
-
- return IONIC_NB_HW_STATS;
-}
-
-static int
-ionic_dev_xstats_get_names_by_id(struct rte_eth_dev *eth_dev,
+ionic_dev_xstats_get_names(struct rte_eth_dev *eth_dev,
const uint64_t *ids, struct rte_eth_xstat_name *xstats_names,
unsigned int limit)
{
@@ -751,7 +730,7 @@ ionic_dev_xstats_get_names_by_id(struct rte_eth_dev *eth_dev,
return IONIC_NB_HW_STATS;
}
- ionic_dev_xstats_get_names_by_id(eth_dev, NULL, xstats_names_copy,
+ ionic_dev_xstats_get_names(eth_dev, NULL, xstats_names_copy,
IONIC_NB_HW_STATS);
for (i = 0; i < limit; i++) {
diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
index 589d9fa587..5312b955d6 100644
--- a/drivers/net/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/ipn3ke/ipn3ke_representor.c
@@ -2329,13 +2329,16 @@ ipn3ke_rpst_xstats_get
static int
ipn3ke_rpst_xstats_get_names
-(__rte_unused struct rte_eth_dev *dev,
+(__rte_unused struct rte_eth_dev *dev, const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
__rte_unused unsigned int limit)
{
unsigned int count = 0;
unsigned int i, prio;
+ if (ids != NULL)
+ return -ENOTSUP;
+
if (!xstats_names)
return ipn3ke_rpst_xstats_calc_num();
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index aae8b55d83..51b86ea5ce 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -167,15 +167,12 @@ ixgbe_dev_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
static int ixgbe_dev_stats_reset(struct rte_eth_dev *dev);
static int ixgbe_dev_xstats_reset(struct rte_eth_dev *dev);
static int ixgbe_dev_xstats_get_names(struct rte_eth_dev *dev,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
unsigned int size);
static int ixgbevf_dev_xstats_get_names(struct rte_eth_dev *dev,
- struct rte_eth_xstat_name *xstats_names, unsigned limit);
-static int ixgbe_dev_xstats_get_names_by_id(
- struct rte_eth_dev *dev,
const uint64_t *ids,
- struct rte_eth_xstat_name *xstats_names,
- unsigned int limit);
+ struct rte_eth_xstat_name *xstats_names, unsigned limit);
static int ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
uint16_t queue_id,
uint8_t stat_idx,
@@ -499,7 +496,6 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = {
.stats_reset = ixgbe_dev_stats_reset,
.xstats_reset = ixgbe_dev_xstats_reset,
.xstats_get_names = ixgbe_dev_xstats_get_names,
- .xstats_get_names_by_id = ixgbe_dev_xstats_get_names_by_id,
.queue_stats_mapping_set = ixgbe_dev_queue_stats_mapping_set,
.fw_version_get = ixgbe_fw_version_get,
.dev_infos_get = ixgbe_dev_info_get,
@@ -3381,61 +3377,7 @@ ixgbe_xstats_calc_num(void) {
(IXGBE_NB_TXQ_PRIO_STATS * IXGBE_NB_TXQ_PRIO_VALUES);
}
-static int ixgbe_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
- struct rte_eth_xstat_name *xstats_names, __rte_unused unsigned int size)
-{
- const unsigned cnt_stats = ixgbe_xstats_calc_num();
- unsigned stat, i, count;
-
- if (xstats_names != NULL) {
- count = 0;
-
- /* Note: limit >= cnt_stats checked upstream
- * in rte_eth_xstats_names()
- */
-
- /* Extended stats from ixgbe_hw_stats */
- for (i = 0; i < IXGBE_NB_HW_STATS; i++) {
- strlcpy(xstats_names[count].name,
- rte_ixgbe_stats_strings[i].name,
- sizeof(xstats_names[count].name));
- count++;
- }
-
- /* MACsec Stats */
- for (i = 0; i < IXGBE_NB_MACSEC_STATS; i++) {
- strlcpy(xstats_names[count].name,
- rte_ixgbe_macsec_strings[i].name,
- sizeof(xstats_names[count].name));
- count++;
- }
-
- /* RX Priority Stats */
- for (stat = 0; stat < IXGBE_NB_RXQ_PRIO_STATS; stat++) {
- for (i = 0; i < IXGBE_NB_RXQ_PRIO_VALUES; i++) {
- snprintf(xstats_names[count].name,
- sizeof(xstats_names[count].name),
- "rx_priority%u_%s", i,
- rte_ixgbe_rxq_strings[stat].name);
- count++;
- }
- }
-
- /* TX Priority Stats */
- for (stat = 0; stat < IXGBE_NB_TXQ_PRIO_STATS; stat++) {
- for (i = 0; i < IXGBE_NB_TXQ_PRIO_VALUES; i++) {
- snprintf(xstats_names[count].name,
- sizeof(xstats_names[count].name),
- "tx_priority%u_%s", i,
- rte_ixgbe_txq_strings[stat].name);
- count++;
- }
- }
- }
- return cnt_stats;
-}
-
-static int ixgbe_dev_xstats_get_names_by_id(
+static int ixgbe_dev_xstats_get_names(
struct rte_eth_dev *dev,
const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
@@ -3497,8 +3439,7 @@ static int ixgbe_dev_xstats_get_names_by_id(
uint16_t size = ixgbe_xstats_calc_num();
struct rte_eth_xstat_name xstats_names_copy[size];
- ixgbe_dev_xstats_get_names_by_id(dev, NULL, xstats_names_copy,
- size);
+ ixgbe_dev_xstats_get_names(dev, NULL, xstats_names_copy, size);
for (i = 0; i < limit; i++) {
if (ids[i] >= size) {
@@ -3512,6 +3453,7 @@ static int ixgbe_dev_xstats_get_names_by_id(
}
static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names, unsigned limit)
{
unsigned i;
@@ -3519,6 +3461,9 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
if (limit < IXGBEVF_NB_XSTATS && xstats_names != NULL)
return -ENOMEM;
+ if (ids != NULL)
+ return -ENOTSUP;
+
if (xstats_names != NULL)
for (i = 0; i < IXGBEVF_NB_XSTATS; i++)
strlcpy(xstats_names[i].name,
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index b72060a449..68b674c2a6 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -214,6 +214,7 @@ lio_dev_xstats_get(struct rte_eth_dev *eth_dev, struct rte_eth_xstat *xstats,
static int
lio_dev_xstats_get_names(struct rte_eth_dev *eth_dev,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
unsigned limit __rte_unused)
{
@@ -226,6 +227,9 @@ lio_dev_xstats_get_names(struct rte_eth_dev *eth_dev,
return -EINVAL;
}
+ if (ids != NULL)
+ return -ENOTSUP;
+
if (xstats_names == NULL)
return LIO_NB_XSTATS;
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 3581414b78..4eab2554bc 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -1620,6 +1620,7 @@ int mlx5_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *stats,
unsigned int n);
int mlx5_xstats_reset(struct rte_eth_dev *dev);
int mlx5_xstats_get_names(struct rte_eth_dev *dev __rte_unused,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
unsigned int n);
diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
index ae2f5668a7..d67afd6bc1 100644
--- a/drivers/net/mlx5/mlx5_stats.c
+++ b/drivers/net/mlx5/mlx5_stats.c
@@ -260,6 +260,8 @@ mlx5_xstats_reset(struct rte_eth_dev *dev)
*
* @param dev
* Pointer to Ethernet device structure.
+ * @param ids
+ * Array of xstats IDs to get names
* @param[out] xstats_names
* Buffer to insert names into.
* @param n
@@ -269,7 +271,7 @@ mlx5_xstats_reset(struct rte_eth_dev *dev)
* Number of xstats names.
*/
int
-mlx5_xstats_get_names(struct rte_eth_dev *dev,
+mlx5_xstats_get_names(struct rte_eth_dev *dev, const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names, unsigned int n)
{
unsigned int i;
@@ -277,6 +279,9 @@ mlx5_xstats_get_names(struct rte_eth_dev *dev,
struct mlx5_xstats_ctrl *xstats_ctrl = &priv->xstats_ctrl;
unsigned int mlx5_xstats_n = xstats_ctrl->mlx5_stats_n;
+ if (ids != NULL)
+ return -ENOTSUP;
+
if (n >= mlx5_xstats_n && xstats_names) {
for (i = 0; i != mlx5_xstats_n; ++i) {
strncpy(xstats_names[i].name,
diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index 078aefbb8d..554aba1be9 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -1689,11 +1689,15 @@ mrvl_xstats_reset(struct rte_eth_dev *dev)
*/
static int
mrvl_xstats_get_names(struct rte_eth_dev *dev __rte_unused,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
unsigned int size)
{
unsigned int i;
+ if (ids != NULL)
+ return -ENOTSUP;
+
if (!xstats_names)
return RTE_DIM(mrvl_xstats_tbl);
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 9e2a405973..4260f0b4ab 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -851,13 +851,16 @@ hn_dev_xstats_count(struct rte_eth_dev *dev)
}
static int
-hn_dev_xstats_get_names(struct rte_eth_dev *dev,
+hn_dev_xstats_get_names(struct rte_eth_dev *dev, const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
unsigned int limit)
{
unsigned int i, t, count = 0;
int ret;
+ if (ids != NULL)
+ return -ENOTSUP;
+
if (!xstats_names)
return hn_dev_xstats_count(dev);
diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c
index 75d4cabf2e..c1fd2ad7d5 100644
--- a/drivers/net/octeontx2/otx2_ethdev.c
+++ b/drivers/net/octeontx2/otx2_ethdev.c
@@ -2338,7 +2338,6 @@ static const struct eth_dev_ops otx2_eth_dev_ops = {
.xstats_get_names = otx2_nix_xstats_get_names,
.xstats_reset = otx2_nix_xstats_reset,
.xstats_get_by_id = otx2_nix_xstats_get_by_id,
- .xstats_get_names_by_id = otx2_nix_xstats_get_names_by_id,
.rxq_info_get = otx2_nix_rxq_info_get,
.txq_info_get = otx2_nix_txq_info_get,
.rx_burst_mode_get = otx2_rx_burst_mode_get,
diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index b1575f59a2..1eeb77c9dd 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -506,6 +506,7 @@ int otx2_nix_queue_stats_mapping(struct rte_eth_dev *dev,
int otx2_nix_xstats_get(struct rte_eth_dev *eth_dev,
struct rte_eth_xstat *xstats, unsigned int n);
int otx2_nix_xstats_get_names(struct rte_eth_dev *eth_dev,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
unsigned int limit);
int otx2_nix_xstats_reset(struct rte_eth_dev *eth_dev);
@@ -513,10 +514,6 @@ int otx2_nix_xstats_reset(struct rte_eth_dev *eth_dev);
int otx2_nix_xstats_get_by_id(struct rte_eth_dev *eth_dev,
const uint64_t *ids,
uint64_t *values, unsigned int n);
-int otx2_nix_xstats_get_names_by_id(struct rte_eth_dev *eth_dev,
- const uint64_t *ids,
- struct rte_eth_xstat_name *xstats_names,
- unsigned int limit);
/* RSS */
void otx2_nix_rss_set_key(struct otx2_eth_dev *dev,
diff --git a/drivers/net/octeontx2/otx2_stats.c b/drivers/net/octeontx2/otx2_stats.c
index 3adf21608c..70bfaa3d77 100644
--- a/drivers/net/octeontx2/otx2_stats.c
+++ b/drivers/net/octeontx2/otx2_stats.c
@@ -200,8 +200,8 @@ otx2_nix_xstats_get(struct rte_eth_dev *eth_dev,
return count;
}
-int
-otx2_nix_xstats_get_names(struct rte_eth_dev *eth_dev,
+static int
+otx2_nix_xstats_get_all_names(struct rte_eth_dev *eth_dev,
struct rte_eth_xstat_name *xstats_names,
unsigned int limit)
{
@@ -239,10 +239,10 @@ otx2_nix_xstats_get_names(struct rte_eth_dev *eth_dev,
}
int
-otx2_nix_xstats_get_names_by_id(struct rte_eth_dev *eth_dev,
- const uint64_t *ids,
- struct rte_eth_xstat_name *xstats_names,
- unsigned int limit)
+otx2_nix_xstats_get_names(struct rte_eth_dev *eth_dev,
+ const uint64_t *ids,
+ struct rte_eth_xstat_name *xstats_names,
+ unsigned int limit)
{
struct rte_eth_xstat_name xstats_names_copy[OTX2_NIX_NUM_XSTATS_REG];
uint16_t i;
@@ -256,7 +256,7 @@ otx2_nix_xstats_get_names_by_id(struct rte_eth_dev *eth_dev,
if (xstats_names == NULL)
return -ENOMEM;
- otx2_nix_xstats_get_names(eth_dev, xstats_names_copy, limit);
+ otx2_nix_xstats_get_all_names(eth_dev, xstats_names_copy, limit);
for (i = 0; i < OTX2_NIX_NUM_XSTATS_REG; i++) {
if (ids[i] >= OTX2_NIX_NUM_XSTATS_REG) {
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index a4304e0eff..40443b30bf 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1718,6 +1718,7 @@ qede_get_xstats_count(struct qede_dev *qdev) {
static int
qede_get_xstats_names(struct rte_eth_dev *dev,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
__rte_unused unsigned int limit)
{
@@ -1726,6 +1727,9 @@ qede_get_xstats_names(struct rte_eth_dev *dev,
const unsigned int stat_cnt = qede_get_xstats_count(qdev);
unsigned int i, qid, hw_fn, stat_idx = 0;
+ if (ids != NULL)
+ return -ENOTSUP;
+
if (xstats_names == NULL)
return stat_cnt;
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index f212ca8ad6..d05a1fb5ca 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -763,43 +763,6 @@ sfc_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
return nb_supported;
}
-static int
-sfc_xstats_get_names(struct rte_eth_dev *dev,
- struct rte_eth_xstat_name *xstats_names,
- unsigned int xstats_count)
-{
- struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
- struct sfc_port *port = &sa->port;
- unsigned int i;
- unsigned int nstats = 0;
- unsigned int nb_written = 0;
- int ret;
-
- if (unlikely(xstats_names == NULL))
- return sfc_xstats_get_nb_supported(sa);
-
- for (i = 0; i < EFX_MAC_NSTATS; ++i) {
- if (EFX_MAC_STAT_SUPPORTED(port->mac_stats_mask, i)) {
- if (nstats < xstats_count) {
- strlcpy(xstats_names[nstats].name,
- efx_mac_stat_name(sa->nic, i),
- sizeof(xstats_names[0].name));
- nb_written++;
- }
- nstats++;
- }
- }
-
- ret = sfc_sw_xstats_get_names(sa, xstats_names, xstats_count,
- &nb_written, &nstats);
- if (ret != 0) {
- SFC_ASSERT(ret < 0);
- return ret;
- }
-
- return nstats;
-}
-
static int
sfc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
uint64_t *values, unsigned int n)
@@ -837,10 +800,42 @@ sfc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
}
static int
-sfc_xstats_get_names_by_id(struct rte_eth_dev *dev,
- const uint64_t *ids,
- struct rte_eth_xstat_name *xstats_names,
- unsigned int size)
+sfc_xstats_get_all_names(struct sfc_adapter *sa,
+ struct rte_eth_xstat_name *xstats_names,
+ unsigned int xstats_count)
+{
+ struct sfc_port *port = &sa->port;
+ unsigned int i;
+ unsigned int nstats = 0;
+ unsigned int nb_written = 0;
+ int ret;
+
+ for (i = 0; i < EFX_MAC_NSTATS; ++i) {
+ if (EFX_MAC_STAT_SUPPORTED(port->mac_stats_mask, i)) {
+ if (nstats < xstats_count) {
+ strlcpy(xstats_names[nstats].name,
+ efx_mac_stat_name(sa->nic, i),
+ sizeof(xstats_names[0].name));
+ nb_written++;
+ }
+ nstats++;
+ }
+ }
+
+ ret = sfc_sw_xstats_get_names(sa, xstats_names, xstats_count,
+ &nb_written, &nstats);
+ if (ret != 0) {
+ SFC_ASSERT(ret < 0);
+ return ret;
+ }
+
+ return nstats;
+}
+
+static int
+sfc_xstats_get_names(struct rte_eth_dev *dev, const uint64_t *ids,
+ struct rte_eth_xstat_name *xstats_names,
+ unsigned int size)
{
struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
struct sfc_port *port = &sa->port;
@@ -848,13 +843,15 @@ sfc_xstats_get_names_by_id(struct rte_eth_dev *dev,
unsigned int i;
int ret;
- if (unlikely(xstats_names == NULL && ids != NULL) ||
- unlikely(xstats_names != NULL && ids == NULL))
+ if (unlikely(xstats_names == NULL && ids != NULL))
return -EINVAL;
if (unlikely(xstats_names == NULL && ids == NULL))
return sfc_xstats_get_nb_supported(sa);
+ if (ids == NULL)
+ return sfc_xstats_get_all_names(sa, xstats_names, size);
+
/*
* Names array could be filled in nonsequential order. Fill names with
* string indicating invalid ID first.
@@ -1905,7 +1902,6 @@ static const struct eth_dev_ops sfc_eth_dev_ops = {
.txq_info_get = sfc_tx_queue_info_get,
.fw_version_get = sfc_fw_version_get,
.xstats_get_by_id = sfc_xstats_get_by_id,
- .xstats_get_names_by_id = sfc_xstats_get_names_by_id,
.pool_ops_supported = sfc_pool_ops_supported,
};
diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c
index b267da462b..be6e073141 100644
--- a/drivers/net/txgbe/txgbe_ethdev.c
+++ b/drivers/net/txgbe/txgbe_ethdev.c
@@ -2424,7 +2424,7 @@ txgbe_get_offset_by_id(uint32_t id, uint32_t *offset)
return -1;
}
-static int txgbe_dev_xstats_get_names(struct rte_eth_dev *dev,
+static int txgbe_dev_xstats_get_all_names(struct rte_eth_dev *dev,
struct rte_eth_xstat_name *xstats_names, unsigned int limit)
{
unsigned int i, count;
@@ -2450,7 +2450,7 @@ static int txgbe_dev_xstats_get_names(struct rte_eth_dev *dev,
return i;
}
-static int txgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
+static int txgbe_dev_xstats_get_names(struct rte_eth_dev *dev,
const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
unsigned int limit)
@@ -2458,7 +2458,7 @@ static int txgbe_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
unsigned int i;
if (ids == NULL)
- return txgbe_dev_xstats_get_names(dev, xstats_names, limit);
+ return txgbe_dev_xstats_get_all_names(dev, xstats_names, limit);
for (i = 0; i < limit; i++) {
if (txgbe_get_name_by_id(ids[i], xstats_names[i].name,
@@ -5292,7 +5292,6 @@ static const struct eth_dev_ops txgbe_eth_dev_ops = {
.stats_reset = txgbe_dev_stats_reset,
.xstats_reset = txgbe_dev_xstats_reset,
.xstats_get_names = txgbe_dev_xstats_get_names,
- .xstats_get_names_by_id = txgbe_dev_xstats_get_names_by_id,
.queue_stats_mapping_set = txgbe_dev_queue_stats_mapping_set,
.fw_version_get = txgbe_fw_version_get,
.dev_supported_ptypes_get = txgbe_dev_supported_ptypes_get,
diff --git a/drivers/net/txgbe/txgbe_ethdev_vf.c b/drivers/net/txgbe/txgbe_ethdev_vf.c
index 896da8a887..cbe2f46f34 100644
--- a/drivers/net/txgbe/txgbe_ethdev_vf.c
+++ b/drivers/net/txgbe/txgbe_ethdev_vf.c
@@ -348,10 +348,14 @@ static struct rte_pci_driver rte_txgbevf_pmd = {
};
static int txgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names, unsigned int limit)
{
unsigned int i;
+ if (ids != NULL)
+ return -ENOTSUP;
+
if (limit < TXGBEVF_NB_XSTATS && xstats_names != NULL)
return -ENOMEM;
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index a202931e9a..e5d723bfd7 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -251,6 +251,7 @@ vhost_dev_xstats_reset(struct rte_eth_dev *dev)
static int
vhost_dev_xstats_get_names(struct rte_eth_dev *dev __rte_unused,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
unsigned int limit __rte_unused)
{
@@ -258,6 +259,9 @@ vhost_dev_xstats_get_names(struct rte_eth_dev *dev __rte_unused,
int count = 0;
int nstats = VHOST_NB_XSTATS_RXPORT + VHOST_NB_XSTATS_TXPORT;
+ if (ids != NULL)
+ return -ENOTSUP;
+
if (!xstats_names)
return nstats;
for (t = 0; t < VHOST_NB_XSTATS_RXPORT; t++) {
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index b60eeb24ab..da405e0896 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -60,6 +60,7 @@ static int virtio_dev_stats_get(struct rte_eth_dev *dev,
static int virtio_dev_xstats_get(struct rte_eth_dev *dev,
struct rte_eth_xstat *xstats, unsigned n);
static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
unsigned limit);
static int virtio_dev_stats_reset(struct rte_eth_dev *dev);
@@ -1045,6 +1046,7 @@ virtio_update_stats(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
}
static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
__rte_unused unsigned limit)
{
@@ -1055,6 +1057,9 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev,
unsigned nstats = dev->data->nb_tx_queues * VIRTIO_NB_TXQ_XSTATS +
dev->data->nb_rx_queues * VIRTIO_NB_RXQ_XSTATS;
+ if (ids != NULL)
+ return -ENOTSUP;
+
if (xstats_names != NULL) {
/* Note: limit checked in rte_eth_xstats_names() */
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 2f40ae907d..48767e6db1 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -80,6 +80,7 @@ static int vmxnet3_dev_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats);
static int vmxnet3_dev_stats_reset(struct rte_eth_dev *dev);
static int vmxnet3_dev_xstats_get_names(struct rte_eth_dev *dev,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats,
unsigned int n);
static int vmxnet3_dev_xstats_get(struct rte_eth_dev *dev,
@@ -1201,6 +1202,7 @@ vmxnet3_hw_stats_save(struct vmxnet3_hw *hw)
static int
vmxnet3_dev_xstats_get_names(struct rte_eth_dev *dev,
+ const uint64_t *ids,
struct rte_eth_xstat_name *xstats_names,
unsigned int n)
{
@@ -1209,6 +1211,9 @@ vmxnet3_dev_xstats_get_names(struct rte_eth_dev *dev,
dev->data->nb_tx_queues * RTE_DIM(vmxnet3_txq_stat_strings) +
dev->data->nb_rx_queues * RTE_DIM(vmxnet3_rxq_stat_strings);
+ if (ids != NULL)
+ return -ENOTSUP;
+
if (!xstats_names || n < nstats)
return nstats;
diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
index 96dd0ecaf3..98b9a2ad9a 100644
--- a/lib/ethdev/ethdev_driver.h
+++ b/lib/ethdev/ethdev_driver.h
@@ -227,29 +227,34 @@ typedef int (*eth_xstats_get_by_id_t)(struct rte_eth_dev *dev,
*/
typedef int (*eth_xstats_reset_t)(struct rte_eth_dev *dev);
-typedef int (*eth_xstats_get_names_t)(struct rte_eth_dev *dev,
- struct rte_eth_xstat_name *xstats_names, unsigned int size);
-/**< @internal Get names of extended stats of an Ethernet device. */
-
/**
* @internal
* Get names of extended stats of an Ethernet device.
*
+ * If @p size is 0, get the number of available statistics.
+ *
+ * If @p ids is NULL, get names of all available statistics.
+ *
+ * Otherwise, get names of statistics specified by @p ids.
+ *
* @param dev
* ethdev handle of port.
* @param ids
- * IDs array to retrieve specific statistics. Must not be NULL.
+ * IDs array to retrieve specific statistics.
* @param xstats_names
* An rte_eth_xstat_name array of at least @p size elements to be filled.
- * Must not be NULL.
* @param size
* Element count in @p ids and @p xstats_names.
*
* @return
+ * - A number greater than @p size and equal to the number of extended
+ * statistics if @p ids is NULL and @p size is too small to return
+ * names of available statistics.
* - A number of filled in stats.
+ * - -ENOTSUP if non-NULL @p ids are not supported
* - A negative value on error.
*/
-typedef int (*eth_xstats_get_names_by_id_t)(struct rte_eth_dev *dev,
+typedef int (*eth_xstats_get_names_t)(struct rte_eth_dev *dev,
const uint64_t *ids, struct rte_eth_xstat_name *xstats_names,
unsigned int size);
@@ -936,8 +941,6 @@ struct eth_dev_ops {
eth_xstats_get_by_id_t xstats_get_by_id;
/**< Get extended device statistic values by ID. */
- eth_xstats_get_names_by_id_t xstats_get_names_by_id;
- /**< Get name of extended device statistics by ID. */
eth_tm_ops_get_t tm_ops_get;
/**< Get Traffic Management (TM) operations. */
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 655d7be3b5..c951c0ba35 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -2867,7 +2867,7 @@ eth_dev_get_xstats_count(uint16_t port_id)
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
if (dev->dev_ops->xstats_get_names != NULL) {
- count = (*dev->dev_ops->xstats_get_names)(dev, NULL, 0);
+ count = (*dev->dev_ops->xstats_get_names)(dev, NULL, NULL, 0);
if (count < 0)
return eth_err(port_id, count);
} else
@@ -3005,7 +3005,7 @@ rte_eth_xstats_get_names_by_id(uint16_t port_id,
if (ids && !xstats_names)
return -EINVAL;
- if (ids && dev->dev_ops->xstats_get_names_by_id != NULL && size > 0) {
+ if (ids && dev->dev_ops->xstats_get_names != NULL && size > 0) {
uint64_t ids_copy[size];
for (i = 0; i < size; i++) {
@@ -3021,9 +3021,16 @@ rte_eth_xstats_get_names_by_id(uint16_t port_id,
ids_copy[i] = ids[i] - basic_count;
}
- if (no_basic_stat_requested)
- return (*dev->dev_ops->xstats_get_names_by_id)(dev,
+ if (no_basic_stat_requested) {
+ ret = (*dev->dev_ops->xstats_get_names)(dev,
ids_copy, xstats_names, size);
+ if (ret == 0 || ret != -ENOTSUP)
+ return ret;
+ /*
+ * Driver does not support getting names by IDs.
+ * Fallback to support on ethdev layer.
+ */
+ }
}
/* Retrieve all stats */
@@ -3104,7 +3111,7 @@ rte_eth_xstats_get_names(uint16_t port_id,
* to end of list.
*/
cnt_driver_entries = (*dev->dev_ops->xstats_get_names)(
- dev,
+ dev, NULL,
xstats_names + cnt_used_entries,
size - cnt_used_entries);
if (cnt_driver_entries < 0)
--
2.30.2
next prev parent reply other threads:[~2021-10-01 9:08 UTC|newest]
Thread overview: 114+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-04 14:42 [dpdk-dev] [PATCH 00/11] net/sfc: provide Rx/Tx doorbells stats Andrew Rybchenko
2021-06-04 14:42 ` [dpdk-dev] [PATCH 01/11] net/sfc: fix get xstats by ID callback to use MAC stats lock Andrew Rybchenko
2021-06-04 14:42 ` [dpdk-dev] [PATCH 02/11] net/sfc: fix reading adapter state without locking Andrew Rybchenko
2021-06-04 14:42 ` [dpdk-dev] [PATCH 03/11] ethdev: fix docs of functions getting xstats by IDs Andrew Rybchenko
2021-07-20 16:25 ` Ferruh Yigit
2021-07-22 9:12 ` Andrew Rybchenko
2021-07-23 14:19 ` Ferruh Yigit
2021-07-24 12:06 ` Andrew Rybchenko
2021-06-04 14:42 ` [dpdk-dev] [PATCH 04/11] ethdev: fix docs of drivers callbacks " Andrew Rybchenko
2021-07-20 16:51 ` Ferruh Yigit
2021-07-22 9:33 ` Andrew Rybchenko
2021-07-23 14:31 ` Ferruh Yigit
2021-07-23 18:47 ` Andrew Rybchenko
2021-06-04 14:42 ` [dpdk-dev] [PATCH 05/11] net/sfc: fix xstats by ID callbacks according to ethdev Andrew Rybchenko
2021-06-04 14:42 ` [dpdk-dev] [PATCH 06/11] net/sfc: fix accessing xstats by an unsorted list of IDs Andrew Rybchenko
2021-06-04 14:42 ` [dpdk-dev] [PATCH 07/11] net/sfc: fix MAC stats update to work for stopped device Andrew Rybchenko
2021-06-04 14:42 ` [dpdk-dev] [PATCH 08/11] net/sfc: simplify getting of available xstats case Andrew Rybchenko
2021-06-04 14:42 ` [dpdk-dev] [PATCH 09/11] net/sfc: prepare to add more xstats Andrew Rybchenko
2021-06-04 14:42 ` [dpdk-dev] [PATCH 10/11] net/sfc: add xstats for Rx/Tx doorbells Andrew Rybchenko
2021-06-04 14:42 ` [dpdk-dev] [PATCH 11/11] app/testpmd: add option to display extended statistics Andrew Rybchenko
2021-07-05 7:10 ` David Marchand
2021-07-06 8:54 ` Li, Xiaoyun
2021-07-22 9:54 ` [dpdk-dev] [PATCH v2 00/11] net/sfc: provide Rx/Tx doorbells stats Andrew Rybchenko
2021-07-22 9:54 ` [dpdk-dev] [PATCH v2 01/11] net/sfc: fix get xstats by ID callback to use MAC stats lock Andrew Rybchenko
2021-07-22 9:54 ` [dpdk-dev] [PATCH v2 02/11] net/sfc: fix reading adapter state without locking Andrew Rybchenko
2021-07-22 9:54 ` [dpdk-dev] [PATCH v2 03/11] ethdev: fix docs of functions getting xstats by IDs Andrew Rybchenko
2021-07-22 9:54 ` [dpdk-dev] [PATCH v2 04/11] ethdev: fix docs of drivers callbacks " Andrew Rybchenko
2021-07-22 9:54 ` [dpdk-dev] [PATCH v2 05/11] net/sfc: fix xstats by ID callbacks according to ethdev Andrew Rybchenko
2021-07-22 9:54 ` [dpdk-dev] [PATCH v2 06/11] net/sfc: fix accessing xstats by an unsorted list of IDs Andrew Rybchenko
2021-07-22 9:54 ` [dpdk-dev] [PATCH v2 07/11] net/sfc: fix MAC stats update to work for stopped device Andrew Rybchenko
2021-07-22 9:54 ` [dpdk-dev] [PATCH v2 08/11] net/sfc: simplify getting of available xstats case Andrew Rybchenko
2021-07-22 9:54 ` [dpdk-dev] [PATCH v2 09/11] net/sfc: prepare to add more xstats Andrew Rybchenko
2021-07-22 9:54 ` [dpdk-dev] [PATCH v2 10/11] net/sfc: add xstats for Rx/Tx doorbells Andrew Rybchenko
2021-07-22 9:54 ` [dpdk-dev] [PATCH v2 11/11] app/testpmd: add option to display extended statistics Andrew Rybchenko
2021-07-22 19:43 ` David Marchand
2021-07-22 20:15 ` David Marchand
2021-07-23 13:08 ` Andrew Rybchenko
2021-07-23 13:15 ` [dpdk-dev] [PATCH v3 00/11] net/sfc: provide Rx/Tx doorbells stats Andrew Rybchenko
2021-07-23 13:15 ` [dpdk-dev] [PATCH v3 01/11] net/sfc: fix get xstats by ID callback to use MAC stats lock Andrew Rybchenko
2021-07-23 13:15 ` [dpdk-dev] [PATCH v3 02/11] net/sfc: fix reading adapter state without locking Andrew Rybchenko
2021-07-23 13:15 ` [dpdk-dev] [PATCH v3 03/11] ethdev: fix docs of functions getting xstats by IDs Andrew Rybchenko
2021-07-23 14:42 ` Ferruh Yigit
2021-07-24 12:07 ` Andrew Rybchenko
2021-07-23 13:15 ` [dpdk-dev] [PATCH v3 04/11] ethdev: fix docs of drivers callbacks " Andrew Rybchenko
2021-07-23 14:46 ` Ferruh Yigit
2021-07-23 13:15 ` [dpdk-dev] [PATCH v3 05/11] net/sfc: fix xstats by ID callbacks according to ethdev Andrew Rybchenko
2021-07-23 13:15 ` [dpdk-dev] [PATCH v3 06/11] net/sfc: fix accessing xstats by an unsorted list of IDs Andrew Rybchenko
2021-07-23 13:15 ` [dpdk-dev] [PATCH v3 07/11] net/sfc: fix MAC stats update to work for stopped device Andrew Rybchenko
2021-07-23 13:15 ` [dpdk-dev] [PATCH v3 08/11] net/sfc: simplify getting of available xstats case Andrew Rybchenko
2021-07-23 13:15 ` [dpdk-dev] [PATCH v3 09/11] net/sfc: prepare to add more xstats Andrew Rybchenko
2021-07-23 13:15 ` [dpdk-dev] [PATCH v3 10/11] net/sfc: add xstats for Rx/Tx doorbells Andrew Rybchenko
2021-07-23 13:15 ` [dpdk-dev] [PATCH v3 11/11] app/testpmd: add option to display extended statistics Andrew Rybchenko
2021-08-20 13:55 ` [dpdk-dev] [PATCH v4] " Andrew Rybchenko
2021-08-21 1:09 ` Ajit Khaparde
2021-08-23 9:59 ` Andrew Rybchenko
2021-09-02 16:08 ` Ferruh Yigit
2021-09-15 10:25 ` Ivan Ilchenko
2021-09-15 11:27 ` [dpdk-dev] [PATCH v5] " Andrew Rybchenko
2021-10-14 7:43 ` Ferruh Yigit
2021-10-14 9:00 ` [dpdk-dev] [PATCH v6] " Andrew Rybchenko
2021-10-14 12:41 ` Ferruh Yigit
2021-07-23 21:34 ` [dpdk-dev] [PATCH v3 00/11] net/sfc: provide Rx/Tx doorbells stats Thomas Monjalon
2021-07-24 12:33 ` [dpdk-dev] [PATCH v4 1/2] ethdev: fix docs of functions getting xstats by IDs Andrew Rybchenko
2021-07-24 12:33 ` [dpdk-dev] [PATCH v4 2/2] ethdev: fix docs of drivers callbacks " Andrew Rybchenko
2021-07-26 10:13 ` Olivier Matz
2021-09-28 12:04 ` Andrew Rybchenko
2021-07-26 10:13 ` [dpdk-dev] [PATCH v4 1/2] ethdev: fix docs of functions " Olivier Matz
2021-09-28 12:01 ` Andrew Rybchenko
2021-09-28 12:05 ` [dpdk-dev] [PATCH v5 " Andrew Rybchenko
2021-09-28 12:05 ` [dpdk-dev] [PATCH v5 2/2] ethdev: fix docs of drivers callbacks " Andrew Rybchenko
2021-09-28 16:50 ` Ferruh Yigit
2021-09-28 16:53 ` Andrew Rybchenko
2021-09-29 8:44 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2021-09-29 11:54 ` Andrew Rybchenko
2021-09-30 12:08 ` Ferruh Yigit
2021-09-30 14:01 ` Andrew Rybchenko
2021-09-30 15:30 ` Ferruh Yigit
2021-09-30 16:01 ` Andrew Rybchenko
2021-09-28 16:46 ` [dpdk-dev] [PATCH v5 1/2] ethdev: fix docs of functions " Ferruh Yigit
2021-09-30 14:04 ` [dpdk-dev] [PATCH v6 1/4] " Andrew Rybchenko
2021-09-30 14:04 ` [dpdk-dev] [PATCH v6 2/4] ethdev: fix docs of drivers callbacks " Andrew Rybchenko
2021-09-30 14:04 ` [dpdk-dev] [PATCH v6 3/4] ethdev: improve xstats names by IDs get prototype Andrew Rybchenko
2021-09-30 14:04 ` [dpdk-dev] [PATCH v6 4/4] ethdev: merge driver ops to get all xstats names and by ID Andrew Rybchenko
2021-09-30 16:01 ` [dpdk-dev] [PATCH v7 1/4] ethdev: do not use get xstats names by IDs to obtain count Andrew Rybchenko
2021-09-30 16:01 ` [dpdk-dev] [PATCH v7 1/5] ethdev: fix docs of functions getting xstats by IDs Andrew Rybchenko
2021-09-30 16:01 ` [dpdk-dev] [PATCH v7 2/5] ethdev: do not use get xstats names by IDs to obtain count Andrew Rybchenko
2021-09-30 16:01 ` [dpdk-dev] [PATCH v7 2/4] ethdev: fix docs of drivers callbacks getting xstats by IDs Andrew Rybchenko
2021-09-30 16:01 ` [dpdk-dev] [PATCH v7 3/5] " Andrew Rybchenko
2021-09-30 16:01 ` [dpdk-dev] [PATCH v7 3/4] ethdev: improve xstats names by IDs get prototype Andrew Rybchenko
2021-09-30 16:01 ` [dpdk-dev] [PATCH v7 4/5] " Andrew Rybchenko
2021-09-30 16:01 ` [dpdk-dev] [PATCH v7 4/4] ethdev: merge driver ops to get all xstats names and by ID Andrew Rybchenko
2021-09-30 16:01 ` [dpdk-dev] [PATCH v7 5/5] " Andrew Rybchenko
2021-09-30 16:05 ` [dpdk-dev] [PATCH v8 1/5] ethdev: fix docs of functions getting xstats by IDs Andrew Rybchenko
2021-09-30 16:05 ` [dpdk-dev] [PATCH v8 2/5] ethdev: do not use get xstats names by IDs to obtain count Andrew Rybchenko
2021-09-30 16:32 ` Ferruh Yigit
2021-09-30 16:05 ` [dpdk-dev] [PATCH v8 3/5] ethdev: fix docs of drivers callbacks getting xstats by IDs Andrew Rybchenko
2021-09-30 16:33 ` Ferruh Yigit
2021-10-01 9:07 ` Andrew Rybchenko
2021-09-30 16:05 ` [dpdk-dev] [PATCH v8 4/5] ethdev: improve xstats names by IDs get prototype Andrew Rybchenko
2021-09-30 16:05 ` [dpdk-dev] [PATCH v8 5/5] ethdev: merge driver ops to get all xstats names and by ID Andrew Rybchenko
2021-09-30 16:47 ` Ferruh Yigit
2021-10-01 9:06 ` Andrew Rybchenko
2021-10-01 9:07 ` [dpdk-dev] [PATCH v9 1/5] ethdev: fix docs of functions getting xstats by IDs Andrew Rybchenko
2021-10-01 9:07 ` [dpdk-dev] [PATCH v9 2/5] ethdev: do not use get xstats names by IDs to obtain count Andrew Rybchenko
2021-10-01 9:07 ` [dpdk-dev] [PATCH v9 3/5] ethdev: fix docs of drivers callbacks getting xstats by IDs Andrew Rybchenko
2021-10-01 9:42 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2021-10-01 10:22 ` Andrew Rybchenko
2021-10-06 10:37 ` Ferruh Yigit
2021-10-01 9:07 ` [dpdk-dev] [PATCH v9 4/5] ethdev: improve xstats names by IDs get prototype Andrew Rybchenko
2021-10-01 9:42 ` Ferruh Yigit
2021-10-01 9:07 ` Andrew Rybchenko [this message]
2021-10-06 11:06 ` [dpdk-dev] [PATCH v9 5/5] ethdev: merge driver ops to get all xstats names and by ID Ferruh Yigit
2023-06-09 10:09 ` Ferruh Yigit
2021-10-06 11:08 ` [dpdk-dev] [PATCH v9 1/5] ethdev: fix docs of functions getting xstats by IDs Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211001090723.1414911-5-andrew.rybchenko@oktetlabs.ru \
--to=andrew.rybchenko@oktetlabs.ru \
--cc=aboyer@pensando.io \
--cc=ajit.khaparde@broadcom.com \
--cc=asomalap@amd.com \
--cc=beilei.xing@intel.com \
--cc=chenbo.xia@intel.com \
--cc=cloud.wangxiaoyun@huawei.com \
--cc=dev@dpdk.org \
--cc=dsinghrawat@marvell.com \
--cc=evgenys@amazon.com \
--cc=ferruh.yigit@intel.com \
--cc=grive@u256.net \
--cc=haiyue.wang@intel.com \
--cc=hemant.agrawal@nxp.com \
--cc=humin29@huawei.com \
--cc=igorch@amazon.com \
--cc=irusskikh@marvell.com \
--cc=jerinj@marvell.com \
--cc=jianwang@trustnetic.com \
--cc=jiawenwu@trustnetic.com \
--cc=jingjing.wu@intel.com \
--cc=kirankumark@marvell.com \
--cc=lironh@marvell.com \
--cc=longli@microsoft.com \
--cc=matan@nvidia.com \
--cc=maxime.coquelin@redhat.com \
--cc=mk@semihalf.com \
--cc=mw@semihalf.com \
--cc=ndabilpuram@marvell.com \
--cc=oulijun@huawei.com \
--cc=qi.z.zhang@intel.com \
--cc=qiming.yang@intel.com \
--cc=rahul.lakkireddy@chelsio.com \
--cc=rmody@marvell.com \
--cc=rosen.xu@intel.com \
--cc=sachin.saxena@oss.nxp.com \
--cc=shaibran@amazon.com \
--cc=shshaikh@marvell.com \
--cc=skori@marvell.com \
--cc=skoteshwar@marvell.com \
--cc=somnath.kotur@broadcom.com \
--cc=srinivasan@marvell.com \
--cc=sthemmin@microsoft.com \
--cc=sthotton@marvell.com \
--cc=thomas@monjalon.net \
--cc=viacheslavo@nvidia.com \
--cc=xiao.w.wang@intel.com \
--cc=xuanziyang2@huawei.com \
--cc=yisen.zhuang@huawei.com \
--cc=yongwang@vmware.com \
--cc=zhouguoyang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).