DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] examples/l3fwd: fix TX burst queue drain edge case
@ 2021-02-23 18:23 Kathleen Capella
  2021-03-24 17:15 ` Thomas Monjalon
  2021-04-08 21:35 ` [dpdk-dev] [PATCH v2] examples/l3fwd: skip TX queue drain on first iteration Kathleen Capella
  0 siblings, 2 replies; 5+ messages in thread
From: Kathleen Capella @ 2021-02-23 18:23 UTC (permalink / raw)
  To: dev; +Cc: nd, honnappa.nagarahalli, kathleen.capella

Initialize prev_tsc to cur_tsc. This avoids running the TX queue drain
in the first iteration of the packet processing loop.

Fixes: af75078fece3 ("first public release")

Signed-off-by: Kathleen Capella <kathleen.capella@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
 examples/l3fwd/l3fwd_em.c  | 9 +++++----
 examples/l3fwd/l3fwd_lpm.c | 9 +++++----
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c
index 9996bfba3..01f8dff48 100644
--- a/examples/l3fwd/l3fwd_em.c
+++ b/examples/l3fwd/l3fwd_em.c
@@ -629,8 +629,6 @@ em_main_loop(__rte_unused void *dummy)
 	const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) /
 		US_PER_S * BURST_TX_DRAIN_US;
 
-	prev_tsc = 0;
-
 	lcore_id = rte_lcore_id();
 	qconf = &lcore_conf[lcore_id];
 
@@ -650,9 +648,10 @@ em_main_loop(__rte_unused void *dummy)
 			lcore_id, portid, queueid);
 	}
 
-	while (!force_quit) {
+	cur_tsc = rte_rdtsc();
+	prev_tsc = cur_tsc;
 
-		cur_tsc = rte_rdtsc();
+	while (!force_quit) {
 
 		/*
 		 * TX burst queue drain
@@ -692,6 +691,8 @@ em_main_loop(__rte_unused void *dummy)
 							portid, qconf);
 #endif
 		}
+
+		cur_tsc = rte_rdtsc();
 	}
 
 	return 0;
diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index 3dcf1fef1..375746fef 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -185,8 +185,6 @@ lpm_main_loop(__rte_unused void *dummy)
 	const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) /
 		US_PER_S * BURST_TX_DRAIN_US;
 
-	prev_tsc = 0;
-
 	lcore_id = rte_lcore_id();
 	qconf = &lcore_conf[lcore_id];
 
@@ -206,9 +204,10 @@ lpm_main_loop(__rte_unused void *dummy)
 			lcore_id, portid, queueid);
 	}
 
-	while (!force_quit) {
+	cur_tsc = rte_rdtsc();
+	prev_tsc = cur_tsc;
 
-		cur_tsc = rte_rdtsc();
+	while (!force_quit) {
 
 		/*
 		 * TX burst queue drain
@@ -249,6 +248,8 @@ lpm_main_loop(__rte_unused void *dummy)
 							portid, qconf);
 #endif /* X86 */
 		}
+
+		cur_tsc = rte_rdtsc();
 	}
 
 	return 0;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/l3fwd: fix TX burst queue drain edge case
  2021-02-23 18:23 [dpdk-dev] [PATCH] examples/l3fwd: fix TX burst queue drain edge case Kathleen Capella
@ 2021-03-24 17:15 ` Thomas Monjalon
  2021-03-26 16:27   ` Kathleen Capella
  2021-04-08 21:35 ` [dpdk-dev] [PATCH v2] examples/l3fwd: skip TX queue drain on first iteration Kathleen Capella
  1 sibling, 1 reply; 5+ messages in thread
From: Thomas Monjalon @ 2021-03-24 17:15 UTC (permalink / raw)
  To: Kathleen Capella; +Cc: dev, nd, honnappa.nagarahalli

23/02/2021 19:23, Kathleen Capella:
> Initialize prev_tsc to cur_tsc. This avoids running the TX queue drain
> in the first iteration of the packet processing loop.

Is it really a fix? What was broken?
Isn't it an optimization?

> Fixes: af75078fece3 ("first public release")

If it's really a fix, we should probably backport it, so
Cc: stable@dpdk.org

> Signed-off-by: Kathleen Capella <kathleen.capella@arm.com>
> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/l3fwd: fix TX burst queue drain edge case
  2021-03-24 17:15 ` Thomas Monjalon
