[EXTERNAL] [PATCH v4 15/27] net/netvsc: replace rte_atomic32 with stdatomic

Stephen Hemminger stephen at networkplumber.org
Sun May 31 18:35:47 CEST 2026


On Wed, 27 May 2026 00:29:55 +0000
Long Li <longli at microsoft.com> wrote:

> > @@ -59,7 +59,8 @@ hn_rndis_rid(struct hn_data *hv)
> >  	uint32_t rid;
> > 
> >  	do {
> > -		rid = rte_atomic32_add_return(&hv->rndis_req_id, 1);
> > +		rid = rte_atomic_fetch_add_explicit(&hv->rndis_req_id, 1,
> > +
> > rte_memory_order_seq_cst);  
> 
> Does rte_atomic_fetch_add_explicit() return the old value of hv->rndis_req_id? If yes this is not correct, as the rte_atomic32_add_return() used to return the new value.

In this case it is harmless, the req_id field is only used here and
it will just sit one behind the last issued value.

The do { } while (rid == 0) loop will absorb the case when request id
is zero.

For next version, will just add one; simpler and avoids the need to explain.


More information about the dev mailing list