Simple API to check if the lcore ID does not exceed the maximum number of lcores configured.
Signed-off-by: Honnappa Nagarahalli <honnappa.nagaraha...@arm.com> Reviewed-by: Ruifeng Wang <ruifeng.w...@arm.com> --- lib/eal/include/rte_lcore.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/eal/include/rte_lcore.h b/lib/eal/include/rte_lcore.h index 6a355e9986..cf99919a02 100644 --- a/lib/eal/include/rte_lcore.h +++ b/lib/eal/include/rte_lcore.h @@ -38,6 +38,20 @@ enum rte_lcore_role_t { ROLE_NON_EAL, }; +/** + * Check if the lcore ID is valid + * + * @param lcore_id + * The identifier of the lcore. + * + * @return + * True if the given lcore ID is between 0 and RTE_MAX_LCORE-1. + */ +static inline int rte_lcore_id_is_valid(unsigned int lcore_id) +{ + return (lcore_id < RTE_MAX_LCORE); +} + /** * Get a lcore's role. * -- 2.25.1