[v12,3/5] example: l2fwd_simple: test interruptible sleep in odp_pktin_recv_tmo

Message ID 1515596425-24694-4-git-send-email-odpbot@yandex.ru
State New
Headers show
Series
  • linux-generic: pktio: add null pktio support
Related show

Commit Message

Github ODP bot Jan. 10, 2018, 3 p.m.
From: Juha-Matti Tilli <juha-matti.tilli@iki.fi>


Test interruptible sleep within odp_pktin_recv_tmo by using the
l2fwd_simple test application. This gives us confidence that
odp_pktin_recv_tmo changes work with pktio mechanisms such as .pcap
not offering the interrupt-driven implementations.

Signed-off-by: Juha-Matti Tilli <juha-matti.tilli@iki.fi>

---
/** Email created from pull request 365 (jmtilli:nullpktio)
 ** https://github.com/Linaro/odp/pull/365
 ** Patch: https://github.com/Linaro/odp/pull/365.patch
 ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea
 ** Merge commit sha: b7570030cbadfa847595dcf4adec3ef33cea31c5
 **/
 example/l2fwd_simple/odp_l2fwd_simple.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch

diff --git a/example/l2fwd_simple/odp_l2fwd_simple.c b/example/l2fwd_simple/odp_l2fwd_simple.c
index 2592c3744..ad8661717 100644
--- a/example/l2fwd_simple/odp_l2fwd_simple.c
+++ b/example/l2fwd_simple/odp_l2fwd_simple.c
@@ -88,6 +88,7 @@  static int run_worker(void *arg ODP_UNUSED)
 	odp_packet_t pkt_tbl[MAX_PKT_BURST];
 	int pkts, sent, tx_drops, i;
 	int total_pkts = 0;
+	uint64_t wait_time = odp_pktin_wait_time(ODP_TIME_SEC_IN_NS);
 
 	if (odp_pktio_start(global.if0)) {
 		printf("unable to start input interface\n");
@@ -103,7 +104,7 @@  static int run_worker(void *arg ODP_UNUSED)
 
 	while (!exit_thr) {
 		pkts = odp_pktin_recv_tmo(global.if0in, pkt_tbl, MAX_PKT_BURST,
-					  ODP_PKTIN_NO_WAIT);
+					  wait_time);
 
 		if (odp_unlikely(pkts <= 0))
 			continue;