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 <step...@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;
> +}

<...>

Reply via email to