From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 02 Jan 2017 08:24:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,432,1477983600"; d="scan'208";a="1106990937" Received: from dhunt5-mobl.ger.corp.intel.com (HELO [10.237.221.6]) ([10.237.221.6]) by fmsmga002.fm.intel.com with ESMTP; 02 Jan 2017 08:24:02 -0800 To: Jerin Jacob 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> Cc: dev@dpdk.org, bruce.richardson@intel.com From: "Hunt, David" Message-ID: <088a8953-9c8f-0665-7a53-505cd1c389bc@intel.com> Date: Mon, 2 Jan 2017 16:24:01 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20161222121943.GA8778@localhost.localdomain> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2 3/5] test: add distributor_perf autotest 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: Mon, 02 Jan 2017 16:24:14 -0000 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.