DPDK patches and discussions
 help / color / mirror / Atom feed
From: Harry van Haaren <harry.van.haaren@intel.com>
To: konstantin.ananyev@intel.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] ixgbe: fix tx_bytes statistic with link down
Date: Tue,  1 Dec 2015 10:25:40 +0000	[thread overview]
Message-ID: <1448965540-18953-1-git-send-email-harry.van.haaren@intel.com> (raw)

This patch fixes tx byte statistics when transmitting packets
with link down.

Previously, the counter would decrement 4 bytes for each packet that
was transmitted with link down, causing the uint64 to wrap around.

Fixes: c03fcee9abbd ("ixgbe: remove CRC size from byte counters")

Reported-by: Michael Qiu <michael.qiu@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 808ac69..1b6cd8e 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -2341,7 +2341,6 @@ ixgbe_read_stats_registers(struct ixgbe_hw *hw,
 {
 	uint32_t bprc, lxon, lxoff, total;
 	uint32_t delta_gprc = 0;
-	uint32_t delta_gptc = 0;
 	unsigned i;
 	/* Workaround for RX byte count not including CRC bytes when CRC
 +	 * strip is enabled. CRC bytes are removed from counters when crc_strip
@@ -2388,7 +2387,6 @@ ixgbe_read_stats_registers(struct ixgbe_hw *hw,
 		uint32_t delta_qprdc = IXGBE_READ_REG(hw, IXGBE_QPRDC(i));
 
 		delta_gprc += delta_qprc;
-		delta_gptc += delta_qptc;
 
 		hw_stats->qprc[i] += delta_qprc;
 		hw_stats->qptc[i] += delta_qptc;
@@ -2444,6 +2442,8 @@ ixgbe_read_stats_registers(struct ixgbe_hw *hw,
 	if (crc_strip == 0)
 		hw_stats->gorc -= delta_gprc * ETHER_CRC_LEN;
 
+	uint64_t delta_gptc = IXGBE_READ_REG(hw, IXGBE_GPTC);
+	hw_stats->gptc += delta_gptc;
 	hw_stats->gotc -= delta_gptc * ETHER_CRC_LEN;
 	hw_stats->tor -= (hw_stats->tpr - old_tpr) * ETHER_CRC_LEN;
 
@@ -2470,7 +2470,6 @@ ixgbe_read_stats_registers(struct ixgbe_hw *hw,
 	hw_stats->lxofftxc += lxoff;
 	total = lxon + lxoff;
 
-	hw_stats->gptc += IXGBE_READ_REG(hw, IXGBE_GPTC);
 	hw_stats->mptc += IXGBE_READ_REG(hw, IXGBE_MPTC);
 	hw_stats->ptc64 += IXGBE_READ_REG(hw, IXGBE_PTC64);
 	hw_stats->gptc -= total;
-- 
1.9.1

             reply	other threads:[~2015-12-01 10:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-01 10:25 Harry van Haaren [this message]
2015-12-01 10:43 ` De Lara Guarch, Pablo
2015-12-06 21:24   ` 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=1448965540-18953-1-git-send-email-harry.van.haaren@intel.com \
    --to=harry.van.haaren@intel.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@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).