patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Junyu Jiang <junyux.jiang@intel.com>
To: dev@dpdk.org
Cc: Qi Zhang <qi.z.zhang@intel.com>,
	Qiming Yang <qiming.yang@intel.com>,
	Junyu Jiang <junyux.jiang@intel.com>,
	stable@dpdk.org
Subject: [dpdk-stable] [PATCH 2/2] net/ice: fix incorrect Tx bytes statistics
Date: Wed, 15 Jul 2020 07:03:07 +0000	[thread overview]
Message-ID: <20200715070307.36814-3-junyux.jiang@intel.com> (raw)
In-Reply-To: <20200715070307.36814-1-junyux.jiang@intel.com>

This patch fixed the issue that tx_bytes overflowed
on 40 bit limitation by enlarging the limitation.

Fixes: a37bde56314d ("net/ice: support statistics")
Cc: stable@dpdk.org

Signed-off-by: Junyu Jiang <junyux.jiang@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index d92b6ffa1..b6b45e274 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -4144,6 +4144,7 @@ ice_update_vsi_stats(struct ice_vsi *vsi)
 	struct ice_hw *hw = ICE_VSI_TO_HW(vsi);
 	int idx = rte_le_to_cpu_16(vsi->vsi_id);
 	uint64_t old_rx_bytes = nes->rx_bytes;
+	uint64_t old_tx_bytes = nes->tx_bytes;
 
 	old_rx_bytes += (nes->rx_unicast + nes->rx_multicast +
 			 nes->rx_broadcast) * RTE_ETHER_CRC_LEN;
@@ -4189,6 +4190,9 @@ ice_update_vsi_stats(struct ice_vsi *vsi)
 	/* GLV_TDPC not supported */
 	ice_stat_update_32(hw, GLV_TEPC(idx), vsi->offset_loaded,
 			   &oes->tx_errors, &nes->tx_errors);
+	/* enlarge the limitation when tx_bytes overflowed */
+	if (old_tx_bytes > nes->tx_bytes && vsi->offset_loaded)
+		nes->tx_bytes += (uint64_t)1 << ICE_40_BIT_WIDTH;
 	vsi->offset_loaded = true;
 
 	PMD_DRV_LOG(DEBUG, "************** VSI[%u] stats start **************",
@@ -4216,9 +4220,12 @@ ice_read_stats_registers(struct ice_pf *pf, struct ice_hw *hw)
 	struct ice_hw_port_stats *ns = &pf->stats; /* new stats */
 	struct ice_hw_port_stats *os = &pf->stats_offset; /* old stats */
 	uint64_t old_rx_bytes = ns->eth.rx_bytes;
+	uint64_t old_tx_bytes = ns->eth.tx_bytes;
 
 	old_rx_bytes += (ns->eth.rx_unicast + ns->eth.rx_multicast +
 			 ns->eth.rx_broadcast) * RTE_ETHER_CRC_LEN;
+	old_tx_bytes += (ns->eth.tx_unicast + ns->eth.tx_multicast +
+			 ns->eth.tx_broadcast) * RTE_ETHER_CRC_LEN;
 
 	/* Get statistics of struct ice_eth_stats */
 	ice_stat_update_40(hw, GLPRT_GORCH(hw->port_info->lport),
@@ -4273,6 +4280,9 @@ ice_read_stats_registers(struct ice_pf *pf, struct ice_hw *hw)
 			   GLPRT_BPTCL(hw->port_info->lport),
 			   pf->offset_loaded, &os->eth.tx_broadcast,
 			   &ns->eth.tx_broadcast);
+	/* enlarge the limitation when tx_bytes overflowed */
+	if (old_tx_bytes > ns->eth.tx_bytes && pf->offset_loaded)
+		ns->eth.tx_bytes += (uint64_t)1 << ICE_40_BIT_WIDTH;
 	ns->eth.tx_bytes -= (ns->eth.tx_unicast + ns->eth.tx_multicast +
 			     ns->eth.tx_broadcast) * RTE_ETHER_CRC_LEN;
 
-- 
2.17.1


  parent reply	other threads:[~2020-07-15  7:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200715070307.36814-1-junyux.jiang@intel.com>
2020-07-15  7:03 ` [dpdk-stable] [PATCH 1/2] net/ice: fix incorrect Rx " Junyu Jiang
2020-07-15  7:03 ` Junyu Jiang [this message]
2020-07-17  2:17 ` [dpdk-stable] [PATCH v2] net/ice: fix incorrect Rx/Tx " Junyu Jiang
2020-07-20  9:50   ` Zhang, Qi Z
2020-07-21  7:20 ` [dpdk-stable] [PATCH v3] " Junyu Jiang
2020-07-22  5:19   ` Zhang, Qi Z

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=20200715070307.36814-3-junyux.jiang@intel.com \
    --to=junyux.jiang@intel.com \
    --cc=dev@dpdk.org \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=stable@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).