diff options
author | Maxim Uvarov <maxim.uvarov@linaro.org> | 2018-09-19 21:10:56 +0300 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2018-09-19 21:10:56 +0300 |
commit | e9ad0a254722115450199fe4a72942be9b5cf4e1 (patch) | |
tree | df3287580c436b67de3738ae87ad879142201bae /platform/linux-generic/odp_timer.c | |
parent | d0bd42aa817eb79dffeab77cbe3ea2ea6f5e3db4 (diff) | |
parent | 6bbd53f2f407b81255d6cef969da8037cff2fa3e (diff) |
merge https://github.com/Linaro/odp-dpdk/pull/58
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'platform/linux-generic/odp_timer.c')
-rw-r--r-- | platform/linux-generic/odp_timer.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c index 5fef5af2e..0d2ecd271 100644 --- a/platform/linux-generic/odp_timer.c +++ b/platform/linux-generic/odp_timer.c @@ -56,6 +56,7 @@ #include <odp/api/plat/time_inlines.h> #include <odp/api/timer.h> #include <odp_timer_internal.h> +#include <odp/api/plat/queue_inlines.h> /* Inlined API functions */ #include <odp/api/plat/event_inlines.h> @@ -231,7 +232,7 @@ static inline timer_pool_t *handle_to_tp(odp_timer_t hdl) static inline uint32_t handle_to_idx(odp_timer_t hdl, timer_pool_t *tp) { - uint32_t idx = _odp_typeval(hdl) & ((1U << INDEX_BITS) - 1U); + uint32_t idx = (_odp_typeval(hdl) & ((1U << INDEX_BITS) - 1U)) - 1; __builtin_prefetch(&tp->tick_buf[idx], 0, 0); if (odp_likely(idx < odp_atomic_load_u32(&tp->high_wm))) return idx; @@ -241,8 +242,9 @@ static inline uint32_t handle_to_idx(odp_timer_t hdl, static inline odp_timer_t tp_idx_to_handle(timer_pool_t *tp, uint32_t idx) { - ODP_ASSERT(idx < (1U << INDEX_BITS)); - return _odp_cast_scalar(odp_timer_t, (tp->tp_idx << INDEX_BITS) | idx); + ODP_ASSERT((idx + 1) < (1U << INDEX_BITS)); + return _odp_cast_scalar(odp_timer_t, (tp->tp_idx << INDEX_BITS) | + (idx + 1)); } /* Forward declarations */ @@ -259,6 +261,7 @@ static odp_timer_pool_t timer_pool_new(const char *name, if (timer_global.num_timer_pools >= MAX_TIMER_POOLS) { odp_ticketlock_unlock(&timer_global.lock); + ODP_DBG("No more free timer pools\n"); return ODP_TIMER_POOL_INVALID; } |