From 41218a9d436df89008e3320676638099f990cfd3 Mon Sep 17 00:00:00 2001 From: Jerin Jacob Date: Thu, 18 May 2017 14:18:27 +0530 Subject: [PATCH] eventdev: define default value for dequeue timeout Defining the value 0 as default value for dequeue timeout will help the application reduce the configuration setup if the application is interested only in default timeout value. removed "min_dequeue_limit" negative testcase as min_dequeue_limit value could be zero(which is default timeout now) if driver has dev_info->min_dequeue_timeout_ns = 1. Signed-off-by: Jerin Jacob --- drivers/event/octeontx/ssovf_evdev.c | 2 ++ lib/librte_eventdev/rte_eventdev.c | 5 +++-- lib/librte_eventdev/rte_eventdev.h | 1 + test/test/test_eventdev.c | 10 ---------- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c index 36c377c0aa..8dc7b2ef8b 100644 --- a/drivers/event/octeontx/ssovf_evdev.c +++ b/drivers/event/octeontx/ssovf_evdev.c @@ -197,6 +197,8 @@ ssovf_configure(const struct rte_eventdev *dev) ssovf_func_trace(); deq_tmo_ns = conf->dequeue_timeout_ns; + if (deq_tmo_ns == 0) + deq_tmo_ns = edev->min_deq_timeout_ns; if (conf->event_dev_cfg & RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT) { edev->is_timeout_deq = 1; diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c index cf651dccaa..e706688c8d 100644 --- a/lib/librte_eventdev/rte_eventdev.c +++ b/lib/librte_eventdev/rte_eventdev.c @@ -366,9 +366,10 @@ rte_event_dev_configure(uint8_t dev_id, /* Check dequeue_timeout_ns value is in limit */ if (!(dev_conf->event_dev_cfg & RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT)) { - if (dev_conf->dequeue_timeout_ns < info.min_dequeue_timeout_ns + if (dev_conf->dequeue_timeout_ns && + (dev_conf->dequeue_timeout_ns < info.min_dequeue_timeout_ns || dev_conf->dequeue_timeout_ns > - info.max_dequeue_timeout_ns) { + info.max_dequeue_timeout_ns)) { RTE_EDEV_LOG_ERR("dev%d invalid dequeue_timeout_ns=%d" " min_dequeue_timeout_ns=%d max_dequeue_timeout_ns=%d", dev_id, dev_conf->dequeue_timeout_ns, diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h index b20a6c688b..a79a827ee6 100644 --- a/lib/librte_eventdev/rte_eventdev.h +++ b/lib/librte_eventdev/rte_eventdev.h @@ -412,6 +412,7 @@ struct rte_event_dev_config { * This value should be in the range of *min_dequeue_timeout_ns* and * *max_dequeue_timeout_ns* which previously provided in * rte_event_dev_info_get() + * The value 0 is allowed, in which case, default dequeue timeout used. * @see RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT */ int32_t nb_events_limit; diff --git a/test/test/test_eventdev.c b/test/test/test_eventdev.c index 88b80a928f..3f2677040d 100644 --- a/test/test/test_eventdev.c +++ b/test/test/test_eventdev.c @@ -138,13 +138,6 @@ test_ethdev_config_run(struct rte_event_dev_config *dev_conf, return rte_event_dev_configure(TEST_DEV_ID, dev_conf); } -static void -min_dequeue_limit(struct rte_event_dev_config *dev_conf, - struct rte_event_dev_info *info) -{ - dev_conf->dequeue_timeout_ns = info->min_dequeue_timeout_ns - 1; -} - static void max_dequeue_limit(struct rte_event_dev_config *dev_conf, struct rte_event_dev_info *info) @@ -210,9 +203,6 @@ test_eventdev_configure(void) TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info"); /* Check limits */ - TEST_ASSERT_EQUAL(-EINVAL, - test_ethdev_config_run(&dev_conf, &info, min_dequeue_limit), - "Config negative test failed"); TEST_ASSERT_EQUAL(-EINVAL, test_ethdev_config_run(&dev_conf, &info, max_dequeue_limit), "Config negative test failed"); -- 2.20.1