[dpdk-dev] [PATCH v2] mbuf: use C11 atomics for refcnt operations

Phil Yang Phil.Yang at arm.com
Wed Jul 8 06:48:33 CEST 2020


> -----Original Message-----
> From: Stephen Hemminger <stephen at networkplumber.org>
> Sent: Wednesday, July 8, 2020 1:13 AM
> To: Phil Yang <Phil.Yang at arm.com>
> Cc: david.marchand at redhat.com; dev at dpdk.org; drc at linux.vnet.ibm.com;
> Honnappa Nagarahalli <Honnappa.Nagarahalli at arm.com>;
> olivier.matz at 6wind.com; Ruifeng Wang <Ruifeng.Wang at arm.com>; nd
> <nd at arm.com>
> Subject: Re: [dpdk-dev] [PATCH v2] mbuf: use C11 atomics for refcnt
> operations
> 
> On Tue,  7 Jul 2020 18:10:33 +0800
> Phil Yang <phil.yang at arm.com> wrote:
> 
> > +	return (uint16_t)(__atomic_add_fetch((int16_t *)&shinfo-
> >refcnt_atomic,
> > +
> 
> Why do you need so many casts here?
> The type of refcnt_atomic is now uint16 after your patch.

In the existing code, the input parameter type for this API is signed integer. For example:
drivers/net/netvsc/hn_rxtx.c:531
lib/librte_mbuf/rte_mbuf.h:1194

However, the output type of rte_mbuf_ext_refcnt related APIs is not uniform. We use these typecast to consistent with the current API definition.


More information about the dev mailing list