From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (xvm-189-124.dc0.ghst.net [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 75540A09FF; Wed, 6 Jan 2021 04:47:17 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5A7A11608AA; Wed, 6 Jan 2021 04:46:57 +0100 (CET) Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by mails.dpdk.org (Postfix) with ESMTP id F3C2216088E for ; Wed, 6 Jan 2021 04:46:51 +0100 (CET) Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4D9Zyr0F3Sz7Qp5 for ; Wed, 6 Jan 2021 11:45:56 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.498.0; Wed, 6 Jan 2021 11:46:46 +0800 From: Lijun Ou To: CC: Date: Wed, 6 Jan 2021 11:46:30 +0800 Message-ID: <1609904792-63280-5-git-send-email-oulijun@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1609904792-63280-1-git-send-email-oulijun@huawei.com> References: <1607846585-2381-1-git-send-email-oulijun@huawei.com> <1609904792-63280-1-git-send-email-oulijun@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH v2 4/6] net/hns3: fix Rx/Tx abnormal errors stats X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Huisong Li 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 Signed-off-by: Lijun Ou --- 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