[dpdk-dev] [PATCH v3 01/15] eal: introduce atomic exchange operation
Stephen Hemminger
stephen at networkplumber.org
Fri Jan 26 00:24:01 CET 2018
On Thu, 11 Jan 2018 17:01:10 +0000
Ferruh Yigit <ferruh.yigit at intel.com> wrote:
> 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;
> > +}
>
> <...>
>
Addressed in followup patch, needed to build on 32bit.
Will fold into next version.
More information about the dev
mailing list