From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 03B95A0C41 for ; Tue, 30 Nov 2021 17:39:58 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EF151411CB; Tue, 30 Nov 2021 17:39:57 +0100 (CET) Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by mails.dpdk.org (Postfix) with ESMTP id 8BEB5410F7 for ; Tue, 30 Nov 2021 17:39:56 +0100 (CET) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 67BCF3F044 for ; Tue, 30 Nov 2021 16:39:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1638290396; bh=AUngYxzDxL0A+4GP6vt2sf3aMFp8JiQ5xOVCVoFUlHY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EbbnHwvVoCYH8Qjg7znhrdmFj6zuzPUgARtyeNTj4OyOpnr+4OdDpOHXhQZPCTGza AODCmyM+KtXMtml2qRQyTfndYbxn4TqtktKNhUtfx+iRKOjFNt9AWibQCZyPmWWZbX mKn5An3NGibzpuTZr3BajXrNukj4AKTltubOdU9+YnI4d33i7jFmiQTUWOt0vDHHPr avozYYlFXIrVQq9oUwApaF7KFj36QCfcuBdbLFRT1VMMJjnFSoRObjsFk07n8AUhl4 60ZtLBBearJ+zzTUd27TjXpWdF2TBcf++u0PNPLBvUo1fZkAmAi/8zBXF5pQ+vTG7Y zE6DBW0x8M9Bw== Received: by mail-ed1-f69.google.com with SMTP id i19-20020a05640242d300b003e7d13ebeedso17448162edc.7 for ; Tue, 30 Nov 2021 08:39:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AUngYxzDxL0A+4GP6vt2sf3aMFp8JiQ5xOVCVoFUlHY=; b=75g8mVFwKAttucFdpHpdpMMzJP55OOEATImnnPbI4zeSmbGpbv+Gf73NvRiXW0vafT VOfXtXsOK/yRrgVfG84wcg/uFWm6Gpn/YBB0UTEUDjmi80YqdKk0zF41vtde9CANblH5 yKusDfkXCZas9XW5s1YgvpHA14OeKjvvw8zFD429SNYebTKKeccCU2aNisNen0MqUiWB COQCVATJfALNweKqH/PyGNx0hSKkalJbFg/eCqHOx1XnMDDvaUcMlHSD2qbqHlLVPZ4+ 8mKBONRS8vDSYD8eLWVItMEYeUD5NsBHAn0kZ/bBKIE9biWcuM560BDItlYFu66WHLP4 U3Ng== X-Gm-Message-State: AOAM532NyobCOc3bWaKtDCW9cxxK9dG/oAMmey7+z8Wha/bTr+yztIb9 0AXh8UF0ZBYPWc57C1adWKtJG6JBlqA8T/+vl0BvuNzJ7s0SwPIpexFr0gSIGbMd7g9SSMdAwBO WyPhQuXqqCOAhEpt+uu3tRUYK X-Received: by 2002:a17:906:82c5:: with SMTP id a5mr191777ejy.127.1638290396101; Tue, 30 Nov 2021 08:39:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJwxxuSllZfh5vj58Zzj8cDJjr0SL10upg8Ji56q48beN1AMOBvwjSFM5ygQxNGle5RsIOOjtg== X-Received: by 2002:a17:906:82c5:: with SMTP id a5mr191759ejy.127.1638290395934; Tue, 30 Nov 2021 08:39:55 -0800 (PST) Received: from localhost.localdomain ([2001:67c:1560:8007::aac:c4ad]) by smtp.gmail.com with ESMTPSA id w5sm13073870edc.58.2021.11.30.08.39.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Nov 2021 08:39:55 -0800 (PST) From: christian.ehrhardt@canonical.com To: Alvin Zhang Cc: Qi Zhang , dpdk stable Subject: patch 'net/i40e: fix Rx packet statistics' has been queued to stable release 19.11.11 Date: Tue, 30 Nov 2021 17:34:39 +0100 Message-Id: <20211130163605.2460997-75-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211130163605.2460997-1-christian.ehrhardt@canonical.com> References: <20211130163605.2460997-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 Hi, FYI, your patch has been queued to stable release 19.11.11 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before December 10th 2021. 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. Queued patches are on a temporary branch at: https://github.com/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/3f91a5c85bf2fe6a19f0621f80e5f056d41e83f0 Thanks. Christian Ehrhardt --- >From 3f91a5c85bf2fe6a19f0621f80e5f056d41e83f0 Mon Sep 17 00:00:00 2001 From: Alvin Zhang Date: Thu, 30 Sep 2021 13:19:57 +0800 Subject: [PATCH] net/i40e: fix Rx packet statistics [ upstream commit 39e4a2577fd05199f53182b7c8509aeed40dc07f ] Some packets are discarded by the NIC because they are larger than the MTU, these packets should be counted as "RX error" instead of "RX packet", for example: pkt1 = Ether()/IP()/Raw('x' * 1400) pkt2 = Ether()/IP()/Raw('x' * 1500) ---------------- Forward statistics for port 0 ----------------- RX-packets: 2 RX-dropped: 0 RX-total: 2 TX-packets: 1 TX-dropped: 0 TX-total: 1 ---------------------------------------------------------------- Here the packet pkt2 has been discarded, but still was counted by "RX-packets" The register 'GL_RXERR1' can count above discarded packets. This patch adds reading and calculation of the 'GL_RXERR1' counter when reporting DPDK statistics. Fixes: f4a91c38b4ad ("i40e: add extended stats") Signed-off-by: Alvin Zhang Acked-by: Qi Zhang --- drivers/net/i40e/i40e_ethdev.c | 16 +++++++++++++--- drivers/net/i40e/i40e_ethdev.h | 10 ++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index df9e8ca5c5..8388073d28 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -548,7 +548,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { /* store statistics names and its offset in stats structure */ struct rte_i40e_xstats_name_off { char name[RTE_ETH_XSTATS_NAME_SIZE]; - unsigned offset; + int offset; }; static const struct rte_i40e_xstats_name_off rte_i40e_stats_strings[] = { @@ -558,6 +558,8 @@ static const struct rte_i40e_xstats_name_off rte_i40e_stats_strings[] = { {"rx_dropped_packets", offsetof(struct i40e_eth_stats, rx_discards)}, {"rx_unknown_protocol_packets", offsetof(struct i40e_eth_stats, rx_unknown_protocol)}, + {"rx_size_error_packets", offsetof(struct i40e_pf, rx_err1) - + offsetof(struct i40e_pf, stats)}, {"tx_unicast_packets", offsetof(struct i40e_eth_stats, tx_unicast)}, {"tx_multicast_packets", offsetof(struct i40e_eth_stats, tx_multicast)}, {"tx_broadcast_packets", offsetof(struct i40e_eth_stats, tx_broadcast)}, @@ -3179,6 +3181,10 @@ 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_GL_RXERR1_H(hw->pf_id + I40E_MAX_VF), + I40E_GL_RXERR1_L(hw->pf_id + I40E_MAX_VF), + pf->offset_loaded, &pf->rx_err1_offset, + &pf->rx_err1); i40e_stat_update_48_in_64(hw, I40E_GLPRT_GOTCH(hw->port), I40E_GLPRT_GOTCL(hw->port), pf->offset_loaded, &os->eth.tx_bytes, @@ -3378,7 +3384,8 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) stats->ipackets = pf->main_vsi->eth_stats.rx_unicast + pf->main_vsi->eth_stats.rx_multicast + pf->main_vsi->eth_stats.rx_broadcast - - pf->main_vsi->eth_stats.rx_discards; + pf->main_vsi->eth_stats.rx_discards - + pf->rx_err1; stats->opackets = ns->eth.tx_unicast + ns->eth.tx_multicast + ns->eth.tx_broadcast; @@ -3392,7 +3399,8 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) pf->main_vsi->eth_stats.rx_discards; stats->ierrors = ns->crc_errors + ns->rx_length_errors + ns->rx_undersize + - ns->rx_oversize + ns->rx_fragments + ns->rx_jabber; + ns->rx_oversize + ns->rx_fragments + ns->rx_jabber + + pf->rx_err1; if (pf->vfs) { for (i = 0; i < pf->vf_num; i++) { @@ -6284,6 +6292,8 @@ i40e_pf_setup(struct i40e_pf *pf) memset(&pf->stats_offset, 0, sizeof(struct i40e_hw_port_stats)); memset(&pf->internal_stats, 0, sizeof(struct i40e_eth_stats)); memset(&pf->internal_stats_offset, 0, sizeof(struct i40e_eth_stats)); + pf->rx_err1 = 0; + pf->rx_err1_offset = 0; ret = i40e_pf_get_switch_config(pf); if (ret != I40E_SUCCESS) { diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index 666babd8c5..4de21cd64a 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -17,6 +17,13 @@ #include "base/i40e_register.h" +/** + * _i=0...143, + * counters 0-127 are for the 128 VFs, + * counters 128-143 are for the 16 PFs + */ +#define I40E_GL_RXERR1_H(_i) (0x00318004 + ((_i) * 8)) + #define I40E_VLAN_TAG_SIZE 4 #define I40E_AQ_LEN 32 @@ -956,6 +963,9 @@ struct i40e_pf { struct i40e_hw_port_stats stats_offset; struct i40e_hw_port_stats stats; + u64 rx_err1; /* rxerr1 */ + u64 rx_err1_offset; + /* internal packet statistics, it should be excluded from the total */ struct i40e_eth_stats internal_stats_offset; struct i40e_eth_stats internal_stats; -- 2.34.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-11-30 16:50:10.263913822 +0100 +++ 0075-net-i40e-fix-Rx-packet-statistics.patch 2021-11-30 16:50:05.786873500 +0100 @@ -1 +1 @@ -From 39e4a2577fd05199f53182b7c8509aeed40dc07f Mon Sep 17 00:00:00 2001 +From 3f91a5c85bf2fe6a19f0621f80e5f056d41e83f0 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 39e4a2577fd05199f53182b7c8509aeed40dc07f ] + @@ -26 +27,0 @@ -Cc: stable@dpdk.org @@ -36 +37 @@ -index a2e35ebcfe..0027563034 100644 +index df9e8ca5c5..8388073d28 100644 @@ -39 +40 @@ -@@ -520,7 +520,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { +@@ -548,7 +548,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { @@ -48 +49 @@ -@@ -530,6 +530,8 @@ static const struct rte_i40e_xstats_name_off rte_i40e_stats_strings[] = { +@@ -558,6 +558,8 @@ static const struct rte_i40e_xstats_name_off rte_i40e_stats_strings[] = { @@ -57 +58 @@ -@@ -3202,6 +3204,10 @@ i40e_read_stats_registers(struct i40e_pf *pf, struct i40e_hw *hw) +@@ -3179,6 +3181,10 @@ i40e_read_stats_registers(struct i40e_pf *pf, struct i40e_hw *hw) @@ -68 +69 @@ -@@ -3401,7 +3407,8 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) +@@ -3378,7 +3384,8 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) @@ -78 +79 @@ -@@ -3415,7 +3422,8 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) +@@ -3392,7 +3399,8 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) @@ -88 +89 @@ -@@ -6197,6 +6205,8 @@ i40e_pf_setup(struct i40e_pf *pf) +@@ -6284,6 +6292,8 @@ i40e_pf_setup(struct i40e_pf *pf) @@ -98 +99 @@ -index 8a68b363f9..1d57b9617e 100644 +index 666babd8c5..4de21cd64a 100644 @@ -101,3 +102,3 @@ -@@ -20,6 +20,13 @@ - #include "base/i40e_type.h" - #include "base/virtchnl.h" +@@ -17,6 +17,13 @@ + + #include "base/i40e_register.h" @@ -115 +116 @@ -@@ -1114,6 +1121,9 @@ struct i40e_pf { +@@ -956,6 +963,9 @@ struct i40e_pf {