X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fsvm%2Fsvm_fifo.h;h=4a119341d8b3cb3a519e360c4ab6c56331e86e26;hb=c5df8c71c;hp=07614b4dac943c50e399de60600cd6e2321b33c9;hpb=0ef8ef2b474473b13de2cee0165b424e79e4e363;p=vpp.git diff --git a/src/svm/svm_fifo.h b/src/svm/svm_fifo.h index 07614b4dac9..4a119341d8b 100644 --- a/src/svm/svm_fifo.h +++ b/src/svm/svm_fifo.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Cisco and/or its affiliates. + * Copyright (c) 2016-2019 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: @@ -173,18 +173,18 @@ svm_fifo_set_event (svm_fifo_t * f) { /* return __sync_lock_test_and_set (&f->has_event, 1) == 0; return __sync_bool_compare_and_swap (&f->has_event, 0, 1); */ - return !__atomic_exchange_n (&f->has_event, 1, __ATOMIC_RELEASE); + return !clib_atomic_swap_rel_n (&f->has_event, 1); } /** * Unsets fifo event flag. * - * Also acts as a release barrier. + * Also acts as an acquire barrier. */ always_inline void svm_fifo_unset_event (svm_fifo_t * f) { - clib_atomic_release (&f->has_event); + clib_atomic_swap_acq_n (&f->has_event, 0); } svm_fifo_t *svm_fifo_create (u32 data_size_in_bytes); @@ -235,7 +235,7 @@ svm_fifo_enqueue_nocopy (svm_fifo_t * f, u32 bytes) { ASSERT (bytes <= svm_fifo_max_enqueue (f)); f->tail = (f->tail + bytes) % f->nitems; - f->cursize += bytes; + clib_atomic_fetch_add_rel (&f->cursize, bytes); } always_inline u8 *