diff options
author | Damjan Marion <damarion@cisco.com> | 2017-03-27 17:08:20 +0200 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2017-03-30 14:14:26 +0000 |
commit | 1927da29ccbe1d4cc8e59ccfa197eb41c257814f (patch) | |
tree | 226487b33921b9a45f78016d078548a6815c3431 /src/vnet/devices/netmap/device.c | |
parent | b18e0de1f9630fab8b3d6ffe85c7a6ee35a6fdac (diff) |
vppinfra: add spinlock inline functions
Change-Id: I86089e9bb604adfc260a111685001be1c897ce53
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/devices/netmap/device.c')
-rw-r--r-- | src/vnet/devices/netmap/device.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/vnet/devices/netmap/device.c b/src/vnet/devices/netmap/device.c index 2152824f733..aea9ddf4eb1 100644 --- a/src/vnet/devices/netmap/device.c +++ b/src/vnet/devices/netmap/device.c @@ -105,11 +105,7 @@ netmap_interface_tx (vlib_main_t * vm, netmap_if_t *nif = pool_elt_at_index (nm->interfaces, rd->dev_instance); int cur_ring; - if (PREDICT_FALSE (nif->lockp != 0)) - { - while (__sync_lock_test_and_set (nif->lockp, 1)) - ; - } + clib_spinlock_lock_if_init (&nif->lockp); cur_ring = nif->first_tx_ring; @@ -165,8 +161,7 @@ netmap_interface_tx (vlib_main_t * vm, if (n_left < frame->n_vectors) ioctl (nif->fd, NIOCTXSYNC, NULL); - if (PREDICT_FALSE (nif->lockp != 0)) - *nif->lockp = 0; + clib_spinlock_unlock_if_init (&nif->lockp); if (n_left) vlib_error_count (vm, node->node_index, |