From: Harry van Haaren <harry.van.haaren@intel.com>
To: dev@dpdk.org
Cc: shemming@brocade.com
Subject: [dpdk-dev] [PATCH 3/4] i40e: fix rx/tx size mismatch, remove crc bytes
Date: Mon, 16 Nov 2015 10:35:16 +0000 [thread overview]
Message-ID: <1447670117-17723-4-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.
Doing so fixes a bug that CRC bytes were included on TX but not
on RX, causing mismatch of bytes recieved / sent.
Fixes: 9aace75fc82e ("i40e: fix statistics")
Reported-by: Weichun Chen <weichunx.chen@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 33 ++++++++++++++++++++++-----------
1 file changed, 22 insertions(+), 11 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 2c51a0b..c0c268d 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1870,11 +1870,11 @@ i40e_read_stats_registers(struct i40e_pf *pf, struct i40e_hw *hw)
unsigned int i;
struct i40e_hw_port_stats *ns = &pf->stats; /* new stats */
struct i40e_hw_port_stats *os = &pf->stats_offset; /* old stats */
- /* Get statistics of struct i40e_eth_stats */
- i40e_stat_update_48(hw, I40E_GLPRT_GORCH(hw->port),
- I40E_GLPRT_GORCL(hw->port),
- pf->offset_loaded, &os->eth.rx_bytes,
- &ns->eth.rx_bytes);
+
+ /* Workaround: CRC size should not be included in byte statistics,
+ * so we add 4 bytes to the offset, causing the resulting byte
+ * counters to be 4 bytes smaller.
+ */
i40e_stat_update_48(hw, I40E_GLPRT_UPRCH(hw->port),
I40E_GLPRT_UPRCL(hw->port),
pf->offset_loaded, &os->eth.rx_unicast,
@@ -1887,6 +1887,15 @@ i40e_read_stats_registers(struct i40e_pf *pf, struct i40e_hw *hw)
I40E_GLPRT_BPRCL(hw->port),
pf->offset_loaded, &os->eth.rx_broadcast,
&ns->eth.rx_broadcast);
+
+ /* Get statistics of struct i40e_eth_stats */
+ i40e_stat_update_48(hw, I40E_GLPRT_GORCH(hw->port),
+ I40E_GLPRT_GORCL(hw->port),
+ pf->offset_loaded, &os->eth.rx_bytes,
+ &ns->eth.rx_bytes);
+ ns->eth.rx_bytes -= (ns->eth.rx_unicast + ns->eth.rx_multicast +
+ ns->eth.rx_broadcast) * 4;
+
i40e_stat_update_32(hw, I40E_GLPRT_RDPC(hw->port),
pf->offset_loaded, &os->eth.rx_discards,
&ns->eth.rx_discards);
@@ -1896,10 +1905,6 @@ i40e_read_stats_registers(struct i40e_pf *pf, struct i40e_hw *hw)
pf->offset_loaded,
&os->eth.rx_unknown_protocol,
&ns->eth.rx_unknown_protocol);
- i40e_stat_update_48(hw, I40E_GLPRT_GOTCH(hw->port),
- I40E_GLPRT_GOTCL(hw->port),
- pf->offset_loaded, &os->eth.tx_bytes,
- &ns->eth.tx_bytes);
i40e_stat_update_48(hw, I40E_GLPRT_UPTCH(hw->port),
I40E_GLPRT_UPTCL(hw->port),
pf->offset_loaded, &os->eth.tx_unicast,
@@ -1912,6 +1917,12 @@ i40e_read_stats_registers(struct i40e_pf *pf, struct i40e_hw *hw)
I40E_GLPRT_BPTCL(hw->port),
pf->offset_loaded, &os->eth.tx_broadcast,
&ns->eth.tx_broadcast);
+ i40e_stat_update_48(hw, I40E_GLPRT_GOTCH(hw->port),
+ I40E_GLPRT_GOTCL(hw->port),
+ pf->offset_loaded, &os->eth.tx_bytes,
+ &ns->eth.tx_bytes);
+ ns->eth.tx_bytes -= (ns->eth.tx_unicast + ns->eth.tx_multicast +
+ ns->eth.tx_broadcast) * 4;
/* GLPRT_TEPC not supported */
/* additional port specific stats */
@@ -2069,8 +2080,8 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
stats->opackets = pf->main_vsi->eth_stats.tx_unicast +
pf->main_vsi->eth_stats.tx_multicast +
pf->main_vsi->eth_stats.tx_broadcast;
- stats->ibytes = pf->main_vsi->eth_stats.rx_bytes;
- stats->obytes = pf->main_vsi->eth_stats.tx_bytes;
+ stats->ibytes = ns->eth.rx_bytes;
+ stats->obytes = ns->eth.tx_bytes;
stats->oerrors = ns->eth.tx_errors +
pf->main_vsi->eth_stats.tx_errors;
stats->imcasts = pf->main_vsi->eth_stats.rx_multicast;
--
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 byte counters Harry van Haaren
2015-11-16 10:35 ` [dpdk-dev] [PATCH 1/4] e1000: remove crc size from all " Harry van Haaren
2015-11-16 16:54 ` 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 ` Harry van Haaren [this message]
2015-11-16 10:35 ` [dpdk-dev] [PATCH 4/4] fm10k: " 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-4-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).