dlb2 handles dynamic linking and linking asynchronously if queues being linked/unlinked have traffic. It starts a thread if not already started to handle the process. This change avoids the race condition in thread creation where sometimes the thread starts immediately, descheduling the calling thread and finishes the job and exits, and then caller sets worker launched true when the thread is not running.
Signed-off-by: Pravin Pathak <[email protected]> --- drivers/event/dlb2/pf/base/dlb2_osdep.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/event/dlb2/pf/base/dlb2_osdep.h b/drivers/event/dlb2/pf/base/dlb2_osdep.h index 382a49090a..1505563f83 100644 --- a/drivers/event/dlb2/pf/base/dlb2_osdep.h +++ b/drivers/event/dlb2/pf/base/dlb2_osdep.h @@ -208,14 +208,16 @@ static inline void os_schedule_work(struct dlb2_hw *hw) dlb2_dev = container_of(hw, struct dlb2_dev, hw); + dlb2_dev->worker_launched = true; + ret = rte_thread_create_internal_control(&complete_queue_map_unmap_thread, "dlb-qunmap", dlb2_complete_queue_map_unmap, dlb2_dev); - if (ret) + if (ret) { DLB2_ERR(dlb2_dev, "Could not create queue complete map/unmap thread, err=%d\n", ret); - else - dlb2_dev->worker_launched = true; + dlb2_dev->worker_launched = false; + } } /** -- 2.53.0

