@@ -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()``.
@@ -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,
@@ -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) {
@@ -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,
@@ -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;
@@ -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,
@@ -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,
@@ -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);
@@ -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)
@@ -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,
@@ -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,
@@ -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,
@@ -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,
@@ -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;
@@ -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);
@@ -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() */
@@ -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);
@@ -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,
@@ -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,
@@ -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) {
@@ -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);
@@ -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();
@@ -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,
@@ -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();
@@ -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) {
@@ -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++) {
@@ -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();
@@ -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,
@@ -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;
@@ -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);
@@ -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,
@@ -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);
@@ -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);
@@ -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,
@@ -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,
@@ -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) {
@@ -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;
@@ -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,
};
@@ -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,
@@ -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;
@@ -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++) {
@@ -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() */
@@ -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;
@@ -227,10 +227,6 @@ 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.
@@ -238,13 +234,12 @@ typedef int (*eth_xstats_get_names_t)(struct rte_eth_dev *dev,
* @param dev
* ethdev handle of port.
* @param ids
- * IDs array to retrieve specific statistics. Can be NULL together
- * with @p xstats_names to retrieve number of available statistics.
- * @param ids
- * IDs array to retrieve specific statistics. Must not be NULL.
+ * IDs array to retrieve specific statistics. Can be NULL to get names
+ * of all available statistics.
* @param xstats_names
* An rte_eth_xstat_name array of at least *size* elements to
- * be filled. Must not be NULL.
+ * be filled. Can be NULL together with @p ids to get number of
+ * extended statistics.
* @param size
* Element count in @p ids and @p xstats_names.
*
@@ -253,7 +248,7 @@ typedef int (*eth_xstats_get_names_t)(struct rte_eth_dev *dev,
* - A number of available stats if both xstats_names and ids are NULL.
* - 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);
@@ -940,8 +935,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. */
@@ -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)