All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kathleen Capella <kathleen.capella@arm.com>
To: dev@dpdk.org
Cc: nd@arm.com, honnappa.nagarahalli@arm.com, kathleen.capella@arm.com
Subject: [dpdk-dev] [PATCH] examples/l3fwd: fix TX burst queue drain edge case
Date: Tue, 23 Feb 2021 18:23:00 +0000	[thread overview]
Message-ID: <20210223182300.29817-1-kathleen.capella@arm.com> (raw)

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


             reply	other threads:[~2021-02-23 18:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-23 18:23 Kathleen Capella [this message]
2021-03-24 17:15 ` [dpdk-dev] [PATCH] examples/l3fwd: fix TX burst queue drain edge case 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210223182300.29817-1-kathleen.capella@arm.com \
    --to=kathleen.capella@arm.com \
    --cc=dev@dpdk.org \
    --cc=honnappa.nagarahalli@arm.com \
    --cc=nd@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.