[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
Wed Oct 23 05:12:34 CEST 2019
> > 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.
As bit operations are mostly applied to IO devices, change the header file
to rte_io_bitops.h to introduce IO specific bit operations now. And do this
change in v2.
More information about the dev
mailing list