From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8E74CA0540 for ; Wed, 15 Jul 2020 09:26:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 71CBB1C000; Wed, 15 Jul 2020 09:26:59 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 84A561BFFB; Wed, 15 Jul 2020 09:26:56 +0200 (CEST) IronPort-SDR: kPbTlS51U+08r7W/d61wz12Sp49gsOYb/PDFJMbCbVqVpXz/N9MkQo8yjoEk3YHAUckw68gpV5 8TSlhnkLIgrg== X-IronPort-AV: E=McAfee;i="6000,8403,9682"; a="233953273" X-IronPort-AV: E=Sophos;i="5.75,354,1589266800"; d="scan'208";a="233953273" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2020 00:26:55 -0700 IronPort-SDR: 0tuvStht5jCG0yzJIwVEQIjlMpuX8Pv4oE5FyRG11VOefHUY+VdZIjGQcgdfK8HZTbm+WRhisi 4U4NFp1SzjhA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,354,1589266800"; d="scan'208";a="299798583" Received: from intel.sh.intel.com ([10.239.255.48]) by orsmga002.jf.intel.com with ESMTP; 15 Jul 2020 00:26:53 -0700 From: Junyu Jiang To: dev@dpdk.org Cc: Qi Zhang , Qiming Yang , Junyu Jiang , stable@dpdk.org Date: Wed, 15 Jul 2020 07:03:07 +0000 Message-Id: <20200715070307.36814-3-junyux.jiang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200715070307.36814-1-junyux.jiang@intel.com> References: <20200715070307.36814-1-junyux.jiang@intel.com> Subject: [dpdk-stable] [PATCH 2/2] net/ice: fix incorrect Tx bytes statistics X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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 --- 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