DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Min Hu (Connor)" <humin29@huawei.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@intel.com>
Subject: [dpdk-dev] [PATCH 7/9] net/hns3: support oerrors stats in PF
Date: Wed, 10 Mar 2021 14:24:51 +0800
Message-ID: <1615357493-42394-8-git-send-email-humin29@huawei.com> (raw)
In-Reply-To: <1615357493-42394-1-git-send-email-humin29@huawei.com>

This patch added oerrors stats for PF in kunpeng930.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.h |  1 +
 drivers/net/hns3/hns3_stats.c  | 61 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+)

diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index 915f183..586979b 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -443,6 +443,7 @@ struct hns3_hw {
 	/* Include Mac stats | Rx stats | Tx stats */
 	struct hns3_mac_stats mac_stats;
 	struct hns3_rx_missed_stats imissed_stats;
+	uint64_t oerror_stats;
 	uint32_t fw_version;
 
 	uint16_t num_msi;
diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c
index ccad477..e0378dd 100644
--- a/drivers/net/hns3/hns3_stats.c
+++ b/drivers/net/hns3/hns3_stats.c
@@ -518,6 +518,29 @@ hns3_update_port_rx_ssu_drop_stats(struct hns3_hw *hw)
 	return 0;
 }
 
+static int
+hns3_update_port_tx_ssu_drop_stats(struct hns3_hw *hw)
+{
+	struct hns3_cmd_desc desc[HNS3_OPC_SSU_DROP_REG_NUM];
+	struct hns3_query_ssu_cmd *req;
+	uint64_t cnt;
+	int ret;
+
+	ret = hns3_get_ssu_drop_stats(hw, desc, HNS3_OPC_SSU_DROP_REG_NUM,
+				      false);
+	if (ret) {
+		hns3_err(hw, "failed to get Tx SSU drop stats, ret = %d", ret);
+		return ret;
+	}
+
+	req = (struct hns3_query_ssu_cmd *)desc[0].data;
+	cnt = rte_le_to_cpu_32(req->oq_glb_drop_cnt);
+
+	hw->oerror_stats += cnt;
+
+	return 0;
+}
+
 int
 hns3_update_imissed_stats(struct hns3_hw *hw, bool is_clear)
 {
@@ -543,6 +566,25 @@ hns3_update_imissed_stats(struct hns3_hw *hw, bool is_clear)
 	return 0;
 }
 
+static int
+hns3_update_oerror_stats(struct hns3_hw *hw, bool is_clear)
+{
+	struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw);
+	int ret;
+
+	if (hw->drop_stats_mode == HNS3_PKTS_DROP_STATS_MODE1 || hns->is_vf)
+		return 0;
+
+	ret = hns3_update_port_tx_ssu_drop_stats(hw);
+	if (ret)
+		return ret;
+
+	if (is_clear)
+		hw->oerror_stats = 0;
+
+	return 0;
+}
+
 /*
  * Query tqp tx queue statistics ,opcode id: 0x0B03.
  * Query tqp rx queue statistics ,opcode id: 0x0B13.
@@ -577,6 +619,14 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats)
 	rte_stats->imissed = imissed_stats->rpu_rx_drop_cnt +
 				imissed_stats->ssu_rx_drop_cnt;
 
+	ret = hns3_update_oerror_stats(hw, false);
+	if (ret) {
+		hns3_err(hw, "update oerror stats failed, ret = %d",
+			 ret);
+		return ret;
+	}
+	rte_stats->oerrors = hw->oerror_stats;
+
 	/* Get the error stats and bytes of received packets */
 	for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
 		rxq = eth_dev->data->rx_queues[i];
@@ -643,6 +693,17 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev)
 		return ret;
 	}
 
+	/*
+	 * Note: Reading hardware statistics of oerror registers will
+	 * clear them.
+	 */
+	ret = hns3_update_oerror_stats(hw, true);
+	if (ret) {
+		hns3_err(hw, "clear oerror stats failed, ret = %d",
+			 ret);
+		return ret;
+	}
+
 	for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
 		rxq = eth_dev->data->rx_queues[i];
 		if (rxq == NULL)
