diff options
author | Petri Savolainen <petri.savolainen@nokia.com> | 2016-09-15 16:39:22 +0300 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2016-09-22 19:02:46 +0300 |
commit | 582065e74e2375b5c81ac8fcec9eb02f541f42ff (patch) | |
tree | eefe304055a89c68436f8d526cf9ff29788c1efb | |
parent | 5f4f2e0da6e04637b6b4bd7aa6bb4d4d32680525 (diff) |
linux-gen: queue: use inlined ticketlock
Use inlined ticketlock calls instead of API calls. Inlining
improves performance and makes it easier to profile functions
which use ticketlocks. Cycle consumption of caller functions
are more interesting than combined cycle consumption of all
ticketlocks.
Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com>
Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
-rw-r--r-- | platform/linux-generic/include/odp_queue_internal.h | 12 | ||||
-rw-r--r-- | platform/linux-generic/odp_queue.c | 15 |
2 files changed, 3 insertions, 24 deletions
diff --git a/platform/linux-generic/include/odp_queue_internal.h b/platform/linux-generic/include/odp_queue_internal.h index 830798b5..cb7e3f3e 100644 --- a/platform/linux-generic/include/odp_queue_internal.h +++ b/platform/linux-generic/include/odp_queue_internal.h @@ -26,15 +26,7 @@ extern "C" { #include <odp/api/packet_io.h> #include <odp/api/align.h> #include <odp/api/hints.h> - - -#define USE_TICKETLOCK - -#ifdef USE_TICKETLOCK #include <odp/api/ticketlock.h> -#else -#include <odp/api/spinlock.h> -#endif #define QUEUE_MULTI_MAX 8 @@ -57,11 +49,7 @@ typedef int (*deq_multi_func_t)(union queue_entry_u *, odp_buffer_hdr_t **, int); struct queue_entry_s { -#ifdef USE_TICKETLOCK odp_ticketlock_t lock ODP_ALIGNED_CACHE; -#else - odp_spinlock_t lock ODP_ALIGNED_CACHE; -#endif odp_buffer_hdr_t *head; odp_buffer_hdr_t *tail; diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index 5b962e9f..86670768 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -27,19 +27,10 @@ #define NUM_INTERNAL_QUEUES 64 -#ifdef USE_TICKETLOCK -#include <odp/api/ticketlock.h> -#define LOCK(a) odp_ticketlock_lock(a) -#define UNLOCK(a) odp_ticketlock_unlock(a) +#include <odp/api/plat/ticketlock_inlines.h> +#define LOCK(a) _odp_ticketlock_lock(a) +#define UNLOCK(a) _odp_ticketlock_unlock(a) #define LOCK_INIT(a) odp_ticketlock_init(a) -#define LOCK_TRY(a) odp_ticketlock_trylock(a) -#else -#include <odp/api/spinlock.h> -#define LOCK(a) odp_spinlock_lock(a) -#define UNLOCK(a) odp_spinlock_unlock(a) -#define LOCK_INIT(a) odp_spinlock_init(a) -#define LOCK_TRY(a) odp_spinlock_trylock(a) -#endif #include <string.h> #include <inttypes.h> |