From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id EA1027288 for ; Thu, 11 Jan 2018 18:01:13 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jan 2018 09:01:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,345,1511856000"; d="scan'208";a="9386754" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.237.220.48]) ([10.237.220.48]) by fmsmga002.fm.intel.com with ESMTP; 11 Jan 2018 09:01:11 -0800 To: Stephen Hemminger , dev@dpdk.org References: <20180108174514.14688-1-stephen@networkplumber.org> <20180108174514.14688-2-stephen@networkplumber.org> From: Ferruh Yigit Message-ID: Date: Thu, 11 Jan 2018 17:01:10 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180108174514.14688-2-stephen@networkplumber.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v3 01/15] eal: introduce atomic exchange operation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jan 2018 17:01:14 -0000 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; > +} <...>