examples/l3fwd: skip Tx queue drain on first iteration
[dpdk.git] / examples / l3fwd / l3fwd_lpm.c
index 91eb742..375746f 100644 (file)
@@ -163,7 +163,7 @@ lpm_get_dst_port_with_ipv4(const struct lcore_conf *qconf, struct rte_mbuf *pkt,
 
 #if defined(RTE_ARCH_X86)
 #include "l3fwd_lpm_sse.h"
-#elif defined RTE_MACHINE_CPUFLAG_NEON
+#elif defined __ARM_NEON
 #include "l3fwd_lpm_neon.h"
 #elif defined(RTE_ARCH_PPC_64)
 #include "l3fwd_lpm_altivec.h"
@@ -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
@@ -240,7 +239,7 @@ lpm_main_loop(__rte_unused void *dummy)
                        if (nb_rx == 0)
                                continue;
 
-#if defined RTE_ARCH_X86 || defined RTE_MACHINE_CPUFLAG_NEON \
+#if defined RTE_ARCH_X86 || defined __ARM_NEON \
                         || defined RTE_ARCH_PPC_64
                        l3fwd_lpm_send_packets(nb_rx, pkts_burst,
                                                portid, qconf);
@@ -249,6 +248,8 @@ lpm_main_loop(__rte_unused void *dummy)
                                                        portid, qconf);
 #endif /* X86 */
                }
+
+               cur_tsc = rte_rdtsc();
        }
 
        return 0;
@@ -259,7 +260,7 @@ lpm_process_event_pkt(const struct lcore_conf *lconf, struct rte_mbuf *mbuf)
 {
        mbuf->port = lpm_get_dst_port(lconf, mbuf, mbuf->port);
 
-#if defined RTE_ARCH_X86 || defined RTE_MACHINE_CPUFLAG_NEON \
+#if defined RTE_ARCH_X86 || defined __ARM_NEON \
        || defined RTE_ARCH_PPC_64
        process_packet(mbuf, &mbuf->port);
 #else