patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 19.11 0/2] backport stats fix
@ 2021-02-09  3:14 Min Hu (Connor)
  2021-02-09  3:14 ` [dpdk-stable] [PATCH 19.11 1/2] net/hns3: fix Rx/Tx errors stats Min Hu (Connor)
  2021-02-09  3:14 ` [dpdk-stable] [[PATCH 19.11 2/2] net/hns3: fix xstats with id and names Min Hu (Connor)
  0 siblings, 2 replies; 3+ messages in thread
From: Min Hu (Connor) @ 2021-02-09  3:14 UTC (permalink / raw)
  To: stable; +Cc: suanmingm, ferruh.yigit

From: Huisong Li <lihuisong@huawei.com>

Huisong Li (2):
  net/hns3: fix Rx/Tx errors stats
  net/hns3: fix xstats with id and names

 drivers/net/hns3/hns3_stats.c | 46 ++++++++++++++++++++++++++++++++++++-------
 drivers/net/hns3/hns3_stats.h |  4 ++--
 2 files changed, 41 insertions(+), 9 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dpdk-stable] [PATCH 19.11 1/2] net/hns3: fix Rx/Tx errors stats
  2021-02-09  3:14 [dpdk-stable] [PATCH 19.11 0/2] backport stats fix Min Hu (Connor)
@ 2021-02-09  3:14 ` Min Hu (Connor)
  2021-02-09  3:14 ` [dpdk-stable] [[PATCH 19.11 2/2] net/hns3: fix xstats with id and names Min Hu (Connor)
  1 sibling, 0 replies; 3+ messages in thread
From: Min Hu (Connor) @ 2021-02-09  3:14 UTC (permalink / raw)
  To: stable; +Cc: suanmingm, ferruh.yigit

From: Huisong Li <lihuisong@huawei.com>

[ upstream commit ec12dc5a554ab4f8dd8a90cab54426dfa685ba80 ]

Abnormal errors stats in Rx/Tx datapath are statistics
items in driver, and displayed in xstats. They should
be cleared by the rte_eth_xstats_reset api, instead of
the rte_eth_stats_reset.

Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations")
Cc: stable@dpdk.org
---
 drivers/net/hns3/hns3_stats.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c
index 10cc757..4cf5e8f 100644
--- a/drivers/net/hns3/hns3_stats.c
+++ b/drivers/net/hns3/hns3_stats.c
@@ -505,16 +505,15 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev)
 		}
 	}
 
-	/* Clear Rx BD and Tx error stats */
+	/*
+	 * Clear soft stats of rx error packet which will be dropped
+	 * in driver.
+	 */
 	for (i = 0; i != eth_dev->data->nb_rx_queues; ++i) {
 		rxq = eth_dev->data->rx_queues[i];
 		if (rxq) {
 			rxq->pkt_len_errors = 0;
 			rxq->l2_errors = 0;
-			rxq->l3_csum_erros = 0;
-			rxq->l4_csum_erros = 0;
-			rxq->ol3_csum_erros = 0;
-			rxq->ol4_csum_erros = 0;
 		}
 	}
 
