DPDK patches and discussions
 help / color / mirror / Atom feed
From: Harry van Haaren <harry.van.haaren@intel.com>
To: dev@dpdk.org
Cc: Harry van Haaren <harry.van.haaren@gmail.com>
Subject: [dpdk-dev] [PATCH v2] i40e: fix resetting of stats
Date: Thu,  5 Nov 2015 12:56:29 +0000	[thread overview]
Message-ID: <1446728189-24418-1-git-send-email-harry.van.haaren@intel.com> (raw)
In-Reply-To: <1446727941-17018-1-git-send-email-harry.van.haaren@intel.com>

This patch fixes a bug where only some of the statistics were being reset
when calling rte_eth_stats_reset() or rte_eth_xstats_reset().

This patch marks the VSI to update its offset, causing the stats be look
like they are reset.

Fixes: 9aace75fc82e ("i40e: fix statistics")

Signed-off-by: Harry van Haaren <harry.van.haaren@gmail.com>
---

v2: Remove commented code

 drivers/net/i40e/i40e_ethdev.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index a39bd28..7e18ba7 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2129,14 +2129,14 @@ i40e_dev_xstats_reset(struct rte_eth_dev *dev)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct i40e_hw_port_stats *hw_stats = &pf->stats;
 
-	/* The hw registers are cleared on read */
+	/* Mark PF and VSI stats to update the offset, aka "reset" */
 	pf->offset_loaded = false;
-	i40e_read_stats_registers(pf, hw);
+	if (pf->main_vsi)
+		pf->main_vsi->offset_loaded = false;
 
-	/* reset software counters */
-	memset(hw_stats, 0, sizeof(*hw_stats));
+	/* read the stats, reading current register values into offset */
+	i40e_read_stats_registers(pf, hw);
 }
 
 static int
-- 
1.9.1

  reply	other threads:[~2015-11-05 12:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-05 12:52 [dpdk-dev] [PATCH] " Harry van Haaren
2015-11-05 12:56 ` Harry van Haaren [this message]
2015-11-08  7:40   ` [dpdk-dev] [PATCH v2] " Tahhan, Maryam
2015-11-09 10:13   ` [dpdk-dev] [PATCH v3] " Harry van Haaren
2015-11-09 10:22     ` Harry van Haaren
2015-11-10 16:45       ` Thomas Monjalon

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=1446728189-24418-1-git-send-email-harry.van.haaren@intel.com \
    --to=harry.van.haaren@intel.com \
    --cc=dev@dpdk.org \
    --cc=harry.van.haaren@gmail.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
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).