examples/l3fwd: skip Tx queue drain on first FIB iteration
authorConor Walsh <conor.walsh@intel.com>
Wed, 21 Apr 2021 12:48:42 +0000 (12:48 +0000)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 21 Apr 2021 18:43:41 +0000 (20:43 +0200)
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 applies the same change into the new FIB lookup method.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
examples/l3fwd/l3fwd_fib.c

index c7d7689..1787229 100644 (file)
@@ -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;