[API-NEXT,3/3] example: generator: check and print link status

Message ID 1451051319-22073-4-git-send-email-maxim.uvarov@linaro.org
State New
Headers show

Commit Message

Maxim Uvarov Dec. 25, 2015, 1:48 p.m.
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 example/generator/odp_generator.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Patch

diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
index 93eefe9..a5b425e 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -364,12 +364,19 @@  static odp_pktio_t create_pktio(const char *dev, odp_pool_t pool)
 	if (ret)
 		EXAMPLE_ABORT("Error: unable to start %s\n", dev);
 
+	ret = odp_pktio_link_status(pktio);
+	if (ret != 1) {
+		EXAMPLE_ERR("Link for dev %s is down, exit.\n", dev);
+		exit(EXIT_FAILURE);
+	}
+
 	printf("  created pktio:%02" PRIu64
 	       ", dev:%s, queue mode (ATOMIC queues)\n"
 	       "          default pktio%02" PRIu64
-	       "-INPUT queue:%" PRIu64 "\n",
+	       "-INPUT queue:%" PRIu64 ", link_status:%d\n",
 	       odp_pktio_to_u64(pktio), dev,
-	       odp_pktio_to_u64(pktio), odp_queue_to_u64(inq_def));
+	       odp_pktio_to_u64(pktio), odp_queue_to_u64(inq_def),
+	       odp_pktio_link_status(pktio));
 
 	return pktio;
 }