diff options
Diffstat (limited to 'platform/linux-generic/include/odp_timer_internal.h')
-rw-r--r-- | platform/linux-generic/include/odp_timer_internal.h | 50 |
1 files changed, 39 insertions, 11 deletions
diff --git a/platform/linux-generic/include/odp_timer_internal.h b/platform/linux-generic/include/odp_timer_internal.h index 91b12c545..2351def95 100644 --- a/platform/linux-generic/include/odp_timer_internal.h +++ b/platform/linux-generic/include/odp_timer_internal.h @@ -1,10 +1,8 @@ -/* Copyright (c) 2014, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright (c) 2014-2018 Linaro Limited + * Copyright (c) 2021-2022 Nokia */ - /** * @file * @@ -16,23 +14,53 @@ #include <odp/api/align.h> #include <odp/api/debug.h> -#include <odp_buffer_internal.h> -#include <odp_pool_internal.h> #include <odp/api/timer.h> +#include <odp_event_internal.h> +#include <odp_global_data.h> +#include <odp_pool_internal.h> + +/* + * Use as the argument to timer_run() to force a scan and to ignore rate + * limit. + */ +#define TIMER_SCAN_FORCE INT32_MAX + /** * Internal Timeout header */ -typedef struct { - /* common buffer header */ - odp_buffer_hdr_t buf_hdr; +typedef struct ODP_ALIGNED_CACHE odp_timeout_hdr_t { + /* Common event header */ + _odp_event_hdr_t event_hdr; /* Requested expiration time */ uint64_t expiration; + /* User ptr inherited from parent timer */ - void *user_ptr; + const void *user_ptr; + + /* User area pointer */ + void *uarea_addr; + /* Parent timer */ odp_timer_t timer; + } odp_timeout_hdr_t; +ODP_STATIC_ASSERT(sizeof(odp_timeout_hdr_t) <= ODP_CACHE_LINE_SIZE, + "TIMEOUT_HDR_SIZE_ERROR"); + +/* A larger decrement value should be used after receiving events compared to + * an 'empty' call. */ +uint64_t _odp_timer_run_inline(int dec); + +/* Static inline wrapper to minimize modification of schedulers. */ +static inline uint64_t timer_run(int dec) +{ + if (odp_global_rw->inline_timers) + return _odp_timer_run_inline(dec); + + return UINT64_MAX; +} + #endif |