diff options
author | Stuart Haslam <stuart.haslam@linaro.org> | 2015-09-10 12:55:16 +0100 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2015-10-15 12:03:48 +0300 |
commit | 064af297d4614368769c204acf610ea185588c7a (patch) | |
tree | 8aac8f254cfec189d8ff483ec958683fa9bb87b4 | |
parent | 356261050e7f8b57cd818521235e197b9ed8e17e (diff) |
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 <stuart.haslam@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
-rw-r--r-- | test/performance/odp_l2fwd.c | 7 |
1 files changed, 6 insertions, 1 deletions
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 */ |