diff mbox

[NETMAP,01/12] linux-netmap: pktio: use ticketlock to send and recv packets

Message ID 1425322017-14636-2-git-send-email-ciprian.barbu@linaro.org
State New
Headers show

Commit Message

Ciprian Barbu March 2, 2015, 6:46 p.m. UTC
Signed-off-by: Ciprian Barbu <ciprian.barbu@linaro.org>
---
 platform/linux-netmap/include/odp_packet_io_internal.h | 4 ++--
 platform/linux-netmap/include/odp_packet_netmap.h      | 1 +
 platform/linux-netmap/odp_packet_io.c                  | 8 ++++----
 3 files changed, 7 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/platform/linux-netmap/include/odp_packet_io_internal.h b/platform/linux-netmap/include/odp_packet_io_internal.h
index ea0b472..9208906 100644
--- a/platform/linux-netmap/include/odp_packet_io_internal.h
+++ b/platform/linux-netmap/include/odp_packet_io_internal.h
@@ -18,7 +18,7 @@ 
 extern "C" {
 #endif
 
-#include <odp_spinlock.h>
+#include <odp_ticketlock.h>
 #include <odp_packet_socket.h>
 #include <odp_packet_netmap.h>
 
@@ -33,7 +33,7 @@  typedef enum {
 } odp_pktio_type_t;
 
 struct pktio_entry {
-	odp_spinlock_t lock;		/**< entry spinlock */
+	odp_ticketlock_t lock;		/**< entry ticketlock */
 	int taken;			/**< is entry taken(1) or free(0) */
 	odp_queue_t inq_default;	/**< default input queue, if set */
 	odp_queue_t outq_default;	/**< default out queue */
diff --git a/platform/linux-netmap/include/odp_packet_netmap.h b/platform/linux-netmap/include/odp_packet_netmap.h
index b4c523f..58f7fbe 100644
--- a/platform/linux-netmap/include/odp_packet_netmap.h
+++ b/platform/linux-netmap/include/odp_packet_netmap.h
@@ -17,6 +17,7 @@ 
 #include <odp_debug.h>
 #include <odp_buffer_pool.h>
 #include <odp_packet.h>
+#include <odp_spinlock.h>
 
 #define ODP_NETMAP_RING_HW	0
 #define ODP_NETMAP_RING_SW	1
diff --git a/platform/linux-netmap/odp_packet_io.c b/platform/linux-netmap/odp_packet_io.c
index de371e3..ad749d5 100644
--- a/platform/linux-netmap/odp_packet_io.c
+++ b/platform/linux-netmap/odp_packet_io.c
@@ -10,7 +10,7 @@ 
 #include <odp_packet.h>
 #include <odp_packet_internal.h>
 #include <odp_internal.h>
-#include <odp_spinlock.h>
+#include <odp_ticketlock.h>
 #include <odp_shared_memory.h>
 #include <odp_packet_socket.h>
 #include <odp_packet_netmap.h>
@@ -60,7 +60,7 @@  int odp_pktio_init_global(void)
 	for (id = 1; id <= ODP_CONFIG_PKTIO_ENTRIES; ++id) {
 		pktio_entry = get_entry(id);
 
-		odp_spinlock_init(&pktio_entry->s.lock);
+		odp_ticketlock_init(&pktio_entry->s.lock);
 
 		/* Create a default output queue for each pktio resource */
 		snprintf(name, sizeof(name), "%i-pktio_outq_default", (int)id);
@@ -100,12 +100,12 @@  static void set_taken(pktio_entry_t *entry)
 
 static void lock_entry(pktio_entry_t *entry)
 {
-	odp_spinlock_lock(&entry->s.lock);
+	odp_ticketlock_lock(&entry->s.lock);
 }
 
 static void unlock_entry(pktio_entry_t *entry)
 {
-	odp_spinlock_unlock(&entry->s.lock);
+	odp_ticketlock_unlock(&entry->s.lock);
 }
 
 static void init_pktio_entry(pktio_entry_t *entry)