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 4BB3EA034F for ; Wed, 10 Nov 2021 07:48:17 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3F26340142; Wed, 10 Nov 2021 07:48:17 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2074.outbound.protection.outlook.com [40.107.236.74]) by mails.dpdk.org (Postfix) with ESMTP id 21FC940142 for ; Wed, 10 Nov 2021 07:48:15 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bvFX1MQCQaGL+HCbGwUjXIbTG55lHv4+7nCSt0CJzQpxsbF2ZIZMQXiljVw9Q5x8uHIsIfyx7PHxiowPFO6Z/33vdrkXnK4YZkA2QI/IdxOO0VsJYKyBItGNDnciIYCVb5tGy4AyeW0eC4WIEIuTqcnAD2fKEEOTcGgHyMKx5ZUjq/D2wVKiKDNjOJT6B1ud4TU2JT/S4ARyBMvWa8qhJ9XUjesTuiVaJz1dnZXRLyZDj+HZ9E4T1mBTvx7tkimCaZghGimufPfNYLvSBN/Pp3+SvV4LOCCD79DaFRy05OiXdV6ht6XtvDKw1SiYBKeu6+SNt2MiIDdnum7jHJL24A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hRD2uKi5aQ+jDsEveN1C5xirrBvQoP44nsoisBFKS5E=; b=mZ3ula2KW1+VlcEFUBrIdSaQ6IRKqDg6eMcymW3dcB4RIV05uGIvLLtRgOfmHtpHdGIIdICwjVzQV03ECPbtZQVkv4ec/pH1q49r9kp/w7//Dw5YYQO8Q++mnrfxtgh79EwdeHyBNdYkcWORU34nDaqnNvcU+ube6d1fIPqYE+DDpDUHCg147FmohO3XBYIkpwgn/+bvG61CB67qA3v2qQ9HMggPVIYj5Ksoli2wU1Cr3J5hmD5AL2BieAazOCMnf4XyyzXA9jBO4QADzltjf07TMvDKELE9+aFCYniwfwHc8RDQYNNl7Fu15tenrd9ZxBZaIm+ACTLbPxfKLqEkgg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=temperror (sender ip is 216.228.112.34) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=temperror action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hRD2uKi5aQ+jDsEveN1C5xirrBvQoP44nsoisBFKS5E=; b=VqYgyWc1U4PwB/vLvW9X/R9CPEpfk4RbsZqB3c1GXhsF1zEr+UEKHr0ErdTlOL/C/OXJv1y+ax3pCNkcaaR81kMDnhdBJQNaXA2MUoZ27QWrm/ktpBGtqQjd8gBOJzG8es8iQyvmSjWcaUD3nwJ/SQ7izeZzfdJ5Dleca47PKZuCzyJKoY0dpUFZAGiXOmxPTI6J578YPFaIVGx/FhrN/kS/VvyAE4Hf3gnzTZAaKo3QIIjpt6+6+Ap0EZRSs3/qUdFIjIAqAPUSurd1vF7tTaMiZjpL4K1AhnaIXxJUP2G1VnbUON2A3erCS9FvIjQsnzscMy3vI+DaobeJCUDsgw== Received: from BN0PR03CA0047.namprd03.prod.outlook.com (2603:10b6:408:e7::22) by BYAPR12MB3431.namprd12.prod.outlook.com (2603:10b6:a03:da::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.10; Wed, 10 Nov 2021 06:48:13 +0000 Received: from BN8NAM11FT059.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e7:cafe::7a) by BN0PR03CA0047.outlook.office365.com (2603:10b6:408:e7::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11 via Frontend Transport; Wed, 10 Nov 2021 06:48:12 +0000 X-MS-Exchange-Authentication-Results: spf=temperror (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=temperror action=none header.from=nvidia.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of nvidia.com: DNS Timeout) Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT059.mail.protection.outlook.com (10.13.177.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4690.15 via Frontend Transport; Wed, 10 Nov 2021 06:48:11 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 10 Nov 2021 06:48:07 +0000 From: Xueming Li To: Alvin Zhang CC: Luca Boccassi , Qi Zhang , dpdk stable Date: Wed, 10 Nov 2021 14:30:24 +0800 Message-ID: <20211110063216.2744012-141-xuemingl@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211110063216.2744012-1-xuemingl@nvidia.com> References: <20211110063216.2744012-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e47b7413-a7f9-437e-fcee-08d9a4160fd8 X-MS-TrafficTypeDiagnostic: BYAPR12MB3431: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 13P1I8prxigMLPK6BMGv1VXpqx4oa0URgLgsKv6fMSR80cNRutyNOQ9TpfjuPC/m8h6zEo1K6lSNv6gACJBbJEykz70khWLoWd2EoNWNSBSq5MHvjsftkV8NoyT/esEUnfpJv6JgxBlYt+eZj5dmhVKStq3Nta0R13zANRFw40vIJST5YHBZUaHQKd3bclOc71oeg5VvXRBqnOcQW/lbCLvyVSMG+qAqaqd18TGYqF77GtWLBWjOsSTvDy49Nfsg+0C3J10rasta14UmlozQ5BarvCwf3PV1JZ9h67Sxfjp/WQBaokIRhqz2ac3VGljMKUB7kMl4K0PtH6TT/5jqSk7HcV+Cv7hqV1llwe+D+IRx9ngorRUImAtxF7jK7INZ0A3mL4HYvvmus4jHVDGvC89B4ytGi0jcfqOJpraaFYS5Pa3ewMXDgNnW7txwIiifiCKa5zMInOXAnsJDq3+gG0EyBSCtWbbcaLuQCWKIS0pE59nvZ+HeMZDJ1ZIjYbETvk1HrmI3r37hKllAVIHG1WvSrMzpv4uKiVjb8x+adNFOASxMcu/8qYRp8WhSVE0Wqx4b6j4NDu5Cu2Inp1vHIt03CQzz5whYpx8JkNUOmbFGpdM6+xZABHCTAmL8imEMcDamJappspes4JYqA1nmYWzR7Hr70Eh1psi3PvKlsK3iOSY+pFdm77Atp7zj04RsOqitfBtHK4ZsK0mT5ru6/BEkrYHGLgaqbXqPuUE1/cfIbJypF+xaaULSRYANFQFd1B79HcMBwP/75xVhbRLaA3fjpKEcUyt7iQBBxJSh2YqLDl8z4yQNc+mczd05CtYg X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(4001150100001)(47076005)(316002)(508600001)(7636003)(2906002)(6916009)(6666004)(4326008)(7696005)(83380400001)(82310400003)(336012)(54906003)(8936002)(70206006)(6286002)(55016002)(1076003)(356005)(16526019)(70586007)(36860700001)(186003)(5660300002)(426003)(86362001)(36906005)(8676002)(36756003)(2616005)(966005)(63350400001)(53546011)(26005)(63370400001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2021 06:48:11.0041 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e47b7413-a7f9-437e-fcee-08d9a4160fd8 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT059.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3431 Subject: [dpdk-stable] patch 'net/i40e: fix Rx packet statistics' has been queued to stable release 20.11.4 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 Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.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 11/12/21. 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/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/b450a88df85f86e5e431aadaf9e7bd965fd18b76 Thanks. Xueming Li --- >From b450a88df85f86e5e431aadaf9e7bd965fd18b76 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 Cc: Xueming Li [ 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 a364338564..f8c1035f8f 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -534,7 +534,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[] = { @@ -544,6 +544,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)}, @@ -3295,6 +3297,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, @@ -3494,7 +3500,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; @@ -3508,7 +3515,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++) { @@ -6289,6 +6297,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 d80316d2f7..f32d853071 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 @@ -1114,6 +1121,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.33.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-11-10 14:17:08.155841416 +0800 +++ 0140-net-i40e-fix-Rx-packet-statistics.patch 2021-11-10 14:17:01.910745763 +0800 @@ -1 +1 @@ -From 39e4a2577fd05199f53182b7c8509aeed40dc07f Mon Sep 17 00:00:00 2001 +From b450a88df85f86e5e431aadaf9e7bd965fd18b76 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 39e4a2577fd05199f53182b7c8509aeed40dc07f ] @@ -26 +28,0 @@ -Cc: stable@dpdk.org @@ -36 +38 @@ -index a2e35ebcfe..0027563034 100644 +index a364338564..f8c1035f8f 100644 @@ -39 +41 @@ -@@ -520,7 +520,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { +@@ -534,7 +534,7 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { @@ -48 +50 @@ -@@ -530,6 +530,8 @@ static const struct rte_i40e_xstats_name_off rte_i40e_stats_strings[] = { +@@ -544,6 +544,8 @@ static const struct rte_i40e_xstats_name_off rte_i40e_stats_strings[] = { @@ -57 +59 @@ -@@ -3202,6 +3204,10 @@ i40e_read_stats_registers(struct i40e_pf *pf, struct i40e_hw *hw) +@@ -3295,6 +3297,10 @@ i40e_read_stats_registers(struct i40e_pf *pf, struct i40e_hw *hw) @@ -68 +70 @@ -@@ -3401,7 +3407,8 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) +@@ -3494,7 +3500,8 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) @@ -78 +80 @@ -@@ -3415,7 +3422,8 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) +@@ -3508,7 +3515,8 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) @@ -88 +90 @@ -@@ -6197,6 +6205,8 @@ i40e_pf_setup(struct i40e_pf *pf) +@@ -6289,6 +6297,8 @@ i40e_pf_setup(struct i40e_pf *pf) @@ -98 +100 @@ -index 8a68b363f9..1d57b9617e 100644 +index d80316d2f7..f32d853071 100644 @@ -101,3 +103,3 @@ -@@ -20,6 +20,13 @@ - #include "base/i40e_type.h" - #include "base/virtchnl.h" +@@ -17,6 +17,13 @@ + + #include "base/i40e_register.h"