DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thierry Herbelot <thierry.herbelot@6wind.com>
To: dev@dpdk.org
Cc: Guo Fengtian <fengtian.guo@6wind.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	stable@dpdk.org, wenzhuo.lu@intel.com,
	konstantin.ananyev@intel.com
Subject: [dpdk-dev] [PATCH 1/1] net/ixgbevf: fix stats update after a PF reset
Date: Wed, 11 Sep 2019 18:00:58 +0200	[thread overview]
Message-ID: <eab62f16c7670d2f1257ef32ecb413cae35c9395.1568216743.git.thierry.herbelot@6wind.com> (raw)
In-Reply-To: <cover.1568216743.git.thierry.herbelot@6wind.com>

From: Guo Fengtian <fengtian.guo@6wind.com>

When PF is set down, in VF, the value of stats register is zero.
So only increase stats when it's non zero.

Fixes: af75078fece3 ('first public release')
Cc: stable@dpdk.org
Cc: wenzhuo.lu@intel.com
Cc: konstantin.ananyev@intel.com

Signed-off-by: Guo Fengtian <fengtian.guo@6wind.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 7eb3d0567b58..27c540f60563 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -385,7 +385,8 @@ static void ixgbe_l2_tunnel_conf(struct rte_eth_dev *dev);
 #define UPDATE_VF_STAT(reg, last, cur)                          \
 {                                                               \
 	uint32_t latest = IXGBE_READ_REG(hw, reg);              \
-	cur += (latest - last) & UINT_MAX;                      \
+	if (latest)                                             \
+		cur += (latest - last) & UINT_MAX;              \
 	last = latest;                                          \
 }
 
@@ -394,7 +395,8 @@ static void ixgbe_l2_tunnel_conf(struct rte_eth_dev *dev);
 	u64 new_lsb = IXGBE_READ_REG(hw, lsb);                   \
 	u64 new_msb = IXGBE_READ_REG(hw, msb);                   \
 	u64 latest = ((new_msb << 32) | new_lsb);                \
-	cur += (0x1000000000LL + latest - last) & 0xFFFFFFFFFLL; \
+	if (latest)                                              \
+		cur += (0x1000000000LL + latest - last) & 0xFFFFFFFFFLL;\
 	last = latest;                                           \
 }
 
-- 
2.20.1


       reply	other threads:[~2019-09-11 16:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1568216743.git.thierry.herbelot@6wind.com>
2019-09-11 16:00 ` Thierry Herbelot [this message]
2019-09-17  3:16   ` Zhang, Qi Z
2019-09-30 10:58     ` Ye Xiaolong
2019-09-30 11:06       ` Thierry Herbelot

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=eab62f16c7670d2f1257ef32ecb413cae35c9395.1568216743.git.thierry.herbelot@6wind.com \
    --to=thierry.herbelot@6wind.com \
    --cc=dev@dpdk.org \
    --cc=fengtian.guo@6wind.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    --cc=wenzhuo.lu@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
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).