[v1,1/2] example: generator: remove busy wait for direct mode receive

Message ID 1518537609-25649-2-git-send-email-odpbot@yandex.ru
State New
Headers show
Series
  • odp_generator: miscellaneous changes to improve RX side
Related show

Commit Message

Github ODP bot Feb. 13, 2018, 4 p.m.
From: Bogdan Pricope <bogdan.pricope@linaro.org>


Add timeout to avoid unnecessary loops on low traffic.

Signed-off-by: Bogdan Pricope <bogdan.pricope@linaro.org>

---
/** Email created from pull request 475 (bogdanPricope:master_generator_rx_pr)
 ** https://github.com/Linaro/odp/pull/475
 ** Patch: https://github.com/Linaro/odp/pull/475.patch
 ** Base sha: 41b3fa2cd994a7ef68290a07dcde5564e4640847
 ** Merge commit sha: 1e80eb73f8a105ac227aa7be2b861e2c12491802
 **/
 example/generator/odp_generator.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
index f8c787e44..440b6b287 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -939,6 +939,7 @@  static int gen_recv_direct_thread(void *arg)
 	odp_packet_t pkts[MAX_RX_BURST];
 	int pkt_cnt, burst_size;
 	odp_pktin_queue_t pktin;
+	uint64_t wait = odp_pktin_wait_time(ODP_TIME_SEC_IN_NS);
 
 	thr = odp_thread_id();
 	thr_args = (thread_args_t *)arg;
@@ -952,8 +953,7 @@  static int gen_recv_direct_thread(void *arg)
 		if (thr_args->stop)
 			break;
 
-		pkt_cnt = odp_pktin_recv_tmo(pktin, pkts, burst_size,
-					     ODP_PKTIN_NO_WAIT);
+		pkt_cnt = odp_pktin_recv_tmo(pktin, pkts, burst_size, wait);
 
 		if (pkt_cnt > 0) {
 			process_pkts(thr, thr_args, pkts, pkt_cnt);