The resolution of schedule time can be more than 1ns. As result
can happen that 1ns corresponds 0 ticks of timer counter, but if
passed 1ns it's obvious that user wanted to schedule at least once.
Currently it can lead to wait forever, as 0 corresponds to
ODP_SCHED_WAIT, it can block program flow at all.

Also ODP_SCHED_NO_WAIT corresponds to 1 tick, it's rarely but can
wait a little, when shced time has slower rate. It should correspond
to schedule only once.

So, change ODP_SCHED_NO_WAIT to 0 and ODP_SCHED_NO_WAIT to UINT64_MAX.

Signed-off-by: Ivan Khoronzhuk <[email protected]>
---
 platform/linux-generic/include/odp/plat/schedule_types.h | 4 ++--
 platform/linux-generic/odp_schedule.c                    | 3 ---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/platform/linux-generic/include/odp/plat/schedule_types.h 
b/platform/linux-generic/include/odp/plat/schedule_types.h
index c48b652..8cdc40b 100644
--- a/platform/linux-generic/include/odp/plat/schedule_types.h
+++ b/platform/linux-generic/include/odp/plat/schedule_types.h
@@ -22,8 +22,8 @@ extern "C" {
  *  @{
  */
 
-#define ODP_SCHED_WAIT     0
-#define ODP_SCHED_NO_WAIT  1
+#define ODP_SCHED_WAIT     UINT64_MAX
+#define ODP_SCHED_NO_WAIT  0
 
 typedef int odp_schedule_prio_t;
 
diff --git a/platform/linux-generic/odp_schedule.c 
b/platform/linux-generic/odp_schedule.c
index c6619e5..827fcf0 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -646,9 +646,6 @@ void odp_schedule_resume(void)
 
 uint64_t odp_schedule_wait_time(uint64_t ns)
 {
-       if (ns <= ODP_SCHED_NO_WAIT)
-               ns = ODP_SCHED_NO_WAIT + 1;
-
        return odp_time_ns_to_cycles(ns);
 }
 
-- 
1.9.1

_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to