DPDK patches and discussions
 help / color / mirror / Atom feed
From: Lijun Ou <oulijun@huawei.com>
To: <ferruh.yigit@intel.com>
Cc: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH v2 4/6] net/hns3: fix Rx/Tx abnormal errors stats
Date: Wed, 6 Jan 2021 11:46:30 +0800
Message-ID: <1609904792-63280-5-git-send-email-oulijun@huawei.com> (raw)
In-Reply-To: <1609904792-63280-1-git-send-email-oulijun@huawei.com>

From: Huisong Li <lihuisong@huawei.com>

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: c4b7d6761d01 ("net/hns3: get Tx abnormal errors in xstats")
Fixes: 521ab3e93361 ("net/hns3: add simple Rx path")
Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
---
 drivers/net/hns3/hns3_stats.c | 59 ++++++++++++++++++++++++++++---------------
 1 file changed, 39 insertions(+), 20 deletions(-)

diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c
index 42ec9b8..62a712b 100644
--- a/drivers/net/hns3/hns3_stats.c
+++ b/drivers/net/hns3/hns3_stats.c
@@ -551,7 +551,6 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev)
 	struct hns3_hw *hw = &hns->hw;
 	struct hns3_cmd_desc desc_reset;
 	struct hns3_rx_queue *rxq;
-	struct hns3_tx_queue *txq;
 	uint16_t i;
 	int ret;
 
@@ -581,29 +580,15 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev)
 		}
 	}
 
-	/* Clear the Rx BD errors stats */
-	for (i = 0; i != eth_dev->data->nb_rx_queues; ++i) {
+	/*
+	 * 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_errors = 0;
-			rxq->l4_csum_errors = 0;
-			rxq->ol3_csum_errors = 0;
-			rxq->ol4_csum_errors = 0;
-		}
-	}
-
-	/* Clear the Tx errors stats */
-	for (i = 0; i != eth_dev->data->nb_tx_queues; ++i) {
-		txq = eth_dev->data->tx_queues[i];
-		if (txq) {
-			txq->over_length_pkt_cnt = 0;
-			txq->exceed_limit_bd_pkt_cnt = 0;
-			txq->exceed_limit_bd_reassem_fail = 0;
-			txq->unsupported_tunnel_pkt_cnt = 0;
-			txq->queue_full_cnt = 0;
-			txq->pkt_padding_fail_cnt = 0;
 		}
 	}
 
@@ -1053,6 +1038,38 @@ hns3_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
 	return size;
 }
 
+static void
+hns3_tqp_dfx_stats_clear(struct rte_eth_dev *dev)
+{
+	struct hns3_rx_queue *rxq;
+	struct hns3_tx_queue *txq;
+	int i;
+
+	/* Clear Rx dfx stats */
+	for (i = 0; i < dev->data->nb_rx_queues; ++i) {
+		rxq = dev->data->rx_queues[i];
+		if (rxq) {
+			rxq->l3_csum_errors = 0;
+			rxq->l4_csum_errors = 0;
+			rxq->ol3_csum_errors = 0;
+			rxq->ol4_csum_errors = 0;
+		}
+	}
+
+	/* Clear Tx dfx stats */
+	for (i = 0; i < dev->data->nb_tx_queues; ++i) {
+		txq = dev->data->tx_queues[i];
+		if (txq) {
+			txq->over_length_pkt_cnt = 0;
+			txq->exceed_limit_bd_pkt_cnt = 0;
+			txq->exceed_limit_bd_reassem_fail = 0;
+			txq->unsupported_tunnel_pkt_cnt = 0;
+			txq->queue_full_cnt = 0;
+			txq->pkt_padding_fail_cnt = 0;
+		}
+	}
+}
+
 int
 hns3_dev_xstats_reset(struct rte_eth_dev *dev)
 {
@@ -1068,6 +1085,8 @@ hns3_dev_xstats_reset(struct rte_eth_dev *dev)
 	/* Clear reset stats */
 	memset(&hns->hw.reset.stats, 0, sizeof(struct hns3_reset_stats));
 
+	hns3_tqp_dfx_stats_clear(dev);
+
 	if (hns->is_vf)
 		return 0;
 
-- 
2.7.4


  parent reply	other threads:[~2021-01-06  3:47 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-13  8:02 [dpdk-dev] [PATCH 0/7] some bugfixes for hns3 Lijun Ou
2020-12-13  8:02 ` [dpdk-dev] [PATCH 1/7] net/hns3: fix incorrect interception with filter director Lijun Ou
2020-12-13  8:03 ` [dpdk-dev] [PATCH 2/7] net/hns3: fix xstats statistics with id Lijun Ou
2020-12-17 15:20   ` Ferruh Yigit
2020-12-18  7:06     ` oulijun
2020-12-18 13:34       ` Ferruh Yigit
2020-12-13  8:03 ` [dpdk-dev] [PATCH 3/7] net/hns3: fix abnormal return value in xstats Lijun Ou
2020-12-13  8:03 ` [dpdk-dev] [PATCH 4/7] net/hns3: fix Rx/Tx abnormal errors stats Lijun Ou
2020-12-13  8:03 ` [dpdk-dev] [PATCH 5/7] net/hns3: fix location of saving ethdev Lijun Ou
2020-12-18 14:11   ` Ferruh Yigit
2020-12-13  8:03 ` [dpdk-dev] [PATCH 6/7] net/hns3: fix directly access with rte device Lijun Ou
2020-12-13  8:03 ` [dpdk-dev] [PATCH 7/7] net/hns3: remove unnecessary memset Lijun Ou
2021-01-06  3:46 ` [dpdk-dev] [PATCH v2 0/6] some bugfixes for hns3 Lijun Ou
2021-01-06  3:46   ` [dpdk-dev] [PATCH v2 1/6] net/hns3: fix incorrect interception with filter director Lijun Ou
2021-01-19 21:27     ` Thomas Monjalon
2021-01-06  3:46   ` [dpdk-dev] [PATCH v2 2/6] net/hns3: fix xstats statistics with id and names Lijun Ou
2021-01-06  3:46   ` [dpdk-dev] [PATCH v2 3/6] net/hns3: fix abnormal return value in xstats Lijun Ou
2021-01-06  3:46   ` Lijun Ou [this message]
2021-01-06  3:46   ` [dpdk-dev] [PATCH v2 5/6] net/hns3: fix crash with multi-process Lijun Ou
2021-01-06  3:46   ` [dpdk-dev] [PATCH v2 6/6] net/hns3: remove unnecessary memset Lijun Ou
2021-01-14 23:34   ` [dpdk-dev] [PATCH v2 0/6] some bugfixes for hns3 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=1609904792-63280-5-git-send-email-oulijun@huawei.com \
    --to=oulijun@huawei.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/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 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

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


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