summaryrefslogtreecommitdiffstats
path: root/src/plugins/memif/device.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2017-03-27 17:08:20 +0200
committerDave Barach <openvpp@barachs.net>2017-03-30 14:14:26 +0000
commit1927da29ccbe1d4cc8e59ccfa197eb41c257814f (patch)
tree226487b33921b9a45f78016d078548a6815c3431 /src/plugins/memif/device.c
parentb18e0de1f9630fab8b3d6ffe85c7a6ee35a6fdac (diff)
vppinfra: add spinlock inline functions
Change-Id: I86089e9bb604adfc260a111685001be1c897ce53 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins/memif/device.c')
-rw-r--r--src/plugins/memif/device.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/src/plugins/memif/device.c b/src/plugins/memif/device.c
index 446537a3792..4faeb0554f3 100644
--- a/src/plugins/memif/device.c
+++ b/src/plugins/memif/device.c
@@ -79,23 +79,6 @@ format_memif_tx_trace (u8 * s, va_list * args)
}
static_always_inline void
-memif_interface_lock (memif_if_t * mif)
-{
- if (PREDICT_FALSE (mif->lockp != 0))
- {
- while (__sync_lock_test_and_set (mif->lockp, 1))
- ;
- }
-}
-
-static_always_inline void
-memif_interface_unlock (memif_if_t * mif)
-{
- if (PREDICT_FALSE (mif->lockp != 0))
- *mif->lockp = 0;
-}
-
-static_always_inline void
memif_prefetch_buffer_and_data (vlib_main_t * vm, u32 bi)
{
vlib_buffer_t *b = vlib_get_buffer (vm, bi);
@@ -117,7 +100,7 @@ memif_interface_tx_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
u16 head, tail;
u16 free_slots;
- memif_interface_lock (mif);
+ clib_spinlock_lock_if_init (&mif->lockp);
/* free consumed buffers */
@@ -210,7 +193,7 @@ memif_interface_tx_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
CLIB_MEMORY_STORE_BARRIER ();
ring->head = head;
- memif_interface_unlock (mif);
+ clib_spinlock_unlock (&mif->lockp);
if (n_left)
{