[PATCH v3 01/10] eal: add interface to check if lcore is EAL managed
Huisong Li
lihuisong at huawei.com
Fri May 22 06:11:01 CEST 2026
Add a new helper function rte_lcore_is_eal_managed() to determine
if a logical core is managed by EAL.
This interface returns true if the lcore role is either ROLE_RTE
(standard worker/main cores) or ROLE_SERVICE (service cores).
Signed-off-by: Huisong Li <lihuisong at huawei.com>
---
doc/guides/rel_notes/release_26_07.rst | 6 ++++++
lib/eal/common/eal_common_lcore.c | 11 +++++++++++
lib/eal/include/rte_lcore.h | 12 ++++++++++++
3 files changed, 29 insertions(+)
diff --git a/doc/guides/rel_notes/release_26_07.rst b/doc/guides/rel_notes/release_26_07.rst
index f012d47a4b..be5ccecd46 100644
--- a/doc/guides/rel_notes/release_26_07.rst
+++ b/doc/guides/rel_notes/release_26_07.rst
@@ -63,6 +63,12 @@ New Features
``rte_eal_init`` and the application is responsible for probing each device,
* ``--auto-probing`` enables the initial bus probing, which is the current default behavior.
+* **Added lcore EAL-managed status check.**
+
+ Added ``rte_lcore_is_eal_managed()`` helper function in EAL lcore library
+ to check whether a logical core is managed by EAL
+ (i.e., its role is ``ROLE_RTE`` or ``ROLE_SERVICE``).
+
Removed Items
-------------
diff --git a/lib/eal/common/eal_common_lcore.c b/lib/eal/common/eal_common_lcore.c
index 39411f9370..ab7b5e8393 100644
--- a/lib/eal/common/eal_common_lcore.c
+++ b/lib/eal/common/eal_common_lcore.c
@@ -102,6 +102,17 @@ int rte_lcore_is_enabled(unsigned int lcore_id)
return cfg->lcore_role[lcore_id] == ROLE_RTE;
}
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_lcore_is_eal_managed, 26.07)
+int rte_lcore_is_eal_managed(unsigned int lcore_id)
+{
+ struct rte_config *cfg = rte_eal_get_configuration();
+
+ if (lcore_id >= RTE_MAX_LCORE)
+ return 0;
+ return cfg->lcore_role[lcore_id] == ROLE_RTE ||
+ cfg->lcore_role[lcore_id] == ROLE_SERVICE;
+}
+
RTE_EXPORT_SYMBOL(rte_get_next_lcore)
unsigned int rte_get_next_lcore(unsigned int i, int skip_main, int wrap)
{
diff --git a/lib/eal/include/rte_lcore.h b/lib/eal/include/rte_lcore.h
index 10f965b4f0..9e6bb5230a 100644
--- a/lib/eal/include/rte_lcore.h
+++ b/lib/eal/include/rte_lcore.h
@@ -195,6 +195,18 @@ rte_cpuset_t rte_lcore_cpuset(unsigned int lcore_id);
*/
int rte_lcore_is_enabled(unsigned int lcore_id);
+/**
+ * Test if an lcore is ROLE_RTE or ROLE_SERVICE.
+ *
+ * @param lcore_id
+ * The identifier of the lcore, which MUST be between 0 and
+ * RTE_MAX_LCORE-1.
+ * @return
+ * True if the given lcore is ROLE_RTE or ROLE_SERVICE; false otherwise.
+ */
+__rte_experimental
+int rte_lcore_is_eal_managed(unsigned int lcore_id);
+
/**
* Get the next enabled lcore ID.
*
--
2.33.0
More information about the dev
mailing list