eventdev: define default value for dequeue timeout
authorJerin Jacob <jerin.jacob@caviumnetworks.com>
Thu, 18 May 2017 08:48:27 +0000 (14:18 +0530)
committerJerin Jacob <jerin.jacob@caviumnetworks.com>
Wed, 21 Jun 2017 13:33:23 +0000 (15:33 +0200)
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 <jerin.jacob@caviumnetworks.com>
drivers/event/octeontx/ssovf_evdev.c
lib/librte_eventdev/rte_eventdev.c
lib/librte_eventdev/rte_eventdev.h
test/test/test_eventdev.c

index 36c377c..8dc7b2e 100644 (file)
@@ -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;
index cf651dc..e706688 100644 (file)
@@ -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,
index b20a6c6..a79a827 100644 (file)
@@ -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;
index 88b80a9..3f26770 100644 (file)
@@ -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");