DPDK patches and discussions
 help / color / mirror / Atom feed
From: Zhe Tao <zhe.tao@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] i40e: Fix the issue when resetting the stats for i40e, the stats information will be lost before next time getting the stats
Date: Thu,  9 Jul 2015 14:09:00 +0800	[thread overview]
Message-ID: <1436422141-29024-1-git-send-email-zhe.tao@intel.com> (raw)

Issue: When calling the reset API to reset all the stats for i40e,
all the stats will be untracked before the next time calling get stats API.
Once calling the get stats API it will show all the stats equal zero.

Changes: Calling the get stats API in the reset API will force the stats_offset update immediately  

Signed-off-by: Zhe Tao <zhe.tao@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 5fb6b4c..c9cc317 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1517,9 +1517,17 @@ static void
 i40e_dev_stats_reset(struct rte_eth_dev *dev)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct rte_eth_stats stat = {0};
 
 	/* It results in reloading the start point of each counter */
 	pf->offset_loaded = false;
+
+	/*
+	* need to read the status one time right after reset the offset_loaded field
+	* prevent the stats data loss between the i40e_dev_stats_reset and i40e_dev_stats_get
+	*/
+
+	i40e_dev_stats_get(dev, &stat);
 }
 
 static int
-- 
1.9.3

             reply	other threads:[~2015-07-09  6:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-09  6:09 Zhe Tao [this message]
2015-08-03 16:48 ` Thomas Monjalon
2015-08-03 17:35 ` Zhang, Helin

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=1436422141-29024-1-git-send-email-zhe.tao@intel.com \
    --to=zhe.tao@intel.com \
    --cc=dev@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).