[dpdk-dev] [RFC PATCH 1/6] eal: introduce macros for getting value for bit
Gaëtan Rivet
grive at u256.net
Mon Jun 15 21:33:42 CEST 2020
Hello Parav,
On 10/06/20 17:17 +0000, Parav Pandit wrote:
> 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>
> ---
> lib/librte_eal/include/rte_bits.h | 10 ++++++++++
> 1 file changed, 10 insertions(+)
> create mode 100644 lib/librte_eal/include/rte_bits.h
>
> diff --git a/lib/librte_eal/include/rte_bits.h b/lib/librte_eal/include/rte_bits.h
> new file mode 100644
> index 000000000..37f284971
> --- /dev/null
> +++ b/lib/librte_eal/include/rte_bits.h
> @@ -0,0 +1,10 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright 2020 Mellanox Technologies, Ltd.
> + */
> +
> +#ifndef _RTE_BITS_H_
> +#define _RTE_BITS_H_
> +
> +#define RTE_BIT(bit_num) (1UL << (bit_num))
^ The tab here should be replaced by a space.
> +
> +#endif
> --
> 2.25.4
>
I'm not sure this kind of macro is needed, but if multiple
drivers are using the patterns let's say ok.
However I don't think it needs its own header. Would it be ok in
lib/librte_eal/include/rte_common.h for example?
--
Gaëtan
More information about the dev
mailing list