[dpdk-dev] [PATCH v10 01/10] eal: introduce macro for bit definition

Parav Pandit parav at mellanox.com
Mon Jul 27 19:01:40 CEST 2020



> From: Morten Brørup <mb at smartsharesystems.com>
> Sent: Monday, July 27, 2020 1:52 PM
> > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Honnappa
> > Nagarahalli
> > Sent: Friday, July 24, 2020 8:31 PM
> >
> > <snip>
> >
> > > Subject: [dpdk-dev] [PATCH v10 01/10] eal: introduce macro for bit
> > definition
> > >
> > > There are several drivers which duplicate bit generation macro.
> > > Introduce a generic bit macros so that such drivers avoid redefining
> > same in
> > > multiple drivers.
> > >
> > > Signed-off-by: Parav Pandit <parav at mellanox.com>
> > > Acked-by: Matan Azrad <matan at mellanox.com>
> > > Acked-by: Morten Brørup <mb at smartsharesystems.com>
> > > ---
> > > Changelog:
> > > v4->v5:
> > >  - Addressed comments from Morten Brørup
> > >  - Renamed newly added macro to RTE_BIT64
> > >  - Added doxygen comment section for the macro
> > > v1->v2:
> > >  - Addressed comments from Thomas and Gaten.
> > >  - Avoided new file, added macro to rte_bitops.h
> > > ---
> > >  lib/librte_eal/include/rte_bitops.h | 8 ++++++++
> > >  1 file changed, 8 insertions(+)
> > >
> > > diff --git a/lib/librte_eal/include/rte_bitops.h
> > > b/lib/librte_eal/include/rte_bitops.h
> > > index 740927f3b..ca46a110f 100644
> > > --- a/lib/librte_eal/include/rte_bitops.h
> > > +++ b/lib/librte_eal/include/rte_bitops.h
> > > @@ -17,6 +17,14 @@
> > >  #include <rte_debug.h>
> > >  #include <rte_compat.h>
> > >
> > > +/**
> > > + * Get the uint64_t value for a specified bit set.
> > > + *
> > > + * @param nr
> > > + *   The bit number in range of 0 to 63.
> > > + */
> > > +#define RTE_BIT64(nr) (UINT64_C(1) << (nr))
> > In general, the macros have been avoided in this file. Suggest
> > changing this to an inline function.
> 
> That has been discussed already, and rejected for good reasons:
> https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Finbox.
> dpdk.org%2Fdev%2FAM0PR05MB4866823B0170B90F679A2765D1640%40AM
> 0PR05MB4866.eurprd05.prod.outlook.com%2F&data=02%7C01%7Cpara
> v%40mellanox.com%7Cdb43e7a083ae44a063a208d8320619b6%7Ca652971c7d
> 2e4d9ba6a4d149256f461b%7C0%7C0%7C637314349075254981&sdata=k
> R3fSOickIY2HbpmodNlB3ERF%2F2Qc7th55SGF40xmB0%3D&reserved=0
> 
> > Also, this file has uses of this macro, it would be good to replace
> > them with the new inline function.
> 
> Makes sense.
> And for consistency, it would require adding an RTE_BIT32() macro too.
Ok. Sending v12 addressing it.


More information about the dev mailing list