[dpdk-stable] [PATCH 19.11 1/2] net/hns3: fix Rx/Tx errors stats

Min Hu (Connor) humin29 at huawei.com
Tue Feb 9 04:14:06 CET 2021


From: Huisong Li <lihuisong at 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 at 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



More information about the stable mailing list