DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rasesh Mody <rasesh.mody@cavium.com>
To: dev@dpdk.org
Cc: Rasesh Mody <rasesh.mody@cavium.com>,
	ferruh.yigit@intel.com, Dept-EngDPDKDev@cavium.com,
	stable@dpdk.org
Subject: [dpdk-dev] [PATCH 07/11] net/qede: fix clearing of queue stats
Date: Sat, 27 Jan 2018 13:15:31 -0800	[thread overview]
Message-ID: <1517087735-16191-8-git-send-email-rasesh.mody@cavium.com> (raw)
In-Reply-To: <1517087735-16191-1-git-send-email-rasesh.mody@cavium.com>

Add support to clear the per queue statistics thereby clearing xstats
counters.
Fixes: 7634c5f91569 ("net/qede: add queue statistics")
Cc: stable@dpdk.org

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
---
 drivers/net/qede/qede_ethdev.c |   58 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 895a0da..cab5059 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -387,6 +387,60 @@ static void qede_print_adapter_info(struct qede_dev *qdev)
 	DP_INFO(edev, "*********************************\n");
 }
 
+static void qede_reset_queue_stats(struct qede_dev *qdev, bool xstats)
+{
+	struct ecore_dev *edev = QEDE_INIT_EDEV(qdev);
+	unsigned int i = 0, j = 0, qid;
+	unsigned int rxq_stat_cntrs, txq_stat_cntrs;
+	struct qede_tx_queue *txq;
+
+	DP_VERBOSE(edev, ECORE_MSG_DEBUG, "Clearing queue stats\n");
+
+	rxq_stat_cntrs = RTE_MIN(QEDE_RSS_COUNT(qdev),
+			       RTE_ETHDEV_QUEUE_STAT_CNTRS);
+	txq_stat_cntrs = RTE_MIN(QEDE_TSS_COUNT(qdev),
+			       RTE_ETHDEV_QUEUE_STAT_CNTRS);
+
+	for_each_rss(qid) {
+		OSAL_MEMSET(((char *)(qdev->fp_array[qid].rxq)) +
+			     offsetof(struct qede_rx_queue, rcv_pkts), 0,
+			    sizeof(uint64_t));
+		OSAL_MEMSET(((char *)(qdev->fp_array[qid].rxq)) +
+			     offsetof(struct qede_rx_queue, rx_hw_errors), 0,
+			    sizeof(uint64_t));
+		OSAL_MEMSET(((char *)(qdev->fp_array[qid].rxq)) +
+			     offsetof(struct qede_rx_queue, rx_alloc_errors), 0,
+			    sizeof(uint64_t));
+
+		if (xstats)
+			for (j = 0; j < RTE_DIM(qede_rxq_xstats_strings); j++)
+				OSAL_MEMSET((((char *)
+					      (qdev->fp_array[qid].rxq)) +
+					     qede_rxq_xstats_strings[j].offset),
+					    0,
+					    sizeof(uint64_t));
+
+		i++;
+		if (i == rxq_stat_cntrs)
+			break;
+	}
+
+	i = 0;
+
+	for_each_tss(qid) {
+		txq = qdev->fp_array[qid].txq;
+
+		OSAL_MEMSET((uint64_t *)(uintptr_t)
+				(((uint64_t)(uintptr_t)(txq)) +
+				 offsetof(struct qede_tx_queue, xmit_pkts)), 0,
+			    sizeof(uint64_t));
+
+		i++;
+		if (i == txq_stat_cntrs)
+			break;
+	}
+}
+
 static int
 qede_start_vport(struct qede_dev *qdev, uint16_t mtu)
 {
@@ -412,6 +466,8 @@ static void qede_print_adapter_info(struct qede_dev *qdev)
 		}
 	}
 	ecore_reset_vport_stats(edev);
+	if (IS_PF(edev))
+		qede_reset_queue_stats(qdev, true);
 	DP_INFO(edev, "VPORT started with MTU = %u\n", mtu);
 
 	return 0;
@@ -1885,6 +1941,7 @@ static void qede_dev_close(struct rte_eth_dev *eth_dev)
 	struct ecore_dev *edev = &qdev->edev;
 
 	ecore_reset_vport_stats(edev);
+	qede_reset_queue_stats(qdev, true);
 }
 
 int qede_dev_set_link_state(struct rte_eth_dev *eth_dev, bool link_up)
@@ -1920,6 +1977,7 @@ static void qede_reset_stats(struct rte_eth_dev *eth_dev)
 	struct ecore_dev *edev = &qdev->edev;
 
 	ecore_reset_vport_stats(edev);
+	qede_reset_queue_stats(qdev, false);
 }
 
 static void qede_allmulticast_enable(struct rte_eth_dev *eth_dev)
-- 
1.7.10.3

  parent reply	other threads:[~2018-01-27 21:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-27 21:15 [dpdk-dev] [PATCH 00/11] net/qede: update PMD version to 2.7.0.1 Rasesh Mody
2018-01-27 21:15 ` [dpdk-dev] [PATCH 01/11] net/qede/base: fix VF LRO tunnel params configuration Rasesh Mody
2018-01-27 21:15 ` [dpdk-dev] [PATCH 02/11] net/qede: initialize VF tunnel as enabled on start Rasesh Mody
2018-01-27 21:15 ` [dpdk-dev] [PATCH 03/11] net/qede: fix to check if tunnel L3 header is valid Rasesh Mody
2018-01-27 21:15 ` [dpdk-dev] [PATCH 04/11] net/qede: fix tunnel header size in Tx BD configuration Rasesh Mody
2018-01-27 21:15 ` [dpdk-dev] [PATCH 05/11] net/qede: remove DEBUG INFO config option Rasesh Mody
2018-01-27 21:15 ` [dpdk-dev] [PATCH 06/11] net/qede: fix MTU set and max Rx pkt len usage Rasesh Mody
2018-01-27 21:15 ` Rasesh Mody [this message]
2018-01-27 21:15 ` [dpdk-dev] [PATCH 08/11] doc: update qede guide Rasesh Mody
2018-01-27 21:15 ` [dpdk-dev] [PATCH 09/11] doc: update bnx2x guide Rasesh Mody
2018-01-27 21:15 ` [dpdk-dev] [PATCH 10/11] net/qede: add check for null return value Rasesh Mody
2018-01-27 21:15 ` [dpdk-dev] [PATCH 11/11] net/qede: update PMD version Rasesh Mody
2018-01-29 10:15 ` [dpdk-dev] [PATCH 00/11] net/qede: update PMD version to 2.7.0.1 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=1517087735-16191-8-git-send-email-rasesh.mody@cavium.com \
    --to=rasesh.mody@cavium.com \
    --cc=Dept-EngDPDKDev@cavium.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=stable@dpdk.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).