From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH v3 01/15] eal: introduce atomic exchange operation Date: Thu, 25 Jan 2018 15:24:01 -0800 Message-ID: <20180125152401.6372db47@xeon-e3> References: <20180108174514.14688-1-stephen@networkplumber.org> <20180108174514.14688-2-stephen@networkplumber.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org To: Ferruh Yigit Return-path: Received: from mail-pf0-f194.google.com (mail-pf0-f194.google.com [209.85.192.194]) by dpdk.org (Postfix) with ESMTP id 52EEC1B1A5 for ; Fri, 26 Jan 2018 00:24:04 +0100 (CET) Received: by mail-pf0-f194.google.com with SMTP id y26so6936539pfi.10 for ; Thu, 25 Jan 2018 15:24:04 -0800 (PST) In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, 11 Jan 2018 17:01:10 +0000 Ferruh Yigit 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 > > <...> > > > @@ -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.