patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Ajit Khaparde <ajit.khaparde@broadcom.com>,
	Somnath Kotur <somnath.kotur@broadcom.com>
Cc: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@intel.com>, stable@dpdk.org
Subject: [dpdk-stable] [PATCH] net/bnxt: fix xstats by id
Date: Tue, 16 Jun 2020 16:36:13 +0100	[thread overview]
Message-ID: <20200616153613.1071713-1-ferruh.yigit@intel.com> (raw)

The xstat by id device operation seems wrong, it fills 'xstats' struct
via 'bnxt_dev_xstats_get_op()' call, but the retrieved values are not
transferred to user input 'values' array.

ethdev layer 'rte_eth_xstats_get_by_id()' &
'rte_eth_xstats_get_names_by_id' already provides "by id" support when
device operations are missing.
It is good for PMD to provide these device operations if it has a more
performant way to get by id. But current implementation in PMD already
does same thing with the ethdev APIs, so removing them provides same
functionality.

Fixes: 88920136688c ("net/bnxt: support xstats get by id")
Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 drivers/net/bnxt/bnxt_ethdev.c |  2 -
 drivers/net/bnxt/bnxt_stats.c  | 69 ----------------------------------
 2 files changed, 71 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index e8b4c058a1..0dcdb44adf 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -4160,8 +4160,6 @@ static const struct eth_dev_ops bnxt_dev_ops = {
 	.txq_info_get = bnxt_txq_info_get_op,
 	.dev_led_on = bnxt_dev_led_on_op,
 	.dev_led_off = bnxt_dev_led_off_op,
-	.xstats_get_by_id = bnxt_dev_xstats_get_by_id_op,
-	.xstats_get_names_by_id = bnxt_dev_xstats_get_names_by_id_op,
 	.rx_queue_count = bnxt_rx_queue_count_op,
 	.rx_descriptor_status = bnxt_rx_descriptor_status_op,
 	.tx_descriptor_status = bnxt_tx_descriptor_status_op,
diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index 8df6922f52..2b753cd1b8 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -827,75 +827,6 @@ int bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev)
 	return ret;
 }
 
-int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev, const uint64_t *ids,
-		uint64_t *values, unsigned int limit)
-{
-	struct bnxt *bp = dev->data->dev_private;
-	const unsigned int stat_cnt = RTE_DIM(bnxt_rx_stats_strings) +
-				RTE_DIM(bnxt_tx_stats_strings) +
-				RTE_DIM(bnxt_func_stats_strings) +
-				RTE_DIM(bnxt_rx_ext_stats_strings) +
-				RTE_DIM(bnxt_tx_ext_stats_strings) +
-				bnxt_flow_stats_cnt(bp);
-	struct rte_eth_xstat xstats[stat_cnt];
-	uint64_t values_copy[stat_cnt];
-	uint16_t i;
-	int rc;
-
-	rc = is_bnxt_in_error(bp);
-	if (rc)
-		return rc;
-
-	if (!ids)
-		return bnxt_dev_xstats_get_op(dev, xstats, stat_cnt);
-
-	bnxt_dev_xstats_get_by_id_op(dev, NULL, values_copy, stat_cnt);
-	for (i = 0; i < limit; i++) {
-		if (ids[i] >= stat_cnt) {
-			PMD_DRV_LOG(ERR, "id value isn't valid");
-			return -EINVAL;
-		}
-		values[i] = values_copy[ids[i]];
-	}
-	return stat_cnt;
-}
-
-int bnxt_dev_xstats_get_names_by_id_op(struct rte_eth_dev *dev,
-				struct rte_eth_xstat_name *xstats_names,
-				const uint64_t *ids, unsigned int limit)
-{
-	struct bnxt *bp = dev->data->dev_private;
-	const unsigned int stat_cnt = RTE_DIM(bnxt_rx_stats_strings) +
-				RTE_DIM(bnxt_tx_stats_strings) +
-				RTE_DIM(bnxt_func_stats_strings) +
-				RTE_DIM(bnxt_rx_ext_stats_strings) +
-				RTE_DIM(bnxt_tx_ext_stats_strings) +
-				bnxt_flow_stats_cnt(bp);
-	struct rte_eth_xstat_name xstats_names_copy[stat_cnt];
-	uint16_t i;
-	int rc;
-
-	rc = is_bnxt_in_error(bp);
-	if (rc)
-		return rc;
-
-	if (!ids)
-		return bnxt_dev_xstats_get_names_op(dev, xstats_names,
-						    stat_cnt);
-	bnxt_dev_xstats_get_names_by_id_op(dev, xstats_names_copy, NULL,
-			stat_cnt);
-
-	for (i = 0; i < limit; i++) {
-		if (ids[i] >= stat_cnt) {
-			PMD_DRV_LOG(ERR, "id value isn't valid");
-			return -EINVAL;
-		}
-		strcpy(xstats_names[i].name,
-				xstats_names_copy[ids[i]].name);
-	}
-	return stat_cnt;
-}
-
 /* Update the input context memory with the flow counter IDs
  * of the flows that we are interested in.
  * Also, update the output tables with the current local values
-- 
2.25.4


             reply	other threads:[~2020-06-16 15:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-16 15:36 Ferruh Yigit [this message]
2020-10-21  5:53 ` Ajit Khaparde

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=20200616153613.1071713-1-ferruh.yigit@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=somnath.kotur@broadcom.com \
    --cc=stable@dpdk.org \
    /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).