> From: Srikanth Yalavarthi [mailto:syalavar...@marvell.com] > Sent: Tuesday, 12 April 2022 19.42 > > Added new macros for pointer operations, bitwise operations, > spinlocks and 32 bit read and write. > > Signed-off-by: Srikanth Yalavarthi <syalavar...@marvell.com> > --- > drivers/common/cnxk/roc_bits.h | 12 ++++++++++++ > drivers/common/cnxk/roc_platform.h | 28 +++++++++++++++++++--------- > 2 files changed, 31 insertions(+), 9 deletions(-) > > diff --git a/drivers/common/cnxk/roc_bits.h > b/drivers/common/cnxk/roc_bits.h > index 11216d9d63..ce3dffa08d 100644 > --- a/drivers/common/cnxk/roc_bits.h > +++ b/drivers/common/cnxk/roc_bits.h > @@ -29,4 +29,16 @@ > (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) > #endif > > +#ifndef IS_BIT_SET > +#define IS_BIT_SET(num, n) ((num) & (1 << (n))) > +#endif > + > +#ifndef SET_BIT > +#define SET_BIT(num, n) ((num) | (1 << (n))) > +#endif > + > +#ifndef CLEAR_BIT > +#define CLEAR_BIT(num, n) ((num) &= ~((1) << (n))) > +#endif > + > #endif /* _ROC_BITS_H_ */
You could consider replacing these with explicit 32/64 bit variants, using the RTE_BIT64() and RTE_BIT32() macros instead of (1 << (n)). Just a suggestion - I'll leave it up to you. -Morten