examples/l3fwd: skip Tx queue drain on first iteration
authorKathleen Capella <kathleen.capella@arm.com>
Thu, 8 Apr 2021 21:35:49 +0000 (21:35 +0000)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 20 Apr 2021 01:13:38 +0000 (03:13 +0200)
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
examples/l3fwd/l3fwd_lpm.c

index 9996bfb..01f8dff 100644 (file)
@@ -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;
index 3dcf1fe..375746f 100644 (file)
@@ -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;