[PATCH v3 01/17] eventdev: fix API docs and test for timeout ticks
From: Harry van Haaren <hidden>
Date: 2017-02-17 14:54:12
Subsystem:
library code, the rest · Maintainers:
Andrew Morton, Linus Torvalds
This commit improves the documentation of the api return
values for rte_event_dequeue_timeout_ticks(), and allows
-ENOTSUP to be returned by devices which do not support
timeouts.
The unit test is modified to accept -ENOTSUP as a pass,
as the device doesn't implement the timeout_ticks function.
Fixes: 4c9a26e419a7 ("app/test: unit test case for eventdev APIs")
Signed-off-by: Harry van Haaren <redacted>
---
app/test/test_eventdev.c | 4 +++-
lib/librte_eventdev/rte_eventdev.h | 6 ++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/app/test/test_eventdev.c b/app/test/test_eventdev.c
index 042a446..756bc32 100644
--- a/app/test/test_eventdev.c
+++ b/app/test/test_eventdev.c@@ -519,7 +519,9 @@ test_eventdev_timeout_ticks(void) uint64_t timeout_ticks; ret = rte_event_dequeue_timeout_ticks(TEST_DEV_ID, 100, &timeout_ticks); - TEST_ASSERT_SUCCESS(ret, "Fail to get timeout_ticks"); + /* -ENOTSUP is a valid return if timeout is not supported by device */ + if (ret != -ENOTSUP) + TEST_ASSERT_SUCCESS(ret, "Fail to get timeout_ticks"); return TEST_SUCCESS; }
diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
index b619160..b0c7f9c 100644
--- a/lib/librte_eventdev/rte_eventdev.h
+++ b/lib/librte_eventdev/rte_eventdev.h@@ -1158,7 +1158,9 @@ rte_event_enqueue_burst(uint8_t dev_id, uint8_t port_id, * * @return * - 0 on success. - * - <0 on failure. + * - -ENOTSUP if the device doesn't support timeouts. + * - -EINVAL if *dev_id* is invalid or *timeout_ticks* is a null pointer. + * - other values < 0 on failure. * * @see rte_event_dequeue_burst(), RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT * @see rte_event_dev_configure()
@@ -1166,7 +1168,7 @@ rte_event_enqueue_burst(uint8_t dev_id, uint8_t port_id, */ int rte_event_dequeue_timeout_ticks(uint8_t dev_id, uint64_t ns, - uint64_t *timeout_ticks); + uint64_t *timeout_ticks); /** * Dequeue a burst of events objects or an event object from the event port
--
2.7.4