[dpdk-dev] [PATCH v3 01/15] eal: introduce atomic exchange operation
Ferruh Yigit
ferruh.yigit at intel.com
Thu Jan 11 18:01:10 CET 2018
On 1/8/2018 5:45 PM, Stephen Hemminger wrote:
> To handle atomic update of link status (64 bit), every driver
> was doing its own version using cmpset.
> Atomic exchange is a useful primitive in its own right;
> therefore make it a EAL routine.
>
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
<...>
> @@ -98,6 +98,18 @@ rte_atomic64_cmpset(volatile uint64_t *dst, uint64_t exp, uint64_t src)
> return res;
> }
>
> +static inline uint64_t
> +rte_atomic64_exchange(volatile uint64_t *dest, uint64_t val)
> +{
> + uint64_t old;
> +
> + do {
> + old = *dest;
> + } while (rte_atomic64_t_cmpset(dest, old, val));
rte_atomic64_cmpset ? (without _t)
> +
> + return old;
> +}
<...>
More information about the dev
mailing list