From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76112CD3436 for ; Thu, 7 May 2026 02:42:59 +0000 (UTC) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 79EED4066A; Thu, 7 May 2026 04:42:40 +0200 (CEST) Received: from canpmsgout04.his.huawei.com (canpmsgout04.his.huawei.com [113.46.200.219]) by mails.dpdk.org (Postfix) with ESMTP id 953BC402AB for ; Thu, 7 May 2026 04:42:35 +0200 (CEST) dkim-signature: v=1; a=rsa-sha256; d=h-partners.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=zltrr9OANM5dNQZAqBBPO1aaOp9xJCdsDgUxAwjWNM8=; b=nbZaEY98GSdh7O2ptZ/mNLoKCXvfqzZDMSA7NhKYS3RoxSPIiNAUs5QUs+4WxanIT9QVzdlNG 0SJdSqZLQKKiKnw2o+YUGW1nLvMqRlrQq91gtGs8QdMqm9o2tYcc1R7ABtzokqHRFR6act9KYiv Zeq2l6CRoaTqDQ5SPBrL/AQ= Received: from mail.maildlp.com (unknown [172.19.163.104]) by canpmsgout04.his.huawei.com (SkyGuard) with ESMTPS id 4g9xFT5KyQz1prL8; Thu, 7 May 2026 10:35:57 +0800 (CST) Received: from dggemv712-chm.china.huawei.com (unknown [10.1.198.32]) by mail.maildlp.com (Postfix) with ESMTPS id 156F94048F; Thu, 7 May 2026 10:42:32 +0800 (CST) Received: from kwepemn100009.china.huawei.com (7.202.194.112) by dggemv712-chm.china.huawei.com (10.1.198.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 7 May 2026 10:42:31 +0800 Received: from localhost.localdomain (10.50.163.32) by kwepemn100009.china.huawei.com (7.202.194.112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.36; Thu, 7 May 2026 10:42:31 +0800 From: Huisong Li To: , , CC: , , , , , Subject: [PATCH V2 01/15] eal: add interface to check if lcore is EAL managed Date: Thu, 7 May 2026 10:42:16 +0800 Message-ID: <20260507024230.1198111-2-lihuisong@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20260507024230.1198111-1-lihuisong@huawei.com> References: <20260416030612.2379407-1-lihuisong@huawei.com> <20260507024230.1198111-1-lihuisong@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.50.163.32] X-ClientProxiedBy: kwepems100001.china.huawei.com (7.221.188.238) To kwepemn100009.china.huawei.com (7.202.194.112) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- lib/eal/common/eal_common_lcore.c | 11 +++++++++++ lib/eal/include/rte_lcore.h | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/lib/eal/common/eal_common_lcore.c b/lib/eal/common/eal_common_lcore.c index 39411f9370..dfbd96875a 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_SYMBOL(rte_lcore_is_eal_managed) +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..cbfd50a936 100644 --- a/lib/eal/include/rte_lcore.h +++ b/lib/eal/include/rte_lcore.h @@ -195,6 +195,17 @@ 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. + */ +int rte_lcore_is_eal_managed(unsigned int lcore_id); + /** * Get the next enabled lcore ID. * -- 2.33.0