patch 'examples/l2fwd-crypto: fix stats refresh rate' has been queued to stable release 20.11.6

Xueming Li xuemingl at nvidia.com
Tue Jun 21 10:01:27 CEST 2022


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/c29b05c2168877a7045ea3d5ffedfcdcdbf212d5

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From c29b05c2168877a7045ea3d5ffedfcdcdbf212d5 Mon Sep 17 00:00:00 2001
From: Raja Zidane <rzidane at nvidia.com>
Date: Thu, 7 Apr 2022 14:42:49 +0300
Subject: [PATCH] examples/l2fwd-crypto: fix stats refresh rate
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit af676be9e6671b25c69af2aa5fc2d40d562137f6 ]

TIMER_MILLISECOND is defined as the number of cpu cycles per millisecond,
current definition is correct for cores with frequency of 2GHZ, for cores
with different frequency, it caused different periods between refresh,
(i.e. the definition is about 14ms on ARM cores).
The devarg that stated the period between stats print was not used,
instead, it was always defaulted to 10 seconds (on 2GHZ core).

Use DPDK API to get CPU frequency, to define TIMER_MILLISECOND.
Use the refresh period devarg instead of defaulting to 10s always.

Fixes: 387259bd6c67 ("examples/l2fwd-crypto: add sample application")

Signed-off-by: Raja Zidane <rzidane at nvidia.com>
Acked-by: Matan Azrad <matan at nvidia.com>
Acked-by: Akhil Goyal <gakhil at marvell.com>
---
 examples/l2fwd-crypto/main.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index c1e26f5dd4..755a28f341 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -252,11 +252,9 @@ struct l2fwd_port_statistics port_statistics[RTE_MAX_ETHPORTS];
 struct l2fwd_crypto_statistics crypto_statistics[RTE_CRYPTO_MAX_DEVS];
 
 /* A tsc-based timer responsible for triggering statistics printout */
-#define TIMER_MILLISECOND 2000000ULL /* around 1ms at 2 Ghz */
+#define TIMER_MILLISECOND (rte_get_tsc_hz() / 1000)
 #define MAX_TIMER_PERIOD 86400UL /* 1 day max */
-
-/* default period is 10 seconds */
-static int64_t timer_period = 10 * TIMER_MILLISECOND * 1000;
+#define DEFAULT_TIMER_PERIOD 10UL
 
 /* Print out statistics on packets dropped */
 static void
@@ -879,18 +877,17 @@ l2fwd_main_loop(struct l2fwd_crypto_options *options)
 			}
 
 			/* if timer is enabled */
-			if (timer_period > 0) {
+			if (options->refresh_period > 0) {
 
 				/* advance the timer */
 				timer_tsc += diff_tsc;
 
 				/* if timer has reached its timeout */
 				if (unlikely(timer_tsc >=
-						(uint64_t)timer_period)) {
+						options->refresh_period)) {
 
 					/* do this only on main core */
-					if (lcore_id == rte_get_main_lcore()
-						&& options->refresh_period) {
+					if (lcore_id == rte_get_main_lcore()) {
 						print_stats();
 						timer_tsc = 0;
 					}
@@ -1451,7 +1448,8 @@ l2fwd_crypto_default_options(struct l2fwd_crypto_options *options)
 {
 	options->portmask = 0xffffffff;
 	options->nb_ports_per_lcore = 1;
-	options->refresh_period = 10000;
+	options->refresh_period = DEFAULT_TIMER_PERIOD *
+					TIMER_MILLISECOND * 1000;
 	options->single_lcore = 0;
 	options->sessionless = 0;
 
-- 
2.35.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-06-21 15:37:50.262673845 +0800
+++ 0021-examples-l2fwd-crypto-fix-stats-refresh-rate.patch	2022-06-21 15:37:48.994451098 +0800
@@ -1 +1 @@
-From af676be9e6671b25c69af2aa5fc2d40d562137f6 Mon Sep 17 00:00:00 2001
+From c29b05c2168877a7045ea3d5ffedfcdcdbf212d5 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit af676be9e6671b25c69af2aa5fc2d40d562137f6 ]
@@ -17 +19,0 @@
-Cc: stable at dpdk.org
@@ -27 +29 @@
-index bbdb263143..b1e2613ccf 100644
+index c1e26f5dd4..755a28f341 100644
@@ -44 +46 @@
-@@ -894,18 +892,17 @@ l2fwd_main_loop(struct l2fwd_crypto_options *options)
+@@ -879,18 +877,17 @@ l2fwd_main_loop(struct l2fwd_crypto_options *options)
@@ -66 +68 @@
-@@ -1481,7 +1478,8 @@ l2fwd_crypto_default_options(struct l2fwd_crypto_options *options)
+@@ -1451,7 +1448,8 @@ l2fwd_crypto_default_options(struct l2fwd_crypto_options *options)


More information about the stable mailing list