34 #ifndef _RTE_ATOMIC_H_
35 #define _RTE_ATOMIC_H_
56 static inline void rte_mb(
void);
65 static inline void rte_wmb(
void);
74 static inline void rte_rmb(
void);
111 #define rte_compiler_barrier() do { \
112 asm volatile ("" : : : "memory"); \
136 #ifdef RTE_FORCE_INTRINSICS
140 return __sync_bool_compare_and_swap(dst, exp, src);
154 #define RTE_ATOMIC16_INIT(val) { (val) }
176 static inline int16_t
207 __sync_fetch_and_add(&v->
cnt, inc);
221 __sync_fetch_and_sub(&v->
cnt, dec);
233 #ifdef RTE_FORCE_INTRINSICS
250 #ifdef RTE_FORCE_INTRINSICS
271 static inline int16_t
274 return __sync_add_and_fetch(&v->
cnt, inc);
291 static inline int16_t
294 return __sync_sub_and_fetch(&v->
cnt, dec);
310 #ifdef RTE_FORCE_INTRINSICS
313 return __sync_add_and_fetch(&v->
cnt, 1) == 0;
330 #ifdef RTE_FORCE_INTRINSICS
333 return __sync_sub_and_fetch(&v->
cnt, 1) == 0;
350 #ifdef RTE_FORCE_INTRINSICS
389 #ifdef RTE_FORCE_INTRINSICS
393 return __sync_bool_compare_and_swap(dst, exp, src);
407 #define RTE_ATOMIC32_INIT(val) { (val) }
429 static inline int32_t
460 __sync_fetch_and_add(&v->
cnt, inc);
474 __sync_fetch_and_sub(&v->
cnt, dec);
486 #ifdef RTE_FORCE_INTRINSICS
503 #ifdef RTE_FORCE_INTRINSICS
524 static inline int32_t
527 return __sync_add_and_fetch(&v->
cnt, inc);
544 static inline int32_t
547 return __sync_sub_and_fetch(&v->
cnt, dec);
563 #ifdef RTE_FORCE_INTRINSICS
566 return __sync_add_and_fetch(&v->
cnt, 1) == 0;
583 #ifdef RTE_FORCE_INTRINSICS
586 return __sync_sub_and_fetch(&v->
cnt, 1) == 0;
603 #ifdef RTE_FORCE_INTRINSICS
641 #ifdef RTE_FORCE_INTRINSICS
645 return __sync_bool_compare_and_swap(dst, exp, src);
659 #define RTE_ATOMIC64_INIT(val) { (val) }
670 #ifdef RTE_FORCE_INTRINSICS
680 while (success == 0) {
697 static inline int64_t
700 #ifdef RTE_FORCE_INTRINSICS
701 static inline int64_t
710 while (success == 0) {
732 #ifdef RTE_FORCE_INTRINSICS
742 while (success == 0) {
762 #ifdef RTE_FORCE_INTRINSICS
766 __sync_fetch_and_add(&v->
cnt, inc);
781 #ifdef RTE_FORCE_INTRINSICS
785 __sync_fetch_and_sub(&v->
cnt, dec);
798 #ifdef RTE_FORCE_INTRINSICS
815 #ifdef RTE_FORCE_INTRINSICS
836 static inline int64_t
839 #ifdef RTE_FORCE_INTRINSICS
840 static inline int64_t
843 return __sync_add_and_fetch(&v->
cnt, inc);
860 static inline int64_t
863 #ifdef RTE_FORCE_INTRINSICS
864 static inline int64_t
867 return __sync_sub_and_fetch(&v->
cnt, dec);
884 #ifdef RTE_FORCE_INTRINSICS
904 #ifdef RTE_FORCE_INTRINSICS
924 #ifdef RTE_FORCE_INTRINSICS
939 #ifdef RTE_FORCE_INTRINSICS
static void rte_atomic32_inc(rte_atomic32_t *v)
static int64_t rte_atomic64_sub_return(rte_atomic64_t *v, int64_t dec)
static void rte_smp_rmb(void)
static int rte_atomic32_cmpset(volatile uint32_t *dst, uint32_t exp, uint32_t src)
static int16_t rte_atomic16_read(const rte_atomic16_t *v)
static void rte_wmb(void)
static void rte_atomic32_add(rte_atomic32_t *v, int32_t inc)
static int rte_atomic16_dec_and_test(rte_atomic16_t *v)
static int64_t rte_atomic64_read(rte_atomic64_t *v)
static int16_t rte_atomic16_sub_return(rte_atomic16_t *v, int16_t dec)
static void rte_atomic32_sub(rte_atomic32_t *v, int32_t dec)
static void rte_atomic32_dec(rte_atomic32_t *v)
static int rte_atomic32_inc_and_test(rte_atomic32_t *v)
static void rte_atomic64_inc(rte_atomic64_t *v)
static void rte_atomic32_set(rte_atomic32_t *v, int32_t new_value)
static int32_t rte_atomic32_add_return(rte_atomic32_t *v, int32_t inc)
static void rte_atomic16_add(rte_atomic16_t *v, int16_t inc)
static void rte_atomic32_init(rte_atomic32_t *v)
static void rte_atomic16_clear(rte_atomic16_t *v)
static int rte_atomic16_test_and_set(rte_atomic16_t *v)
static int rte_atomic64_cmpset(volatile uint64_t *dst, uint64_t exp, uint64_t src)
static void rte_atomic16_sub(rte_atomic16_t *v, int16_t dec)
static void rte_atomic16_set(rte_atomic16_t *v, int16_t new_value)
static void rte_atomic64_clear(rte_atomic64_t *v)
static int16_t rte_atomic16_add_return(rte_atomic16_t *v, int16_t inc)
static int rte_atomic64_dec_and_test(rte_atomic64_t *v)
static void rte_smp_wmb(void)
static int64_t rte_atomic64_add_return(rte_atomic64_t *v, int64_t inc)
static void rte_rmb(void)
static void rte_atomic32_clear(rte_atomic32_t *v)
static void rte_atomic16_inc(rte_atomic16_t *v)
static int rte_atomic16_inc_and_test(rte_atomic16_t *v)
static int rte_atomic16_cmpset(volatile uint16_t *dst, uint16_t exp, uint16_t src)
static int rte_atomic64_inc_and_test(rte_atomic64_t *v)
static int32_t rte_atomic32_sub_return(rte_atomic32_t *v, int32_t dec)
static void rte_atomic64_sub(rte_atomic64_t *v, int64_t dec)
static int rte_atomic32_test_and_set(rte_atomic32_t *v)
static void rte_smp_mb(void)
static void rte_atomic16_dec(rte_atomic16_t *v)
static void rte_atomic64_init(rte_atomic64_t *v)
static void rte_atomic64_dec(rte_atomic64_t *v)
static void rte_atomic16_init(rte_atomic16_t *v)
static int rte_atomic64_test_and_set(rte_atomic64_t *v)
static int32_t rte_atomic32_read(const rte_atomic32_t *v)
static void rte_atomic64_set(rte_atomic64_t *v, int64_t new_value)
static int rte_atomic32_dec_and_test(rte_atomic32_t *v)
static void rte_atomic64_add(rte_atomic64_t *v, int64_t inc)