The -t command line argument specifies the length of time the application
should run before exiting, but this doesn't always work in queue mode as
the odp_schedule() call may not return if no packets are received.

Signed-off-by: Stuart Haslam <stuart.has...@linaro.org>
---
 test/performance/odp_l2fwd.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
index 64fc1b2..75e5cb8 100644
--- a/test/performance/odp_l2fwd.c
+++ b/test/performance/odp_l2fwd.c
@@ -131,6 +131,7 @@ static void *pktio_queue_thread(void *arg)
        odp_packet_t pkt;
        odp_event_t ev;
        thread_args_t *thr_args = arg;
+       uint64_t wait;
 
        stats_t *stats = calloc(1, sizeof(stats_t));
        *thr_args->stats = stats;
@@ -140,10 +141,14 @@ static void *pktio_queue_thread(void *arg)
        printf("[%02i] QUEUE mode\n", thr);
        odp_barrier_wait(&barrier);
 
+       wait = odp_schedule_wait_time(ODP_TIME_MSEC * 100);
+
        /* Loop packets */
        while (!exit_threads) {
                /* Use schedule to get buf from any input queue */
-               ev  = odp_schedule(NULL, ODP_SCHED_WAIT);
+               ev  = odp_schedule(NULL, wait);
+               if (ev == ODP_EVENT_INVALID)
+                       continue;
                pkt = odp_packet_from_event(ev);
 
                /* Drop packets with errors */
-- 
2.1.1

_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to