DPDK 26.11.0-rc1
rte_atomic.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
3 */
4
5#ifndef _RTE_ATOMIC_H_
6#define _RTE_ATOMIC_H_
7
15#include <stdint.h>
16
17#include <rte_common.h>
18#include <rte_stdatomic.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24#ifdef __DOXYGEN__
25
29
35static inline void rte_mb(void);
36
43static inline void rte_wmb(void);
44
51static inline void rte_rmb(void);
53
57
64static inline void rte_io_mb(void);
65
73static inline void rte_io_wmb(void);
74
82static inline void rte_io_rmb(void);
84
85#endif /* __DOXYGEN__ */
86
93#ifdef RTE_TOOLCHAIN_MSVC
94#define rte_compiler_barrier() _ReadWriteBarrier()
95#else
96#define rte_compiler_barrier() do { \
97 asm volatile ("" : : : "memory"); \
98} while(0)
99#endif
100
104static inline void rte_atomic_thread_fence(rte_memory_order memorder);
105
106
107/*------------------------ 128 bit atomic operations -------------------------*/
108
112typedef struct __rte_aligned(16) {
113 union {
114 uint64_t val[2];
115#ifdef RTE_ARCH_64
116#ifndef RTE_TOOLCHAIN_MSVC
117 __extension__ __int128 int128;
118#endif
119#endif
120 };
121} rte_int128_t;
122
123#ifdef __DOXYGEN__
124
164static inline int
166 rte_int128_t *exp,
167 const rte_int128_t *src,
168 unsigned int weak,
169 int success,
170 int failure);
171
172#endif /* __DOXYGEN__ */
173
174#ifdef __cplusplus
175}
176#endif
177
178#endif /* _RTE_ATOMIC_H_ */
static int rte_atomic128_cmp_exchange(rte_int128_t *dst, rte_int128_t *exp, const rte_int128_t *src, unsigned int weak, int success, int failure)
static void rte_io_rmb(void)
static void rte_rmb(void)
static void rte_io_mb(void)
static void rte_io_wmb(void)
static void rte_mb(void)
static void rte_atomic_thread_fence(rte_memory_order memorder)
struct __rte_aligned(16)
Definition: rte_atomic.h:112
static void rte_wmb(void)