[PATCH] eal: fix return value of lcore role
Thomas Monjalon
thomas at monjalon.net
Sun Jun 8 21:57:19 CEST 2025
20/05/2025 22:17, pbhagavatula at marvell.com:
> From: Pavan Nikhilesh <pbhagavatula at marvell.com>
>
> Update rte_lcore_has_role() to return false instead of a
> negative value for invalid lcore IDs, removing the need
> for callers to pre-validate the ID.
>
> Fixes: b0a1502a277c ("eal: make semantics of lcore role function more intuitive")
> Cc: stable at dpdk.org
The API comment says:
* @return
* Boolean value: positive if test is true; otherwise returns 0.
So yes we can consider this as a fix.
> --- a/lib/eal/common/eal_common_lcore.c
> +++ b/lib/eal/common/eal_common_lcore.c
> @@ -87,7 +87,7 @@ rte_lcore_has_role(unsigned int lcore_id, enum rte_lcore_role_t role)
> struct rte_config *cfg = rte_eal_get_configuration();
>
> if (lcore_id >= RTE_MAX_LCORE)
> - return -EINVAL;
> + return 0;
>
> return cfg->lcore_role[lcore_id] == role;
> }
Applied, thanks.
More information about the dev
mailing list