From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Hunt, David" Subject: Re: [PATCH v2 3/5] test: add distributor_perf autotest Date: Mon, 2 Jan 2017 16:24:01 +0000 Message-ID: <088a8953-9c8f-0665-7a53-505cd1c389bc@intel.com> References: <1480567821-70846-2-git-send-email-david.hunt@intel.com> <1482381428-148094-1-git-send-email-david.hunt@intel.com> <1482381428-148094-4-git-send-email-david.hunt@intel.com> <20161222121943.GA8778@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org, bruce.richardson@intel.com To: Jerin Jacob Return-path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 1E1D42B9C for ; Mon, 2 Jan 2017 17:24:13 +0100 (CET) In-Reply-To: <20161222121943.GA8778@localhost.localdomain> 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 22/12/2016 12:19 PM, Jerin Jacob wrote: > On Thu, Dec 22, 2016 at 04:37:06AM +0000, David Hunt wrote: >> + struct rte_distributor_burst *d = arg; >> + unsigned int count = 0; >> + unsigned int num = 0; >> + unsigned int id = __sync_fetch_and_add(&worker_idx, 1); > Use rte_atomic equivalent Jerin, I'm looking for an equivalent, but I can't seem to find one. Here I'm assigning 'id' with the incremented value of worker_idx in one statement. However, rte_atomic32_add just increments the variable and returns void, so I'd have to use two statements, losing the atomicity. static inline void rte_atomic32_add(rte_atomic32_t *v, int32_t inc) There's a second reason why I can't use the rte_atomics, and that's because worker_idx is a volatile. Maybe we could add new atomic functions in the future to address this? Thanks, Dave.