From: Pavan Nikhilesh <pbhagavat...@marvell.com>

Allow dequeue timeout to be configured as zero, when
RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT is disabled.

Fixes: 5512c7de85cd ("event/cnxk: add common configuration validation")
Cc: sta...@dpdk.org

Signed-off-by: Pavan Nikhilesh <pbhagavat...@marvell.com>
---
 drivers/event/cnxk/cnxk_eventdev.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/event/cnxk/cnxk_eventdev.c 
b/drivers/event/cnxk/cnxk_eventdev.c
index 0c61f4c20e..2ffa686f93 100644
--- a/drivers/event/cnxk/cnxk_eventdev.c
+++ b/drivers/event/cnxk/cnxk_eventdev.c
@@ -162,16 +162,17 @@ cnxk_sso_dev_validate(const struct rte_eventdev 
*event_dev, uint32_t deq_depth,
 
        deq_tmo_ns = conf->dequeue_timeout_ns;
 
-       if (deq_tmo_ns == 0)
-               deq_tmo_ns = dev->min_dequeue_timeout_ns;
-       if (deq_tmo_ns < dev->min_dequeue_timeout_ns ||
-           deq_tmo_ns > dev->max_dequeue_timeout_ns) {
+       if (deq_tmo_ns && (deq_tmo_ns < dev->min_dequeue_timeout_ns ||
+                          deq_tmo_ns > dev->max_dequeue_timeout_ns)) {
                plt_err("Unsupported dequeue timeout requested");
                return -EINVAL;
        }
 
-       if (conf->event_dev_cfg & RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT)
+       if (conf->event_dev_cfg & RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT) {
+               if (deq_tmo_ns == 0)
+                       deq_tmo_ns = dev->min_dequeue_timeout_ns;
                dev->is_timeout_deq = 1;
+       }
 
        dev->deq_tmo_ns = deq_tmo_ns;
 
@@ -663,7 +664,7 @@ cnxk_sso_init(struct rte_eventdev *event_dev)
        }
 
        dev->is_timeout_deq = 0;
-       dev->min_dequeue_timeout_ns = 0;
+       dev->min_dequeue_timeout_ns = USEC2NSEC(1);
        dev->max_dequeue_timeout_ns = USEC2NSEC(0x3FF);
        dev->max_num_events = -1;
        dev->nb_event_queues = 0;
-- 
2.25.1

Reply via email to