[dpdk-dev] [PATCH v10 2/7] ethdev: new API to resolve device capability name
Andrew Rybchenko
andrew.rybchenko at oktetlabs.ru
Tue Oct 19 19:57:35 CEST 2021
On 10/19/21 6:28 PM, Xueming Li wrote:
> This patch adds API to return name of device capability.
>
> Signed-off-by: Xueming Li <xuemingl at nvidia.com>
[snip]
> diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
> index bc55f899f72..97217529449 100644
> --- a/lib/ethdev/rte_ethdev.c
> +++ b/lib/ethdev/rte_ethdev.c
> @@ -165,6 +165,20 @@ static const struct {
>
> #undef RTE_TX_OFFLOAD_BIT2STR
>
> +#define RTE_ETH_DEV_CAPA_BIT2STR(_name) \
> + { RTE_ETH_DEV_CAPA_##_name, #_name }
In fact, such macros make more harm than add value.
It complicates grep by capability name. So, it is better
to drop the macro and just duplicate few symbols below.
> +
> +static const struct {
> + uint64_t offload;
> + const char *name;
> +} rte_eth_dev_capa_names[] = {
> + RTE_ETH_DEV_CAPA_BIT2STR(RUNTIME_RX_QUEUE_SETUP),
> + RTE_ETH_DEV_CAPA_BIT2STR(RUNTIME_TX_QUEUE_SETUP),
> + RTE_ETH_DEV_CAPA_BIT2STR(RXQ_SHARE),
> +};
> +
> +#undef RTE_ETH_DEV_CAPA_BIT2STR
> +
> /**
> * The user application callback description.
> *
More information about the dev
mailing list