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 <[email protected]>
---
 platform/linux-generic/include/odp_queue_internal.h | 12 ------------
 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 830798b..cb7e3f3 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 5b962e9..8667076 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>
-- 
2.8.1

Reply via email to