Skip to contentSkip to conversation

examples/l3fwd: fib skip tx queue drain on first iteration

PATCH Applied Conor Walsh 4 participants 4 messages Apr 21, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 examples/l3fwd: fib skip tx queue drain on first iteration

The commit a8f8b672d575 ("examples/l3fwd: skip Tx queue drain on first iteration") implemented a change to the em and lpm lookup methods to prevent the TX queue drain running in the first iteration of their packet processing loops. This patch introduces this change into the fib lookup method, this was done to keep the fib code aligned with the em and lpm code.

---
 examples/l3fwd/l3fwd_fib.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
examples/l3fwd/l3fwd_fib.c +5 -4
index c7d7689a94..1787229942 100644
@@ -179,8 +179,6 @@ fib_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];
 
@@ -200,9 +198,10 @@ fib_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. */
 		diff_tsc = cur_tsc - prev_tsc;
@@ -233,6 +232,8 @@ fib_main_loop(__rte_unused void *dummy)
 			/* Use fib to lookup port IDs and transmit them. */
 			fib_send_packets(nb_rx, pkts_burst,	portid, qconf);
 		}
+
+		cur_tsc = rte_rdtsc();
 	}
 
 	return 0;
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 39 lines

The commit a8f8b672d575 ("examples/l3fwd: skip Tx queue drain on first iteration") implemented a change to the em and lpm lookup methods to prevent the TX queue drain running in the first iteration of their packet processing loops. This patch introduces this change into the fib lookup method, this was done to keep the fib code aligned with the em and lpm code.

---
 examples/l3fwd/l3fwd_fib.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
examples/l3fwd/l3fwd_fib.c +3 -4
index c7d7689a94..1787229942 100644
@@ -179,8 +179,6 @@ fib_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];
 
@@ -200,9 +198,10 @@ fib_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. */
 		diff_tsc = cur_tsc - prev_tsc;

examples/l3fwd/l3fwd_fib.c fib_main_loop(__rte_unused void *dummy)

Quoted 9 lines
examples/l3fwd/l3fwd_fib.c +2 -1
@@ -233,6 +232,8 @@ fib_main_loop(__rte_unused void *dummy)
 			/* Use fib to lookup port IDs and transmit them. */
 			fib_send_packets(nb_rx, pkts_burst,	portid, qconf);
 		}
+
+		cur_tsc = rte_rdtsc();
 	}
 
 	return 0;
--
Quoted 1 line

2.25.1

Acked-by on v1 1/1
#2 lore raw
In reply to Conor Walsh
Quoted 40 lines · Conor Walsh

The commit a8f8b672d575 ("examples/l3fwd: skip Tx queue drain on first iteration") implemented a change to the em and lpm lookup methods to prevent the TX queue drain running in the first iteration of their packet processing loops. This patch introduces this change into the fib lookup method, this was done to keep the fib code aligned with the em and lpm code.

---
  examples/l3fwd/l3fwd_fib.c | 9 +++++----
  1 file changed, 5 insertions(+), 4 deletions(-)
examples/l3fwd/l3fwd_fib.c +3 -4
index c7d7689a94..1787229942 100644
@@ -179,8 +179,6 @@ fib_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];
 
@@ -200,9 +198,10 @@ fib_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. */
  		diff_tsc = cur_tsc - prev_tsc;

examples/l3fwd/l3fwd_fib.c fib_main_loop(__rte_unused void *dummy) · line 239

Quoted 8 lines
examples/l3fwd/l3fwd_fib.c +2 -0
@@ -233,6 +232,8 @@ fib_main_loop(__rte_unused void *dummy)
  			/* Use fib to lookup port IDs and transmit them. */
  			fib_send_packets(nb_rx, pkts_burst,	portid, qconf);
  		}
+
+		cur_tsc = rte_rdtsc();
  	}
 
  	return 0;
Signature · 2 lines
Regards,
Vladimir
#3 lore raw
Quoted 10 lines
Quoted 8 lines

The commit a8f8b672d575 ("examples/l3fwd: skip Tx queue drain on first iteration") implemented a change to the em and lpm lookup methods to prevent the TX queue drain running in the first iteration of their packet processing loops. This patch introduces this change into the fib lookup method, this was done to keep the fib code aligned with the em and lpm code.

Applied, thanks