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 E7237A0351 for ; Thu, 6 Aug 2020 11:58:03 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DF6BA1C0AE; Thu, 6 Aug 2020 11:58:03 +0200 (CEST) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by dpdk.org (Postfix) with ESMTP id C5A701C0D0 for ; Thu, 6 Aug 2020 11:58:02 +0200 (CEST) Received: by mail-wm1-f66.google.com with SMTP id k8so9083991wma.2 for ; Thu, 06 Aug 2020 02:58:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=olL88AbzepWVhHQhr0QjW6xBXXbyK29att9KDJ+yTIk=; b=OWh+MD7Jbvlr3Zn7HRrLow/VpTgTedDKk4JT/aJisBM25TmjeIL9Wq1kTprrkxo7SE evuAS6O64whSozlwqhiN8jdc8QiM446ojSa10PVWMER1TuPsB2+qeIvGRbBBHfratcMU /K7WfBr9hfzzn7N1Eh4860H4+NOlJpzf2CsR/A9jQKBhbaG0mcbP6H3Attgx88VBz4Mq Z6iuvNs1nHsrTRBrYUmPfHvER6JYQxouXbVnuTpcgM9Em7z4nJ1cVWBTu5/az42KI1n2 Fy+0TKn12MgBzLoYYMj7z3TlGZhD/eSS8p7ETH6AwYYvheScOtuhbTrG3Dld9nd0L18P xC2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=olL88AbzepWVhHQhr0QjW6xBXXbyK29att9KDJ+yTIk=; b=symMEEIC9SIEuVa4RgRtRZ8DxTERkO++HQcKGTCLJiRbdg2x8YXoHMraIsT7q8iDWF KgBkTTp0YFwCeCxXRY/buSgORiBFn6h2NR5u2j+g1zbaDA33vxYZEFQ5TSf/sT1dGl1B LZbeKuTjN3sYXyHOYn8fKPa7fbfd6dGBpgfY1MfJncI5PynsBkhx0FMxBzvMrGxq67ST lNADtObTXryaqlPTenje5SFbMTONsgoZ3L1dqPJMHI8q4D2cAyy3/wSpsatz8aPgHB5d e9KICfAOGc6AuAaQfrpanYmWdjD7UxOI8CfUxFZtR6HNwEqWo1hCu9PcgvYzwRUxt6Ir QPWA== X-Gm-Message-State: AOAM530CzzOBQAQneoCz5zQFC/fHD687Fp2OZ/oecT+mg17caSyYLmY9 erP+CfcBkaUpVZ9ylLuYrG4= X-Google-Smtp-Source: ABdhPJwhOimUXELlneCLyuEUBIdBVMezId7o0jshR72djIyBw1d2GEqL/hG+6oJ6zLsgmsJ5YYVn0A== X-Received: by 2002:a05:600c:290a:: with SMTP id i10mr7674594wmd.175.1596707882482; Thu, 06 Aug 2020 02:58:02 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id y17sm6303477wrh.63.2020.08.06.02.58.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 02:58:01 -0700 (PDT) From: luca.boccassi@gmail.com To: Junyu Jiang Cc: Qi Zhang , dpdk stable Date: Thu, 6 Aug 2020 10:53:38 +0100 Message-Id: <20200806095411.774624-10-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200806095411.774624-1-luca.boccassi@gmail.com> References: <20200724120030.1863487-1-luca.boccassi@gmail.com> <20200806095411.774624-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/ice: fix bytes statistics' has been queued to stable release 19.11.4 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" Hi, FYI, your patch has been queued to stable release 19.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 08/08/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From f1e4f235374364075f7e26a1a1895ca297d9635f Mon Sep 17 00:00:00 2001 From: Junyu Jiang Date: Tue, 21 Jul 2020 07:20:21 +0000 Subject: [PATCH] net/ice: fix bytes statistics [ upstream commit f0585e8559616399a655f5e129e98c90609a8c5d ] This patch fixed the issue that rx/tx bytes overflowed on 40 bit limitation by enlarging the limitation. Fixes: a37bde56314d ("net/ice: support statistics") Signed-off-by: Junyu Jiang Acked-by: Qi Zhang --- drivers/net/ice/ice_ethdev.c | 28 ++++++++++++++++++++++++++++ drivers/net/ice/ice_ethdev.h | 7 +++++++ 2 files changed, 35 insertions(+) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index ca4371ae3..5166dafd0 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -4061,6 +4061,13 @@ ice_update_vsi_stats(struct ice_vsi *vsi) ice_stat_update_40(hw, GLV_BPRCH(idx), GLV_BPRCL(idx), vsi->offset_loaded, &oes->rx_broadcast, &nes->rx_broadcast); + /* enlarge the limitation when rx_bytes overflowed */ + if (vsi->offset_loaded) { + if (ICE_RXTX_BYTES_LOW(vsi->old_rx_bytes) > nes->rx_bytes) + nes->rx_bytes += (uint64_t)1 << ICE_40_BIT_WIDTH; + nes->rx_bytes += ICE_RXTX_BYTES_HIGH(vsi->old_rx_bytes); + } + vsi->old_rx_bytes = nes->rx_bytes; /* exclude CRC bytes */ nes->rx_bytes -= (nes->rx_unicast + nes->rx_multicast + nes->rx_broadcast) * RTE_ETHER_CRC_LEN; @@ -4087,6 +4094,13 @@ 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 (vsi->offset_loaded) { + if (ICE_RXTX_BYTES_LOW(vsi->old_tx_bytes) > nes->tx_bytes) + nes->tx_bytes += (uint64_t)1 << ICE_40_BIT_WIDTH; + nes->tx_bytes += ICE_RXTX_BYTES_HIGH(vsi->old_tx_bytes); + } + vsi->old_tx_bytes = nes->tx_bytes; vsi->offset_loaded = true; PMD_DRV_LOG(DEBUG, "************** VSI[%u] stats start **************", @@ -4134,6 +4148,13 @@ ice_read_stats_registers(struct ice_pf *pf, struct ice_hw *hw) ice_stat_update_32(hw, PRTRPB_RDPC, pf->offset_loaded, &os->eth.rx_discards, &ns->eth.rx_discards); + /* enlarge the limitation when rx_bytes overflowed */ + if (pf->offset_loaded) { + if (ICE_RXTX_BYTES_LOW(pf->old_rx_bytes) > ns->eth.rx_bytes) + ns->eth.rx_bytes += (uint64_t)1 << ICE_40_BIT_WIDTH; + ns->eth.rx_bytes += ICE_RXTX_BYTES_HIGH(pf->old_rx_bytes); + } + pf->old_rx_bytes = ns->eth.rx_bytes; /* Workaround: CRC size should not be included in byte statistics, * so subtract RTE_ETHER_CRC_LEN from the byte counter for each rx @@ -4164,6 +4185,13 @@ 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 (pf->offset_loaded) { + if (ICE_RXTX_BYTES_LOW(pf->old_tx_bytes) > ns->eth.tx_bytes) + ns->eth.tx_bytes += (uint64_t)1 << ICE_40_BIT_WIDTH; + ns->eth.tx_bytes += ICE_RXTX_BYTES_HIGH(pf->old_tx_bytes); + } + pf->old_tx_bytes = ns->eth.tx_bytes; ns->eth.tx_bytes -= (ns->eth.tx_unicast + ns->eth.tx_multicast + ns->eth.tx_broadcast) * RTE_ETHER_CRC_LEN; diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h index da557a254..070c3ae30 100644 --- a/drivers/net/ice/ice_ethdev.h +++ b/drivers/net/ice/ice_ethdev.h @@ -124,6 +124,9 @@ #define ICE_ETH_OVERHEAD \ (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE * 2) +#define ICE_RXTX_BYTES_HIGH(bytes) ((bytes) & ~ICE_40_BIT_MASK) +#define ICE_RXTX_BYTES_LOW(bytes) ((bytes) & ICE_40_BIT_MASK) + /* DDP package type */ enum ice_pkg_type { ICE_PKG_TYPE_UNKNOWN, @@ -239,6 +242,8 @@ struct ice_vsi { struct ice_eth_stats eth_stats_offset; struct ice_eth_stats eth_stats; bool offset_loaded; + uint64_t old_rx_bytes; + uint64_t old_tx_bytes; }; enum proto_xtr_type { @@ -381,6 +386,8 @@ struct ice_pf { struct ice_parser_list perm_parser_list; struct ice_parser_list dist_parser_list; bool init_link_up; + uint64_t old_rx_bytes; + uint64_t old_tx_bytes; }; #define ICE_MAX_QUEUE_NUM 2048 -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-08-06 10:53:16.171972518 +0100 +++ 0010-net-ice-fix-bytes-statistics.patch 2020-08-06 10:53:15.716595738 +0100 @@ -1,13 +1,14 @@ -From f0585e8559616399a655f5e129e98c90609a8c5d Mon Sep 17 00:00:00 2001 +From f1e4f235374364075f7e26a1a1895ca297d9635f Mon Sep 17 00:00:00 2001 From: Junyu Jiang Date: Tue, 21 Jul 2020 07:20:21 +0000 Subject: [PATCH] net/ice: fix bytes statistics +[ upstream commit f0585e8559616399a655f5e129e98c90609a8c5d ] + This patch fixed the issue that rx/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 Acked-by: Qi Zhang @@ -17,10 +18,10 @@ 2 files changed, 35 insertions(+) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c -index 7dd3fcd27..a4a0390f8 100644 +index ca4371ae3..5166dafd0 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c -@@ -4252,6 +4252,13 @@ ice_update_vsi_stats(struct ice_vsi *vsi) +@@ -4061,6 +4061,13 @@ ice_update_vsi_stats(struct ice_vsi *vsi) ice_stat_update_40(hw, GLV_BPRCH(idx), GLV_BPRCL(idx), vsi->offset_loaded, &oes->rx_broadcast, &nes->rx_broadcast); @@ -34,7 +35,7 @@ /* exclude CRC bytes */ nes->rx_bytes -= (nes->rx_unicast + nes->rx_multicast + nes->rx_broadcast) * RTE_ETHER_CRC_LEN; -@@ -4278,6 +4285,13 @@ ice_update_vsi_stats(struct ice_vsi *vsi) +@@ -4087,6 +4094,13 @@ 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); @@ -48,7 +49,7 @@ vsi->offset_loaded = true; PMD_DRV_LOG(DEBUG, "************** VSI[%u] stats start **************", -@@ -4325,6 +4339,13 @@ ice_read_stats_registers(struct ice_pf *pf, struct ice_hw *hw) +@@ -4134,6 +4148,13 @@ ice_read_stats_registers(struct ice_pf *pf, struct ice_hw *hw) ice_stat_update_32(hw, PRTRPB_RDPC, pf->offset_loaded, &os->eth.rx_discards, &ns->eth.rx_discards); @@ -62,7 +63,7 @@ /* Workaround: CRC size should not be included in byte statistics, * so subtract RTE_ETHER_CRC_LEN from the byte counter for each rx -@@ -4355,6 +4376,13 @@ ice_read_stats_registers(struct ice_pf *pf, struct ice_hw *hw) +@@ -4164,6 +4185,13 @@ 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); @@ -77,10 +78,10 @@ ns->eth.tx_broadcast) * RTE_ETHER_CRC_LEN; diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h -index 2bff735ca..87984ef9e 100644 +index da557a254..070c3ae30 100644 --- a/drivers/net/ice/ice_ethdev.h +++ b/drivers/net/ice/ice_ethdev.h -@@ -133,6 +133,9 @@ +@@ -124,6 +124,9 @@ #define ICE_ETH_OVERHEAD \ (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE * 2) @@ -90,7 +91,7 @@ /* DDP package type */ enum ice_pkg_type { ICE_PKG_TYPE_UNKNOWN, -@@ -248,6 +251,8 @@ struct ice_vsi { +@@ -239,6 +242,8 @@ struct ice_vsi { struct ice_eth_stats eth_stats_offset; struct ice_eth_stats eth_stats; bool offset_loaded; @@ -99,7 +100,7 @@ }; enum proto_xtr_type { -@@ -391,6 +396,8 @@ struct ice_pf { +@@ -381,6 +386,8 @@ struct ice_pf { struct ice_parser_list perm_parser_list; struct ice_parser_list dist_parser_list; bool init_link_up;