[dpdk-dev] [PATCH v2 3/5] test: add distributor_perf autotest
jerin.jacob at caviumnetworks.com
Wed Jan 4 14:09:54 CET 2017
On Mon, Jan 02, 2017 at 04:24:01PM +0000, Hunt, David wrote:
> 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 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)
It would have been better rte_atomic32_add returns the old value.
> There's a second reason why I can't use the rte_atomics, and that's because
> worker_idx is a volatile.
may be you could change worker_idx as rte_atomic32_t
> Maybe we could add new atomic functions in the future to address this?
Yes. I guess, the fixing the return value of rte_atomic*_[add/sub] may
More information about the dev