From mboxrd@z Thu Jan 1 00:00:00 1970 From: Harry van Haaren Subject: [PATCH v3 01/17] eventdev: fix API docs and test for timeout ticks Date: Fri, 17 Feb 2017 14:53:56 +0000 Message-ID: <1487343252-16092-2-git-send-email-harry.van.haaren@intel.com> References: <1485879273-86228-1-git-send-email-harry.van.haaren@intel.com> <1487343252-16092-1-git-send-email-harry.van.haaren@intel.com> Cc: jerin.jacob@caviumnetworks.com, Harry van Haaren To: dev@dpdk.org Return-path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 0FB372A5D for ; Fri, 17 Feb 2017 15:54:12 +0100 (CET) In-Reply-To: <1487343252-16092-1-git-send-email-harry.van.haaren@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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