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 0D9C7A0518 for ; Fri, 24 Jul 2020 14:08:49 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 063691C039; Fri, 24 Jul 2020 14:08:49 +0200 (CEST) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by dpdk.org (Postfix) with ESMTP id 5E3DF1C039 for ; Fri, 24 Jul 2020 14:08:48 +0200 (CEST) Received: by mail-wr1-f43.google.com with SMTP id r12so8056140wrj.13 for ; Fri, 24 Jul 2020 05:08:48 -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=ACXaVz+Js0zX4Hia8pDL5j+CRSYI0lnVceGqLbGIP68=; b=dsF40wChAZbVc2uFYA28VOu0N8YuT9CTg7u8tWlb4EUp6xtYVztFc+1tro/lhXZx/U LUWZue6aghrmrvBZHMi+WG8OOqw8hrpdKThBGElzD20qDLgCyn8V5EQHC/MqpC1BGZj6 Zu7JsAUUZL+HfkrFkphYiQRBY+VaG3pMyXJgMGDpBZF19JemPQVRK+1NGXOrDTqctyQI orTSvflKpl5NwGa9eYjNpKGK1cHbcvq/4iBHJ2xBuM9mZgMDvVtBQmdqGvjc84Fzg0l2 qUIXfUpvCkNHSL4ScODjRnDg0aeUF5HbsPJpPvUoDTWkm7AZ16j9GMIrWOd2loydejJa DAzg== 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=ACXaVz+Js0zX4Hia8pDL5j+CRSYI0lnVceGqLbGIP68=; b=jfVvP2Ov3HrR/1WT0399ikORC2tDKJEsKaPvBDMT3GsXvf3JTC/em7iOfZZJixVyzr Qdhtq7G4OgSQnp99TLM3fP1DpnFBI9NPOwT+laT4VVsD7KDmB1aWybA1T9tYIutvjkCr CwpRxpzo59Km7dF40sWATbEJPXg/W2iQQUdVti74GcBub1NPSOYRYvDYcrWNmjfW6L1x F2zh+qJ0LSLJcBbLsW4s7R5vuIHcUo0jJvgXHWfVBHrGT4T4fQQvrDV9sHuyzIjUxbZc TkMJ2kAidHSR+5zWyS0PH6xuWwV7I2Wy1f+cxb9I3Pej+TZlUtXItksPmNEcL6nL9Ipe YlHA== X-Gm-Message-State: AOAM532xzTTBvPKVxpuLT/zvpcKZ5KIW2oI8hhF3GxV7Ixpa/I0an6MN y/mkrxfA5DZXSsNWHBuUZeRMrC8LxawybQ== X-Google-Smtp-Source: ABdhPJzLzxcgAoD2i+Ev7VQ/2Xpr7UqOGkAAuVQC43PJz6JsPtEAtLuvJfBlVeFgyuB99uyS4mG3Zg== X-Received: by 2002:adf:df85:: with SMTP id z5mr8127493wrl.267.1595592528104; Fri, 24 Jul 2020 05:08:48 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id i4sm1195803wrw.26.2020.07.24.05.08.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jul 2020 05:08:47 -0700 (PDT) From: luca.boccassi@gmail.com To: Honnappa Nagarahalli Cc: Phil Yang , Ruifeng Wang , Ferruh Yigit , Ali Alnubani , dpdk stable Date: Fri, 24 Jul 2020 12:59:19 +0100 Message-Id: <20200724120030.1863487-121-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200724120030.1863487-1-luca.boccassi@gmail.com> References: <20200724120030.1863487-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'app/testpmd: fix burst percentage calculation' 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 07/26/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 b3fea2ae5384e9fceea342583d1e9180856239f7 Mon Sep 17 00:00:00 2001 From: Honnappa Nagarahalli Date: Mon, 6 Jul 2020 18:32:30 -0500 Subject: [PATCH] app/testpmd: fix burst percentage calculation [ upstream commit 85de481a716a14a3eb89869928d96b539b1f0b62 ] The burst % calculation can over flow due to multiplication. Fix the multiplication and increase the size of variables to 64b. Fixes: af75078fece3 ("first public release") Signed-off-by: Honnappa Nagarahalli Reviewed-by: Phil Yang Reviewed-by: Ruifeng Wang Reviewed-by: Ferruh Yigit Tested-by: Phil Yang Tested-by: Ali Alnubani --- app/test-pmd/testpmd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 0b126594b..8ab6cfc6c 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1430,9 +1430,9 @@ init_fwd_streams(void) static void pkt_burst_stats_display(const char *rx_tx, struct pkt_burst_stats *pbs) { - unsigned int total_burst; - unsigned int nb_burst; - unsigned int burst_stats[3]; + uint64_t total_burst; + uint64_t nb_burst; + uint64_t burst_stats[3]; uint16_t pktnb_stats[3]; uint16_t nb_pkt; int burst_percent[3]; @@ -1461,8 +1461,8 @@ pkt_burst_stats_display(const char *rx_tx, struct pkt_burst_stats *pbs) } if (total_burst == 0) return; - burst_percent[0] = (burst_stats[0] * 100) / total_burst; - printf(" %s-bursts : %u [%d%% of %d pkts", rx_tx, total_burst, + burst_percent[0] = (double)burst_stats[0] / total_burst * 100; + printf(" %s-bursts : %"PRIu64" [%d%% of %d pkts", rx_tx, total_burst, burst_percent[0], (int) pktnb_stats[0]); if (burst_stats[0] == total_burst) { printf("]\n"); @@ -1473,7 +1473,7 @@ pkt_burst_stats_display(const char *rx_tx, struct pkt_burst_stats *pbs) 100 - burst_percent[0], pktnb_stats[1]); return; } - burst_percent[1] = (burst_stats[1] * 100) / total_burst; + burst_percent[1] = (double)burst_stats[1] / total_burst * 100; burst_percent[2] = 100 - (burst_percent[0] + burst_percent[1]); if ((burst_percent[1] == 0) || (burst_percent[2] == 0)) { printf(" + %d%% of others]\n", 100 - burst_percent[0]); -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-07-24 12:53:53.205836121 +0100 +++ 0121-app-testpmd-fix-burst-percentage-calculation.patch 2020-07-24 12:53:48.411008770 +0100 @@ -1,14 +1,15 @@ -From 85de481a716a14a3eb89869928d96b539b1f0b62 Mon Sep 17 00:00:00 2001 +From b3fea2ae5384e9fceea342583d1e9180856239f7 Mon Sep 17 00:00:00 2001 From: Honnappa Nagarahalli Date: Mon, 6 Jul 2020 18:32:30 -0500 Subject: [PATCH] app/testpmd: fix burst percentage calculation +[ upstream commit 85de481a716a14a3eb89869928d96b539b1f0b62 ] + The burst % calculation can over flow due to multiplication. Fix the multiplication and increase the size of variables to 64b. Fixes: af75078fece3 ("first public release") -Cc: stable@dpdk.org Signed-off-by: Honnappa Nagarahalli Reviewed-by: Phil Yang @@ -21,10 +22,10 @@ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c -index 4989d22ca..2e1493da2 100644 +index 0b126594b..8ab6cfc6c 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c -@@ -1692,9 +1692,9 @@ init_fwd_streams(void) +@@ -1430,9 +1430,9 @@ init_fwd_streams(void) static void pkt_burst_stats_display(const char *rx_tx, struct pkt_burst_stats *pbs) { @@ -37,7 +38,7 @@ uint16_t pktnb_stats[3]; uint16_t nb_pkt; int burst_percent[3]; -@@ -1723,8 +1723,8 @@ pkt_burst_stats_display(const char *rx_tx, struct pkt_burst_stats *pbs) +@@ -1461,8 +1461,8 @@ pkt_burst_stats_display(const char *rx_tx, struct pkt_burst_stats *pbs) } if (total_burst == 0) return; @@ -48,7 +49,7 @@ burst_percent[0], (int) pktnb_stats[0]); if (burst_stats[0] == total_burst) { printf("]\n"); -@@ -1735,7 +1735,7 @@ pkt_burst_stats_display(const char *rx_tx, struct pkt_burst_stats *pbs) +@@ -1473,7 +1473,7 @@ pkt_burst_stats_display(const char *rx_tx, struct pkt_burst_stats *pbs) 100 - burst_percent[0], pktnb_stats[1]); return; }