[dpdk-dev] [PATCH v2 3/5] test: add distributor_perf autotest

Hunt, David david.hunt at intel.com
Mon Jan 2 17:24:01 CET 2017

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

     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 
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?


More information about the dev mailing list