diff options
Diffstat (limited to 'src/svm')
-rw-r--r-- | src/svm/message_queue.c | 6 | ||||
-rw-r--r-- | src/svm/ssvm.h | 4 | ||||
-rw-r--r-- | src/svm/svm_fifo.c | 10 | ||||
-rw-r--r-- | src/svm/svm_fifo.h | 2 |
4 files changed, 11 insertions, 11 deletions
diff --git a/src/svm/message_queue.c b/src/svm/message_queue.c index a73a56d8044..13d089a97cc 100644 --- a/src/svm/message_queue.c +++ b/src/svm/message_queue.c @@ -108,7 +108,7 @@ svm_msg_q_alloc_msg_w_ring (svm_msg_q_t * mq, u32 ring_index) msg.ring_index = ring - mq->rings; msg.elt_index = ring->tail; ring->tail = (ring->tail + 1) % ring->nitems; - __sync_fetch_and_add (&ring->cursize, 1); + clib_atomic_fetch_add (&ring->cursize, 1); return msg; } @@ -155,7 +155,7 @@ svm_msg_q_alloc_msg (svm_msg_q_t * mq, u32 nbytes) msg.ring_index = ring - mq->rings; msg.elt_index = ring->tail; ring->tail = (ring->tail + 1) % ring->nitems; - __sync_fetch_and_add (&ring->cursize, 1); + clib_atomic_fetch_add (&ring->cursize, 1); break; } return msg; @@ -185,7 +185,7 @@ svm_msg_q_free_msg (svm_msg_q_t * mq, svm_msg_q_msg_t * msg) /* for now, expect messages to be processed in order */ ASSERT (0); } - __sync_fetch_and_sub (&ring->cursize, 1); + clib_atomic_fetch_sub (&ring->cursize, 1); } static int diff --git a/src/svm/ssvm.h b/src/svm/ssvm.h index 8677f5680be..5b2bf0d202d 100644 --- a/src/svm/ssvm.h +++ b/src/svm/ssvm.h @@ -103,7 +103,7 @@ ssvm_lock (ssvm_shared_header_t * h, u32 my_pid, u32 tag) return; } - while (__sync_lock_test_and_set (&h->lock, 1)) + while (clib_atomic_test_and_set (&h->lock)) ; h->owner_pid = my_pid; @@ -114,7 +114,7 @@ ssvm_lock (ssvm_shared_header_t * h, u32 my_pid, u32 tag) always_inline void ssvm_lock_non_recursive (ssvm_shared_header_t * h, u32 tag) { - while (__sync_lock_test_and_set (&h->lock, 1)) + while (clib_atomic_test_and_set (&h->lock)) ; h->tag = tag; diff --git a/src/svm/svm_fifo.c b/src/svm/svm_fifo.c index 4eae0a1c7e6..aa523c6b55c 100644 --- a/src/svm/svm_fifo.c +++ b/src/svm/svm_fifo.c @@ -513,7 +513,7 @@ CLIB_MARCH_FN (svm_fifo_enqueue_nowait, int, svm_fifo_t * f, u32 max_bytes, /* Atomically increase the queue length */ ASSERT (cursize + total_copy_bytes <= nitems); - __sync_fetch_and_add (&f->cursize, total_copy_bytes); + clib_atomic_fetch_add (&f->cursize, total_copy_bytes); return (total_copy_bytes); } @@ -659,7 +659,7 @@ CLIB_MARCH_FN (svm_fifo_dequeue_nowait, int, svm_fifo_t * f, u32 max_bytes, ASSERT (f->head <= nitems); ASSERT (cursize >= total_copy_bytes); - __sync_fetch_and_sub (&f->cursize, total_copy_bytes); + clib_atomic_fetch_sub (&f->cursize, total_copy_bytes); return (total_copy_bytes); } @@ -757,7 +757,7 @@ svm_fifo_dequeue_drop (svm_fifo_t * f, u32 max_bytes) ASSERT (f->head <= nitems); ASSERT (cursize >= total_drop_bytes); - __sync_fetch_and_sub (&f->cursize, total_drop_bytes); + clib_atomic_fetch_sub (&f->cursize, total_drop_bytes); return total_drop_bytes; } @@ -766,7 +766,7 @@ void svm_fifo_dequeue_drop_all (svm_fifo_t * f) { f->head = f->tail; - __sync_fetch_and_sub (&f->cursize, f->cursize); + clib_atomic_fetch_sub (&f->cursize, f->cursize); } int @@ -813,7 +813,7 @@ svm_fifo_segments_free (svm_fifo_t * f, svm_fifo_segment_t * fs) f->head = (f->head + fs[0].len) % f->nitems; total_drop_bytes = fs[0].len; } - __sync_fetch_and_sub (&f->cursize, total_drop_bytes); + clib_atomic_fetch_sub (&f->cursize, total_drop_bytes); } u32 diff --git a/src/svm/svm_fifo.h b/src/svm/svm_fifo.h index d7852a79b32..e049d3e3147 100644 --- a/src/svm/svm_fifo.h +++ b/src/svm/svm_fifo.h @@ -169,7 +169,7 @@ svm_fifo_set_event (svm_fifo_t * f) always_inline void svm_fifo_unset_event (svm_fifo_t * f) { - __sync_lock_release (&f->has_event); + clib_atomic_release (&f->has_event); } static inline void |