From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0D6D6A329E for ; Wed, 23 Oct 2019 20:56:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2D76F1D41B; Wed, 23 Oct 2019 20:55:23 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id 0DFB81D157 for ; Wed, 23 Oct 2019 20:55:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571856915; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X2zCgztgUH4K7qMe9i0XP2RvmUNyE4amqdicIfdGx8Q=; b=iqKpIYfpudRhBsR/NmvUieBE5aCoQAkebVDph3k2JoXejc6WsXby5hSfTeJ6WkCAG+t0S/ efgbMIUI1vQLJ3jpMsAgtdGCoNBd5O69RwxsL/BEPi+A+ZNaGqY49X+qFUfFraVq2mEirN 2Lf9qcRr+zb+LhaNJl7zYFtzG/dYRXU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-166-gkxpVkLAOUCqjHBAt5i8iA-1; Wed, 23 Oct 2019 14:55:13 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 15D151005500; Wed, 23 Oct 2019 18:55:12 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-204-129.brq.redhat.com [10.40.204.129]) by smtp.corp.redhat.com (Postfix) with ESMTP id A9FB360872; Wed, 23 Oct 2019 18:55:09 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stephen@networkplumber.org, anatoly.burakov@intel.com, thomas@monjalon.net, Bruce Richardson Date: Wed, 23 Oct 2019 20:54:23 +0200 Message-Id: <1571856864-8779-12-git-send-email-david.marchand@redhat.com> In-Reply-To: <1571856864-8779-1-git-send-email-david.marchand@redhat.com> References: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> <1571856864-8779-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: gkxpVkLAOUCqjHBAt5i8iA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Subject: [dpdk-dev] [PATCH v2 11/12] eal: factorize lcore role code in common code X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This code belongs to the lcore API, move the prototype to the right header, then factorize the code into the common code. Signed-off-by: David Marchand --- lib/librte_eal/common/eal_common_lcore.c | 10 ++++++++++ lib/librte_eal/common/include/rte_eal.h | 11 ----------- lib/librte_eal/common/include/rte_lcore.h | 10 ++++++++++ lib/librte_eal/freebsd/eal/eal.c | 7 ------- lib/librte_eal/linux/eal/eal.c | 7 ------- 5 files changed, 20 insertions(+), 25 deletions(-) diff --git a/lib/librte_eal/common/eal_common_lcore.c b/lib/librte_eal/comm= on/eal_common_lcore.c index abd2cf8..343d9b4 100644 --- a/lib/librte_eal/common/eal_common_lcore.c +++ b/lib/librte_eal/common/eal_common_lcore.c @@ -53,6 +53,16 @@ rte_cpuset_t rte_lcore_cpuset(unsigned int lcore_id) =09return lcore_config[lcore_id].cpuset; } =20 +enum rte_lcore_role_t +rte_eal_lcore_role(unsigned int lcore_id) +{ +=09struct rte_config *cfg =3D rte_eal_get_configuration(); + +=09if (lcore_id >=3D RTE_MAX_LCORE) +=09=09return ROLE_OFF; +=09return cfg->lcore_role[lcore_id]; +} + int rte_lcore_is_enabled(unsigned int lcore_id) { =09struct rte_config *cfg =3D rte_eal_get_configuration(); diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/commo= n/include/rte_eal.h index b7cf912..ea3c9df 100644 --- a/lib/librte_eal/common/include/rte_eal.h +++ b/lib/librte_eal/common/include/rte_eal.h @@ -84,17 +84,6 @@ struct rte_config { struct rte_config *rte_eal_get_configuration(void); =20 /** - * Get a lcore's role. - * - * @param lcore_id - * The identifier of the lcore. - * @return - * The role of the lcore. - */ -enum rte_lcore_role_t rte_eal_lcore_role(unsigned lcore_id); - - -/** * Get the process type in a multi-process setup * * @return diff --git a/lib/librte_eal/common/include/rte_lcore.h b/lib/librte_eal/com= mon/include/rte_lcore.h index ea40c25..555b692 100644 --- a/lib/librte_eal/common/include/rte_lcore.h +++ b/lib/librte_eal/common/include/rte_lcore.h @@ -70,6 +70,16 @@ RTE_DECLARE_PER_LCORE(unsigned, _lcore_id); /**< Per th= read "lcore id". */ RTE_DECLARE_PER_LCORE(rte_cpuset_t, _cpuset); /**< Per thread "cpuset". */ =20 /** + * Get a lcore's role. + * + * @param lcore_id + * The identifier of the lcore, which MUST be between 0 and RTE_MAX_LCOR= E-1. + * @return + * The role of the lcore. + */ +enum rte_lcore_role_t rte_eal_lcore_role(unsigned int lcore_id); + +/** * Return the Application thread ID of the execution unit. * * Note: in most cases the lcore id returned here will also correspond diff --git a/lib/librte_eal/freebsd/eal/eal.c b/lib/librte_eal/freebsd/eal/= eal.c index f86e9aa..40d8f57 100644 --- a/lib/librte_eal/freebsd/eal/eal.c +++ b/lib/librte_eal/freebsd/eal/eal.c @@ -943,13 +943,6 @@ rte_eal_cleanup(void) =09return 0; } =20 -/* get core role */ -enum rte_lcore_role_t -rte_eal_lcore_role(unsigned lcore_id) -{ -=09return rte_config.lcore_role[lcore_id]; -} - enum rte_proc_type_t rte_eal_process_type(void) { diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.= c index f397206..5769489 100644 --- a/lib/librte_eal/linux/eal/eal.c +++ b/lib/librte_eal/linux/eal/eal.c @@ -1348,13 +1348,6 @@ rte_eal_cleanup(void) =09return 0; } =20 -/* get core role */ -enum rte_lcore_role_t -rte_eal_lcore_role(unsigned lcore_id) -{ -=09return rte_config.lcore_role[lcore_id]; -} - enum rte_proc_type_t rte_eal_process_type(void) { --=20 1.8.3.1