-- 
2.7.4


  parent reply	other threads:[~2021-03-10  6:24 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10  6:24 [dpdk-dev] [PATCH 0/9] features and bugfixes for hns3 Min Hu (Connor)
2021-03-10  6:24 ` [dpdk-dev] [PATCH 1/9] net/hns3: support runtime config to select IO burst func Min Hu (Connor)
2021-03-10  6:24 ` [dpdk-dev] [PATCH 2/9] net/hns3: support Tx push quick doorbell to improve perf Min Hu (Connor)
2021-03-10  6:24 ` [dpdk-dev] [PATCH 3/9] net/hns3: support for outer UDP cksum Min Hu (Connor)
2021-03-10  6:24 ` [dpdk-dev] [PATCH 4/9] net/hns3: adjust the format of RAS related structures Min Hu (Connor)
2021-03-10  6:24 ` [dpdk-dev] [PATCH 5/9] net/hns3: delete redundant xstats RAS statistics Min Hu (Connor)
2021-03-10  6:24 ` [dpdk-dev] [PATCH 6/9] net/hns3: support imissed stats for PF/VF Min Hu (Connor)
2021-03-10  6:24 ` Min Hu (Connor) [this message]
2021-03-10  6:24 ` [dpdk-dev] [PATCH 8/9] net/hns3: support query Tx descriptor status Min Hu (Connor)
2021-03-10  6:24 ` [dpdk-dev] [PATCH 9/9] net/hns3: support query Rx " Min Hu (Connor)
2021-03-17  9:50 ` [dpdk-dev] [PATCH v4 0/8] features and bugfixes for hns3 Min Hu (Connor)
2021-03-17  9:50   ` [dpdk-dev] [PATCH v4 1/8] net/hns3: support runtime config to select IO burst func Min Hu (Connor)
2021-03-17  9:50   ` [dpdk-dev] [PATCH v4 2/8] net/hns3: support for outer UDP cksum Min Hu (Connor)
2021-03-17  9:50   ` [dpdk-dev] [PATCH v4 3/8] net/hns3: adjust the format of RAS related structures Min Hu (Connor)
2021-03-17  9:50   ` [dpdk-dev] [PATCH v4 4/8] net/hns3: delete redundant xstats RAS statistics Min Hu (Connor)
2021-03-17  9:50   ` [dpdk-dev] [PATCH v4 5/8] net/hns3: support imissed stats for PF/VF Min Hu (Connor)
2021-03-17  9:50   ` [dpdk-dev] [PATCH v4 6/8] net/hns3: support oerrors stats in PF Min Hu (Connor)
2021-03-17  9:50   ` [dpdk-dev] [PATCH v4 7/8] net/hns3: support query Tx descriptor status Min Hu (Connor)
2021-03-17  9:50   ` [dpdk-dev] [PATCH v4 8/8] net/hns3: support query Rx " Min Hu (Connor)
2021-03-19  1:07 ` [dpdk-dev] [PATCH v5 0/8] features and bugfixes for hns3 Min Hu (Connor)
2021-03-19  1:07   ` [dpdk-dev] [PATCH v5 1/8] net/hns3: support runtime config to select IO burst func Min Hu (Connor)
2021-03-22 13:58     ` Ferruh Yigit
2021-03-22 14:03       ` Ferruh Yigit
2021-03-23  3:31       ` fengchengwen
2021-03-23 10:31         ` Ferruh Yigit
2021-03-23 11:22           ` Min Hu (Connor)
2021-03-23  3:37       ` fengchengwen
2021-03-19  1:07   ` [dpdk-dev] [PATCH v5 2/8] net/hns3: support for outer UDP cksum Min Hu (Connor)
2021-03-19  1:07   ` [dpdk-dev] [PATCH v5 3/8] net/hns3: adjust the format of RAS related structures Min Hu (Connor)
2021-03-19  1:07   ` [dpdk-dev] [PATCH v5 4/8] net/hns3: delete redundant xstats RAS statistics Min Hu (Connor)
2021-03-19  1:07   ` [dpdk-dev] [PATCH v5 5/8] net/hns3: support imissed stats for PF/VF Min Hu (Connor)
2021-03-19  1:07   ` [dpdk-dev] [PATCH v5 6/8] net/hns3: support oerrors stats in PF Min Hu (Connor)
2021-03-19  1:07   ` [dpdk-dev] [PATCH v5 7/8] net/hns3: support query Tx descriptor status Min Hu (Connor)
2021-03-19  1:07   ` [dpdk-dev] [PATCH v5 8/8] net/hns3: support query Rx " Min Hu (Connor)
2021-03-23 11:20 ` [dpdk-dev] [PATCH v6 0/8] features and bugfixes for hns3 Min Hu (Connor)
2021-03-23 11:21   ` [dpdk-dev] [PATCH v6 1/8] net/hns3: support runtime config to select IO burst func Min Hu (Connor)
2021-03-23 11:21   ` [dpdk-dev] [PATCH v6 2/8] net/hns3: support for outer UDP cksum Min Hu (Connor)
2021-03-23 11:21   ` [dpdk-dev] [PATCH v6 3/8] net/hns3: adjust the format of RAS related structures Min Hu (Connor)
2021-03-23 11:21   ` [dpdk-dev] [PATCH v6 4/8] net/hns3: delete redundant xstats RAS statistics Min Hu (Connor)
2021-03-23 11:21   ` [dpdk-dev] [PATCH v6 5/8] net/hns3: support imissed stats for PF/VF Min Hu (Connor)
2021-03-23 11:21   ` [dpdk-dev] [PATCH v6 6/8] net/hns3: support oerrors stats in PF Min Hu (Connor)
2021-03-23 11:21   ` [dpdk-dev] [PATCH v6 7/8] net/hns3: support query Tx descriptor status Min Hu (Connor)
2021-03-23 11:21   ` [dpdk-dev] [PATCH v6 8/8] net/hns3: support query Rx " Min Hu (Connor)
2021-03-23 12:49   ` [dpdk-dev] [PATCH v6 0/8] features and 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=1615357493-42394-8-git-send-email-humin29@huawei.com \
    --to=humin29@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