From 064af297d4614368769c204acf610ea185588c7a Mon Sep 17 00:00:00 2001 From: Stuart Haslam Date: Thu, 10 Sep 2015 12:55:16 +0100 Subject: test/performance: l2fwd: obey -t in queue mode 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 Signed-off-by: Maxim Uvarov --- 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 812d47f..754360e 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -137,6 +137,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; @@ -146,10 +147,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 */ -- cgit v1.2.3