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

luca.boccassi at gmail.com luca.boccassi at gmail.com
Fri Jul 24 13:59:19 CEST 2020


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 <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 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 <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")
-Cc: stable at dpdk.org
 
 Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli at arm.com>
 Reviewed-by: Phil Yang <phil.yang at arm.com>
@@ -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;
  	}


More information about the stable mailing list