From: Harry van Haaren <harry.van.haaren@intel.com>
To: dev@dpdk.org
Cc: shemming@brocade.com
Subject: [dpdk-dev] [PATCH 1/4] e1000: remove crc size from all byte counters
Date: Mon, 16 Nov 2015 10:35:14 +0000 [thread overview]
Message-ID: <1447670117-17723-2-git-send-email-harry.van.haaren@intel.com> (raw)
In-Reply-To: <1447670117-17723-1-git-send-email-harry.van.haaren@intel.com>
This patch removes the crc bytes from byte counter statistics.
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
---
drivers/net/e1000/igb_ethdev.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 88995b0..0ad7341 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -1480,6 +1480,13 @@ igb_read_stats_registers(struct e1000_hw *hw, struct e1000_hw_stats *stats)
{
int pause_frames;
+ uint64_t old_gprc = stats->gprc;
+ uint64_t old_gptc = stats->gptc;
+ uint64_t old_tpr = stats->tpr;
+ uint64_t old_tpt = stats->tpt;
+ uint64_t old_rpthc = stats->rpthc;
+ uint64_t old_hgptc = stats->hgptc;
+
if(hw->phy.media_type == e1000_media_type_copper ||
(E1000_READ_REG(hw, E1000_STATUS) & E1000_STATUS_LU)) {
stats->symerrs +=
@@ -1521,10 +1528,13 @@ igb_read_stats_registers(struct e1000_hw *hw, struct e1000_hw_stats *stats)
/* For the 64-bit byte counters the low dword must be read first. */
/* Both registers clear on the read of the high dword */
+ /* Workaround CRC bytes included in size, take away 4 bytes/packet */
stats->gorc += E1000_READ_REG(hw, E1000_GORCL);
stats->gorc += ((uint64_t)E1000_READ_REG(hw, E1000_GORCH) << 32);
+ stats->gorc -= (stats->gprc - old_gprc) * 4;
stats->gotc += E1000_READ_REG(hw, E1000_GOTCL);
stats->gotc += ((uint64_t)E1000_READ_REG(hw, E1000_GOTCH) << 32);
+ stats->gotc -= (stats->gptc - old_gptc) * 4;
stats->rnbc += E1000_READ_REG(hw, E1000_RNBC);
stats->ruc += E1000_READ_REG(hw, E1000_RUC);
@@ -1532,13 +1542,16 @@ igb_read_stats_registers(struct e1000_hw *hw, struct e1000_hw_stats *stats)
stats->roc += E1000_READ_REG(hw, E1000_ROC);
stats->rjc += E1000_READ_REG(hw, E1000_RJC);
+ stats->tpr += E1000_READ_REG(hw, E1000_TPR);
+ stats->tpt += E1000_READ_REG(hw, E1000_TPT);
+
stats->tor += E1000_READ_REG(hw, E1000_TORL);
stats->tor += ((uint64_t)E1000_READ_REG(hw, E1000_TORH) << 32);
+ stats->tor -= (stats->tpr - old_tpr) * 4;
stats->tot += E1000_READ_REG(hw, E1000_TOTL);
stats->tot += ((uint64_t)E1000_READ_REG(hw, E1000_TOTH) << 32);
+ stats->tot -= (stats->tpt - old_tpt) * 4;
- stats->tpr += E1000_READ_REG(hw, E1000_TPR);
- stats->tpt += E1000_READ_REG(hw, E1000_TPT);
stats->ptc64 += E1000_READ_REG(hw, E1000_PTC64);
stats->ptc127 += E1000_READ_REG(hw, E1000_PTC127);
stats->ptc255 += E1000_READ_REG(hw, E1000_PTC255);
@@ -1571,8 +1584,10 @@ igb_read_stats_registers(struct e1000_hw *hw, struct e1000_hw_stats *stats)
stats->htcbdpc += E1000_READ_REG(hw, E1000_HTCBDPC);
stats->hgorc += E1000_READ_REG(hw, E1000_HGORCL);
stats->hgorc += ((uint64_t)E1000_READ_REG(hw, E1000_HGORCH) << 32);
+ stats->hgorc -= (stats->rpthc - old_rpthc) * 4;
stats->hgotc += E1000_READ_REG(hw, E1000_HGOTCL);
stats->hgotc += ((uint64_t)E1000_READ_REG(hw, E1000_HGOTCH) << 32);
+ stats->hgotc -= (stats->hgptc - old_hgptc) * 4;
stats->lenerrs += E1000_READ_REG(hw, E1000_LENERRS);
stats->scvpc += E1000_READ_REG(hw, E1000_SCVPC);
stats->hrmpc += E1000_READ_REG(hw, E1000_HRMPC);
--
1.9.1
next prev parent reply other threads:[~2015-11-16 10:35 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-16 10:35 [dpdk-dev] [PATCH 0/4] Remove CRC from " Harry van Haaren
2015-11-16 10:35 ` Harry van Haaren [this message]
2015-11-16 16:54 ` [dpdk-dev] [PATCH 1/4] e1000: remove crc size from all " Stephen Hemminger
2015-11-16 17:03 ` Van Haaren, Harry
2015-11-16 10:35 ` [dpdk-dev] [PATCH 2/4] ixgbe: " Harry van Haaren
2015-11-16 10:35 ` [dpdk-dev] [PATCH 3/4] i40e: fix rx/tx size mismatch, remove crc bytes Harry van Haaren
2015-11-16 10:35 ` [dpdk-dev] [PATCH 4/4] fm10k: remove crc size from all byte counters Harry van Haaren
2015-11-17 1:23 ` Qiu, Michael
2015-11-18 10:48 ` [dpdk-dev] [PATCH v2 0/3] Remove CRC from " Harry van Haaren
2015-11-18 10:48 ` [dpdk-dev] [PATCH v2 1/3] e1000: remove crc size from all " Harry van Haaren
2015-11-18 10:48 ` [dpdk-dev] [PATCH v2 2/3] ixgbe: " Harry van Haaren
2015-11-18 10:48 ` [dpdk-dev] [PATCH v2 3/3] i40e: fix rx/tx size mismatch, remove crc bytes Harry van Haaren
2015-11-20 12:04 ` [dpdk-dev] [PATCH v2 0/3] Remove CRC from byte counters Ananyev, Konstantin
2015-11-23 21:51 ` 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=1447670117-17723-2-git-send-email-harry.van.haaren@intel.com \
--to=harry.van.haaren@intel.com \
--cc=dev@dpdk.org \
--cc=shemming@brocade.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).