[V11 02/18] net/hinic3: add basic header files

Stephen Hemminger stephen at networkplumber.org
Thu Sep 18 18:06:42 CEST 2025


On Wed, 17 Sep 2025 18:15:36 +0800
Feifei Wang <wff_light at vip.163.com> wrote:

> +
> +static inline int
> +hinic3_get_bit(int nr, volatile RTE_ATOMIC(uint64_t) *addr)
> +{
> +	RTE_ASSERT(nr < 0x20);
> +
> +	uint32_t mask = UINT32_C(1) << nr;
> +	return (*addr) & mask;
> +}

Shouldn't nr be unsigned? You don't want to support negative sifts here.
Use RTE_BIT32() macro if possible.

Since you declare addr as RTE_ATOMIC(), the only valid way
to access the variable is with rte_atomic_load_explicit() etc.
Some of the compilers versions (clang) will warn about this.


More information about the dev mailing list