On Tue, 15 Oct 2019 15:49:57 +0800
Joyce Kong <[email protected]> wrote:
> +static inline void
> +rte_set_bit(unsigned int nr, unsigned long *addr)
> +{
> + __atomic_fetch_or(addr, (1UL << nr), __ATOMIC_ACQ_REL);
> +}
> +
> +static inline void
> +rte_clear_bit(int nr, unsigned long *addr)
> +{
> + __atomic_fetch_and(addr, ~(1UL << nr), __ATOMIC_ACQ_REL);
> +}
> +
> +static inline int
> +rte_test_bit(int nr, unsigned long *addr)
> +{
> + int res;
> + rte_mb();
> + res = ((*addr) & (1UL << nr)) != 0;
> + rte_mb();
> +
> + return res;
> +}
> +
> +static inline int
> +rte_test_and_set_bit(int nr, unsigned long *addr)
> +{
> + unsigned long mask = (1UL << nr);
> +
> + return __atomic_fetch_or(addr, mask, __ATOMIC_ACQ_REL) & mask;
> +}
> +
> +static inline int
> +rte_test_and_clear_bit(int nr, unsigned long *addr)
> +{
> + unsigned long mask = (1UL << nr);
> +
> + return __atomic_fetch_and(addr, ~mask, __ATOMIC_ACQ_REL) & mask;
> +}
These functions need to be part of API, and have doxygen comments?