> -----Original Message----- > From: Stephen Hemminger <step...@networkplumber.org> > Sent: Wednesday, October 16, 2019 12:54 AM > To: Joyce Kong (Arm Technology China) <joyce.k...@arm.com> > Cc: dev@dpdk.org; nd <n...@arm.com>; tho...@monjalon.net; > jer...@marvell.com; ravi1.ku...@amd.com; xuanziya...@huawei.com; > cloud.wangxiao...@huawei.com; zhouguoy...@huawei.com; > rm...@marvell.com; shsha...@marvell.com; Honnappa Nagarahalli > <honnappa.nagaraha...@arm.com>; Gavin Hu (Arm Technology China) > <gavin...@arm.com> > Subject: Re: [dpdk-dev] [PATCH v1 1/5] lib/eal: implement the family of rte > bit operation APIs > > On Tue, 15 Oct 2019 15:49:57 +0800 > Joyce Kong <joyce.k...@arm.com> wrote: > > > +static inline void > > +rte_set_bit(unsigned int nr, unsigned long *addr) { > > + __atomic_fetch_or(addr, (1UL << nr), __ATOMIC_ACQ_REL); } > > + > > +static inline void > > +rte_clear_bit(int nr, unsigned long *addr) { > > + __atomic_fetch_and(addr, ~(1UL << nr), __ATOMIC_ACQ_REL); } > > + > > +static inline int > > +rte_test_bit(int nr, unsigned long *addr) { > > + int res; > > + rte_mb(); > > + res = ((*addr) & (1UL << nr)) != 0; > > + rte_mb(); > > + > > + return res; > > +} > > + > > +static inline int > > +rte_test_and_set_bit(int nr, unsigned long *addr) { > > + unsigned long mask = (1UL << nr); > > + > > + return __atomic_fetch_or(addr, mask, __ATOMIC_ACQ_REL) & > mask; } > > + > > +static inline int > > +rte_test_and_clear_bit(int nr, unsigned long *addr) { > > + unsigned long mask = (1UL << nr); > > + > > + return __atomic_fetch_and(addr, ~mask, __ATOMIC_ACQ_REL) & > mask; } > > These functions need to be part of API, and have doxygen comments?
Will add doxygen comments in next version.