@@ -914,7 +913,9 @@ hns3_dev_xstats_reset(struct rte_eth_dev *dev)
 {
 	struct hns3_adapter *hns = dev->data->dev_private;
 	struct hns3_pf *pf = &hns->pf;
+	struct hns3_rx_queue *rxq;
 	int ret;
+	int i;
 
 	/* Clear tqp stats */
 	ret = hns3_stats_reset(dev);
@@ -924,6 +925,17 @@ hns3_dev_xstats_reset(struct rte_eth_dev *dev)
 	/* Clear reset stats */
 	memset(&hns->hw.reset.stats, 0, sizeof(struct hns3_reset_stats));
 
+	/* Clear Rx checksum error stats */
+	for (i = 0; i < dev->data->nb_rx_queues; ++i) {
+		rxq = dev->data->rx_queues[i];
+		if (rxq) {
+			rxq->l3_csum_erros = 0;
+			rxq->l4_csum_erros = 0;
+			rxq->ol3_csum_erros = 0;
+			rxq->ol4_csum_erros = 0;
+		}
+	}
+
 	if (hns->is_vf)
 		return 0;
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dpdk-stable] [[PATCH 19.11 2/2] net/hns3: fix xstats with id and names
  2021-02-09  3:14 [dpdk-stable] [PATCH 19.11 0/2] backport stats fix Min Hu (Connor)
  2021-02-09  3:14 ` [dpdk-stable] [PATCH 19.11 1/2] net/hns3: fix Rx/Tx errors stats Min Hu (Connor)
@ 2021-02-09  3:14 ` Min Hu (Connor)
  1 sibling, 0 replies; 3+ messages in thread
From: Min Hu (Connor) @ 2021-02-09  3:14 UTC (permalink / raw)
  To: stable; +Cc: suanmingm, ferruh.yigit

From: Huisong Li <lihuisong@huawei.com>

[ upstream commit 3213d584b698f41dbef14599a41ab0a7a78739b4 ]

Currently, validity check for ids and values in the
hns3_dev_xstats_get_by_id API is incorrect, which will
cause a problem. Namely, if the ID range of the xstats
stats item does not include the basic stats item, the
app can not obtain the corresponding xstats statistics
in hns3_dev_xstats_get_by_id.

Similarly, the hns3_dev_xstats_get_names_by_id interface
also has a problem.

Although the input parameter verification code cannot be
executed due to the implementation of the ethdev framework
interface, the driver needs to ensure the correctness of
the input parameters.

Fixes: 8839c5e202f3 ("net/hns3: support device stats")
Cc: stable@dpdk.org
---
 drivers/net/hns3/hns3_stats.c | 24 ++++++++++++++++++++++--
 drivers/net/hns3/hns3_stats.h |  4 ++--
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c
index 4cf5e8f..571e8b4 100644
--- a/drivers/net/hns3/hns3_stats.c
+++ b/drivers/net/hns3/hns3_stats.c
@@ -754,9 +754,13 @@ hns3_dev_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
 	char *addr;
 	int ret;
 
-	if (ids == NULL || size < cnt_stats)
+	if (ids == NULL && values == NULL)
 		return cnt_stats;
 
+	if (ids == NULL)
+		if (size < cnt_stats)
+			return cnt_stats;
+
 	/* Update tqp stats by read register */
 	ret = hns3_update_tqp_stats(hw);
 	if (ret) {
@@ -804,6 +808,15 @@ hns3_dev_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
 		}
 	}
 
+	if (ids == NULL && values != NULL) {
+		for (i = 0; i < cnt_stats; i++)
+			memcpy(&values[i], &values_copy[i], sizeof(values[i]));
+
+		rte_free(values_copy);
+
+		return cnt_stats;
+	}
+
 	for (i = 0; i < size; i++) {
 		if (ids[i] >= cnt_stats) {
 			hns3_err(hw, "ids[%d] (%" PRIx64 ") is invalid, "
@@ -852,9 +865,16 @@ hns3_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
 	uint16_t i, j;
 	uint64_t len;
 
-	if (ids == NULL || xstats_names == NULL)
+	if (xstats_names == NULL)
 		return cnt_stats;
 
+	if (ids == NULL) {
+		if (size < cnt_stats)
+			return cnt_stats;
+
+		return hns3_dev_xstats_get_names(dev, xstats_names, cnt_stats);
+	}
+
 	len = cnt_stats * sizeof(struct rte_eth_xstat_name);
 	xstats_names_copy = rte_zmalloc("hns3_xstats_names", len, 0);
 	if (xstats_names_copy == NULL) {
diff --git a/drivers/net/hns3/hns3_stats.h b/drivers/net/hns3/hns3_stats.h
index 365bae0..34c76be 100644
--- a/drivers/net/hns3/hns3_stats.h
+++ b/drivers/net/hns3/hns3_stats.h
@@ -141,8 +141,8 @@ int hns3_dev_xstats_get_names(__rte_unused 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,
-			      __rte_unused const uint64_t *ids,
-			      __rte_unused uint64_t *values,
+			      const uint64_t *ids,
+			      uint64_t *values,
 			      uint32_t size);
 int hns3_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
 				    struct rte_eth_xstat_name *xstats_names,
-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-09  3:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-09  3:14 [dpdk-stable] [PATCH 19.11 0/2] backport stats fix Min Hu (Connor)
2021-02-09  3:14 ` [dpdk-stable] [PATCH 19.11 1/2] net/hns3: fix Rx/Tx errors stats Min Hu (Connor)
2021-02-09  3:14 ` [dpdk-stable] [[PATCH 19.11 2/2] net/hns3: fix xstats with id and names Min Hu (Connor)

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git