[dpdk-stable] patch 'app/testpmd: fix burst percentage calculation' has been queued to LTS release 18.11.10

Kevin Traynor ktraynor at redhat.com
Thu Aug 20 17:33:21 CEST 2020


Hi,

FYI, your patch has been queued to LTS release 18.11.10

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/25/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.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable-queue/commit/f1b7643e624b44873ae9673d14cf57c0fd277639

Thanks.

Kevin.

---
>From f1b7643e624b44873ae9673d14cf57c0fd277639 Mon Sep 17 00:00:00 2001
From: Honnappa Nagarahalli <honnappa.nagarahalli at arm.com>
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 <honnappa.nagarahalli at arm.com>
Reviewed-by: Phil Yang <phil.yang at arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang at arm.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit at intel.com>
Tested-by: Phil Yang <phil.yang at arm.com>
Tested-by: Ali Alnubani <alialnu at mellanox.com>
---
 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 a32eae750c..018bd32ec6 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1326,7 +1326,7 @@ 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;
@@ -1357,6 +1357,6 @@ 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) {
@@ -1369,5 +1369,5 @@ pkt_burst_stats_display(const char *rx_tx, struct pkt_burst_stats *pbs)
 		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)) {
-- 
2.26.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-08-20 16:26:16.469640556 +0100
+++ 0016-app-testpmd-fix-burst-percentage-calculation.patch	2020-08-20 16:26:15.801324115 +0100
@@ -1 +1 @@
-From 85de481a716a14a3eb89869928d96b539b1f0b62 Mon Sep 17 00:00:00 2001
+From f1b7643e624b44873ae9673d14cf57c0fd277639 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 85de481a716a14a3eb89869928d96b539b1f0b62 ]
+
@@ -11 +12,0 @@
-Cc: stable at dpdk.org
@@ -24 +25 @@
-index 4989d22ca8..2e1493da23 100644
+index a32eae750c..018bd32ec6 100644
@@ -27 +28 @@
-@@ -1693,7 +1693,7 @@ static void
+@@ -1326,7 +1326,7 @@ static void
@@ -38 +39 @@
-@@ -1724,6 +1724,6 @@ pkt_burst_stats_display(const char *rx_tx, struct pkt_burst_stats *pbs)
+@@ -1357,6 +1357,6 @@ pkt_burst_stats_display(const char *rx_tx, struct pkt_burst_stats *pbs)
@@ -47 +48 @@
-@@ -1736,5 +1736,5 @@ pkt_burst_stats_display(const char *rx_tx, struct pkt_burst_stats *pbs)
+@@ -1369,5 +1369,5 @@ pkt_burst_stats_display(const char *rx_tx, struct pkt_burst_stats *pbs)



More information about the stable mailing list