@ 2021-03-26 16:27   ` Kathleen Capella
  0 siblings, 0 replies; 5+ messages in thread
From: Kathleen Capella @ 2021-03-26 16:27 UTC (permalink / raw)
  To: thomas; +Cc: dev, nd, Honnappa Nagarahalli


> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Wednesday, March 24, 2021 1:16 PM
> To: Kathleen Capella <Kathleen.Capella@arm.com>
> Cc: dev@dpdk.org; nd <nd@arm.com>; Honnappa Nagarahalli
> <Honnappa.Nagarahalli@arm.com>
> Subject: Re: [dpdk-dev] [PATCH] examples/l3fwd: fix TX burst queue drain edge
> case
> 
> 23/02/2021 19:23, Kathleen Capella:
> > Initialize prev_tsc to cur_tsc. This avoids running the TX queue drain
> > in the first iteration of the packet processing loop.
> 
> Is it really a fix? What was broken?
> Isn't it an optimization?

It could be considered an optimization since effectively it prevents entering the if statement on the
first iteration of the loop. I will remove the "fixes" line and reword the subject line.
> 
> > Fixes: af75078fece3 ("first public release")
> 
> If it's really a fix, we should probably backport it, so
> Cc: stable@dpdk.org

[Kathleen Capella] 
It is not really a significant problem to be fixed in previous releases so it does not need to be backported.
> 
> > Signed-off-by: Kathleen Capella <kathleen.capella@arm.com>
> > Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> 
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH v2] examples/l3fwd: skip TX queue drain on first iteration
  2021-02-23 18:23 [dpdk-dev] [PATCH] examples/l3fwd: fix TX burst queue drain edge case Kathleen Capella
  2021-03-24 17:15 ` Thomas Monjalon
@ 2021-04-08 21:35 ` Kathleen Capella
  2021-04-20  1:12   ` Thomas Monjalon
  1 sibling, 1 reply; 5+ messages in thread
From: Kathleen Capella @ 2021-04-08 21:35 UTC (permalink / raw)
  To: dev; +Cc: nd, honnappa.nagarahalli, kathleen.capella, thomas

Initialize prev_tsc to cur_tsc. This avoids running the TX queue drain
in the first iteration of the packet processing loop.

Signed-off-by: Kathleen Capella <kathleen.capella@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
 examples/l3fwd/l3fwd_em.c  | 9 +++++----
 examples/l3fwd/l3fwd_lpm.c | 9 +++++----
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c
index 9996bfba3..01f8dff48 100644
--- a/examples/l3fwd/l3fwd_em.c
+++ b/examples/l3fwd/l3fwd_em.c
@@ -629,8 +629,6 @@ em_main_loop(__rte_unused void *dummy)
 	const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) /
 		US_PER_S * BURST_TX_DRAIN_US;
 
-	prev_tsc = 0;
-
 	lcore_id = rte_lcore_id();
 	qconf = &lcore_conf[lcore_id];
 
@@ -650,9 +648,10 @@ em_main_loop(__rte_unused void *dummy)
 			lcore_id, portid, queueid);
 	}
 
-	while (!force_quit) {
+	cur_tsc = rte_rdtsc();
+	prev_tsc = cur_tsc;
 
-		cur_tsc = rte_rdtsc();
+	while (!force_quit) {
 
 		/*
 		 * TX burst queue drain
@@ -692,6 +691,8 @@ em_main_loop(__rte_unused void *dummy)
 							portid, qconf);
 #endif
 		}
+
+		cur_tsc = rte_rdtsc();
 	}
 
 	return 0;
diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index 3dcf1fef1..375746fef 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -185,8 +185,6 @@ lpm_main_loop(__rte_unused void *dummy)
 	const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) /
 		US_PER_S * BURST_TX_DRAIN_US;
 
-	prev_tsc = 0;
-
 	lcore_id = rte_lcore_id();
 	qconf = &lcore_conf[lcore_id];
 
@@ -206,9 +204,10 @@ lpm_main_loop(__rte_unused void *dummy)
 			lcore_id, portid, queueid);
 	}
 
-	while (!force_quit) {
+	cur_tsc = rte_rdtsc();
+	prev_tsc = cur_tsc;
 
-		cur_tsc = rte_rdtsc();
+	while (!force_quit) {
 
 		/*
 		 * TX burst queue drain
@@ -249,6 +248,8 @@ lpm_main_loop(__rte_unused void *dummy)
 							portid, qconf);
 #endif /* X86 */
 		}
+
+		cur_tsc = rte_rdtsc();
 	}
 
 	return 0;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v2] examples/l3fwd: skip TX queue drain on first iteration
  2021-04-08 21:35 ` [dpdk-dev] [PATCH v2] examples/l3fwd: skip TX queue drain on first iteration Kathleen Capella
@ 2021-04-20  1:12   ` Thomas Monjalon
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2021-04-20  1:12 UTC (permalink / raw)
  To: Kathleen Capella; +Cc: dev, nd, honnappa.nagarahalli

08/04/2021 23:35, Kathleen Capella:
> Initialize prev_tsc to cur_tsc. This avoids running the TX queue drain
> in the first iteration of the packet processing loop.
> 
> Signed-off-by: Kathleen Capella <kathleen.capella@arm.com>
> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>

Applied, thanks




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-20  1:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-23 18:23 [dpdk-dev] [PATCH] examples/l3fwd: fix TX burst queue drain edge case Kathleen Capella
2021-03-24 17:15 ` Thomas Monjalon
2021-03-26 16:27   ` Kathleen Capella
2021-04-08 21:35 ` [dpdk-dev] [PATCH v2] examples/l3fwd: skip TX queue drain on first iteration Kathleen Capella
2021-04-20  1:12   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).