[dpdk-dev] [PATCH v1 1/5] lib/eal: implement the family of rte bit operation APIs

Joyce Kong (Arm Technology China) Joyce.Kong at arm.com
Fri Oct 18 11:02:40 CEST 2019


> -----Original Message-----
> From: Jerin Jacob <jerinjacobk at gmail.com>
> Sent: Wednesday, October 16, 2019 3:54 PM
> To: Joyce Kong (Arm Technology China) <Joyce.Kong at arm.com>
> Cc: dpdk-dev <dev at dpdk.org>; nd <nd at arm.com>; thomas at monjalon.net;
> jerinj at marvell.com; ravi1.kumar at amd.com; Ziyang Xuan
> <xuanziyang2 at huawei.com>; Xiaoyun Wang
> <cloud.wangxiaoyun at huawei.com>; Guoyang Zhou
> <zhouguoyang at huawei.com>; Rasesh Mody <rmody at marvell.com>;
> Shahed Shaikh <shshaikh at marvell.com>; Honnappa Nagarahalli
> <Honnappa.Nagarahalli at arm.com>; Gavin Hu (Arm Technology China)
> <Gavin.Hu at arm.com>
> Subject: Re: [dpdk-dev] [PATCH v1 1/5] lib/eal: implement the family of rte
> bit operation APIs
> 
> On Tue, Oct 15, 2019 at 1:20 PM Joyce Kong <joyce.kong at arm.com> wrote:
> >
> > There are a lot functions of bit operations scattered and duplicated
> > in PMDs, consolidating them into a common API family is necessary.
> > Furthermore, the bit operation is mostly applied to the IO devices, so
> > use __ATOMIC_ACQ_REL to ensure the ordering.
> >
> > Signed-off-by: Joyce Kong <joyce.kong at arm.com>
> > ---
> >  lib/librte_eal/common/Makefile             |  1 +
> >  lib/librte_eal/common/include/rte_bitops.h | 56
> ++++++++++++++++++++++++++++++
> >  lib/librte_eal/common/meson.build          |  1 +
> > +
> > +static inline void
> > +rte_set_bit(unsigned int nr, unsigned long *addr) {
> > +       __atomic_fetch_or(addr, (1UL << nr), __ATOMIC_ACQ_REL); }
> 
> If it is specific for IO the IMO, it makes sense call the API to
> rte_io_set_bit() like rte_io_rmb
> and change the header file to rte_io_bitops.h.
> 
> The barries are only needed for IO operations. Explicitly is not conveying it in
> API name would call for using it for normal cases.
> 
> Other option could be to introduce, generic and IO specific bit operations
> operations separately.

Would do some related changes in next version.


More information about the dev mailing list