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 9F3F1A0543 for ; Tue, 21 Jun 2022 10:06:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9AA1140151; Tue, 21 Jun 2022 10:06:50 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2075.outbound.protection.outlook.com [40.107.93.75]) by mails.dpdk.org (Postfix) with ESMTP id 07D0140151 for ; Tue, 21 Jun 2022 10:06:48 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n9KnbGpeFrUO/VqybMNeMbPYNtDxECSgphM26Vvl7HW+WeEbWP1fQupYmv25YC39IE5glLs+3U1FDxVBOYKm1PcgaRPxAEJrAl5Sugis7F3LLl27I5y9s1PD45Yc+aSCCWSuOgXQwcAkV11luvkVV5MhYieK0p44lvsgDEE2Y6sBfeEamhY2e6OMBX/7P36IkBBxPRWPbk7aRXTro85cxKNjJEX0veQ5rEFvwgO2XdWRVFToxBRzaKoXvqOLlPYW+lHAWv6S2F3HfFXqFNbc0Zifh58h1uY3Is1KBXhyic0iiIeYwJeyZwwaFZSHvHTiQtt97VLHAJdoZrmNkNu8dA== 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=ur3vX7WRVE2lBJYR0Yfn/z5yUsK8ibk8kC/PUNvIscU=; b=gf/dFj7/GYk4KndIOgT1PeR9PhdxWzSJ6lkBc+8GS16b0BpRMLe0JkK8nYY89pC1Yu8gIz/rvRP7cQV5Jvn9rvinMZom6mgpQFf0Hc8bhEd1PtSM8qkn5cA6VFniFzuivVdU4IiolO0Jx8adnKxGxpQYDWqGg22Yxh9abScwXgDBO6tb2uapzPncJmBVKqku3wXyNJjNyAQvg5fSsmA1tnL2VH+KClIelFD68kGb86CnGbi70nPAvREuoPwz9Ug71CfeWPKsjHcCWMsKY1/xG1gnEMQk5pb/O4wd/oWKcaD7bZ6y3OmR/EivQGLX+ApqOmxW+zZiyNuJmcHH1dp8Og== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) 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=ur3vX7WRVE2lBJYR0Yfn/z5yUsK8ibk8kC/PUNvIscU=; b=Y9f/wgXEMkZZ1qHB1A9GZL1GfpfHdn9LehqVA7Xxc7bz/zIgmhoRzHHJlp4HGL+QpKh/na5sHNORpiP5XRpkQKhDjwjeDP8JFB2+K8N8zUI2/9MVPXujcj2FICh2ovGqF+SGwfW6OcihlfbnoKBuA7dAQct8KigqMK0rTJ8nHlAFm9+bmkS//MjHlKth4NfqlmASlktoJ02/b54FWaAO3OSZPhTbNQvoh6nK4ZGjEob8P5vbs7fyMmjYFGkIgForT9clqWsJVgtn+Jdu7sVSedBth7fGChzsMRjYv9r/hfCzKG9+EVDHskt4ap58YKGnYIXiD73fv/6yQKrVO1lPCQ== Received: from DM5PR07CA0162.namprd07.prod.outlook.com (2603:10b6:3:ee::28) by CO6PR12MB5492.namprd12.prod.outlook.com (2603:10b6:5:35d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.15; Tue, 21 Jun 2022 08:06:47 +0000 Received: from DM6NAM11FT015.eop-nam11.prod.protection.outlook.com (2603:10b6:3:ee:cafe::62) by DM5PR07CA0162.outlook.office365.com (2603:10b6:3:ee::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.14 via Frontend Transport; Tue, 21 Jun 2022 08:06:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.236) by DM6NAM11FT015.mail.protection.outlook.com (10.13.172.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5353.14 via Frontend Transport; Tue, 21 Jun 2022 08:06:47 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Tue, 21 Jun 2022 08:06:46 +0000 Received: from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Tue, 21 Jun 2022 01:06:44 -0700 From: Xueming Li To: "Min Hu (Connor)" CC: Aman Singh , dpdk stable Subject: patch 'app/testpmd: check statistics query before printing' has been queued to stable release 20.11.6 Date: Tue, 21 Jun 2022 11:01:47 +0300 Message-ID: <20220621080301.2315720-42-xuemingl@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220621080301.2315720-1-xuemingl@nvidia.com> References: <20220621080301.2315720-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 939e6f3e-7843-46cf-2b5c-08da535cfd15 X-MS-TrafficTypeDiagnostic: CO6PR12MB5492:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FgbnqV2Ka/jrUMlSi0sYXfRK4XQiZVRKcHIstjNuXd8q5s3qD0Eb8C7OMrSlH6x01kB89qcCT694QPpoSvkoN9BCnZbCSDVa71KIIMn330dwBBjY2xSQe5a0qtcUBY+m7FG/cjENvGJVMO59wrT9CxPNauX9Vtw/cCaqJg52+XxAeKD8+h1vG3VzqrYa+R9GSU+t4b/3gQFXJisFAmM3xndUtIxGy16IlsCb02vqzjPwg77VZbA0fbCQyKr6A84z6IXAOTbwcNxJd4PgbZ0PzUf0NcetP2+gq2qs49SZzefwRog9Q3hyq6dpQpaX9Ji1EDRMhIrtPNxs3HqTkQ+9h13J2PopvmOnUuoyMcI2ZLhzj75rA7YGJ62on88X5h5GGYSgGwiHsVQWhd4oN2tJn2xW5Umn2QZUHtpJP8X5yJIsMdSfYy2C3WTsELu3RB3q8ZRlE4eGsrSi6+U2Y1VKBbKR/Rtm0sIJ6soa5gtliKlNb+nKlnrG6wRAsJjcMuPGsJdn87R5BSvOwtjqCd7B/W4qWBftV4TJcbE99PHCBkIe68HgBfboBiCnpi70QYh5mU2n69upSqzhagcz3FdPOVANESbQuU9jHqe8YI6vP76dCfjg4/jG4qynW5iy1XuJswUNZDnCpshVSIX9FQE1gLTRJX+uMx/OkT/6rlRoXFu5Ea9Bj7ziY5asFBP14NMbP8H3fbuAylAr33HmycuKqrCEN7Sn/ga2DEgUK0FKSomrsKUzB7I6yrBkzXTwCnvm/ttmXRilpIrFq1IfPeJWez5Lek9OtXTKF4RXxMzyuOchgNtTlxtbEApdtuTHV8ofDC0g9uZUudgj9L7/OW5uqN06CgSO8KOJK02X3TmwcFI= X-Forefront-Antispam-Report: CIP:12.22.5.236; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230016)(4636009)(396003)(39860400002)(376002)(346002)(136003)(36840700001)(46966006)(40470700004)(86362001)(336012)(426003)(2906002)(36860700001)(47076005)(7696005)(54906003)(6916009)(82740400003)(70586007)(81166007)(26005)(4326008)(316002)(70206006)(356005)(36756003)(8676002)(53546011)(40480700001)(1076003)(966005)(5660300002)(55016003)(16526019)(8936002)(478600001)(83380400001)(40460700003)(2616005)(82310400005)(6286002)(186003)(41300700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2022 08:06:47.3216 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 939e6f3e-7843-46cf-2b5c-08da535cfd15 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.236]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT015.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR12MB5492 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 20.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/23/22. 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/472844ca06b0e59bcdb7dc3956cfcb73e0a596d6 Thanks. Xueming Li --- >From 472844ca06b0e59bcdb7dc3956cfcb73e0a596d6 Mon Sep 17 00:00:00 2001 From: "Min Hu (Connor)" Date: Wed, 6 Apr 2022 16:45:36 +0800 Subject: [PATCH] app/testpmd: check statistics query before printing Cc: Xueming Li [ upstream commit baef6bbfad1b9596c7051f5c1fcc308310296342 ] In function 'fwd_stats_display', if function 'rte_eth_stats_get' fails, 'stats' is uncertainty value. The display result will be abnormal. This patch check the return value of 'rte_eth_stats_get' to avoid display abnormal stats. Fixes: 53324971a14e ("app/testpmd: display/clear forwarding stats on demand") Signed-off-by: Min Hu (Connor) Acked-by: Aman Singh --- app/test-pmd/config.c | 10 ++++++++-- app/test-pmd/testpmd.c | 16 ++++++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index abe2cc394c..d6b43baaf4 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -183,14 +183,20 @@ nic_stats_display(portid_t port_id) diff_ns; uint64_t mpps_rx, mpps_tx, mbps_rx, mbps_tx; struct rte_eth_stats stats; - static const char *nic_stats_border = "########################"; + int ret; if (port_id_is_invalid(port_id, ENABLED_WARN)) { print_valid_ports(); return; } - rte_eth_stats_get(port_id, &stats); + ret = rte_eth_stats_get(port_id, &stats); + if (ret != 0) { + fprintf(stderr, + "%s: Error: failed to get stats (port %u): %d", + __func__, port_id, ret); + return; + } printf("\n %s NIC statistics for port %-2d %s\n", nic_stats_border, port_id, nic_stats_border); diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 1a7488d8dc..5da22fab57 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1815,6 +1815,7 @@ fwd_stats_display(void) struct rte_port *port; streamid_t sm_id; portid_t pt_id; + int ret; int i; memset(ports_stats, 0, sizeof(ports_stats)); @@ -1844,7 +1845,13 @@ fwd_stats_display(void) pt_id = fwd_ports_ids[i]; port = &ports[pt_id]; - rte_eth_stats_get(pt_id, &stats); + ret = rte_eth_stats_get(pt_id, &stats); + if (ret != 0) { + fprintf(stderr, + "%s: Error: failed to get stats (port %u): %d", + __func__, pt_id, ret); + continue; + } stats.ipackets -= port->stats.ipackets; stats.opackets -= port->stats.opackets; stats.ibytes -= port->stats.ibytes; @@ -1936,11 +1943,16 @@ fwd_stats_reset(void) { streamid_t sm_id; portid_t pt_id; + int ret; int i; for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) { pt_id = fwd_ports_ids[i]; - rte_eth_stats_get(pt_id, &ports[pt_id].stats); + ret = rte_eth_stats_get(pt_id, &ports[pt_id].stats); + if (ret != 0) + fprintf(stderr, + "%s: Error: failed to clear stats (port %u):%d", + __func__, pt_id, ret); } for (sm_id = 0; sm_id < cur_fwd_config.nb_fwd_streams; sm_id++) { struct fwd_stream *fs = fwd_streams[sm_id]; -- 2.35.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-06-21 15:37:51.184509091 +0800 +++ 0041-app-testpmd-check-statistics-query-before-printing.patch 2022-06-21 15:37:49.037784585 +0800 @@ -1 +1 @@ -From baef6bbfad1b9596c7051f5c1fcc308310296342 Mon Sep 17 00:00:00 2001 +From 472844ca06b0e59bcdb7dc3956cfcb73e0a596d6 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit baef6bbfad1b9596c7051f5c1fcc308310296342 ] @@ -13 +15,0 @@ -Cc: stable@dpdk.org @@ -23 +25 @@ -index cc8e7aa138..bd689f9f86 100644 +index abe2cc394c..d6b43baaf4 100644 @@ -26 +28 @@ -@@ -249,14 +249,20 @@ nic_stats_display(portid_t port_id) +@@ -183,14 +183,20 @@ nic_stats_display(portid_t port_id) @@ -50 +52 @@ -index fe2ce19f99..79bb23264b 100644 +index 1a7488d8dc..5da22fab57 100644 @@ -53 +55 @@ -@@ -1982,6 +1982,7 @@ fwd_stats_display(void) +@@ -1815,6 +1815,7 @@ fwd_stats_display(void) @@ -61 +63 @@ -@@ -2013,7 +2014,13 @@ fwd_stats_display(void) +@@ -1844,7 +1845,13 @@ fwd_stats_display(void) @@ -76 +78 @@ -@@ -2108,11 +2115,16 @@ fwd_stats_reset(void) +@@ -1936,11 +1943,16 @@ fwd_stats_reset(void)