From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 39B4AB665 for ; Tue, 17 Feb 2015 03:09:10 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP; 16 Feb 2015 18:09:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,591,1418112000"; d="scan'208";a="528414210" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga003.jf.intel.com with ESMTP; 16 Feb 2015 18:00:36 -0800 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t1H295JJ019827; Tue, 17 Feb 2015 10:09:05 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t1H291sN028777; Tue, 17 Feb 2015 10:09:03 +0800 Received: (from cliang18@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t1H291TZ028773; Tue, 17 Feb 2015 10:09:01 +0800 From: Cunming Liang To: dev@dpdk.org Date: Tue, 17 Feb 2015 10:08:11 +0800 Message-Id: <1424138896-28618-15-git-send-email-cunming.liang@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1424138896-28618-1-git-send-email-cunming.liang@intel.com> References: <1423970145-31985-1-git-send-email-cunming.liang@intel.com> <1424138896-28618-1-git-send-email-cunming.liang@intel.com> Subject: [dpdk-dev] [PATCH v8 14/19] eal: set _lcore_id and _socket_id to (-1) by default X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Feb 2015 02:09:10 -0000 For those none EAL thread, *_lcore_id* shall always be LCORE_ID_ANY. The libraries using *_lcore_id* as index need to take care. *_socket_id* always be SOCKET_ID_ANY unitl the thread changes the affinity by rte_thread_set_affinity() Signed-off-by: Cunming Liang --- v5 changes: define LCORE_ID_ANY as UINT32_MAX lib/librte_eal/bsdapp/eal/eal_thread.c | 4 ++-- lib/librte_eal/common/include/rte_lcore.h | 4 ++-- lib/librte_eal/linuxapp/eal/eal_thread.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/librte_eal/bsdapp/eal/eal_thread.c b/lib/librte_eal/bsdapp/eal/eal_thread.c index e16f685..ca95c72 100644 --- a/lib/librte_eal/bsdapp/eal/eal_thread.c +++ b/lib/librte_eal/bsdapp/eal/eal_thread.c @@ -56,8 +56,8 @@ #include "eal_private.h" #include "eal_thread.h" -RTE_DEFINE_PER_LCORE(unsigned, _lcore_id); -RTE_DEFINE_PER_LCORE(unsigned, _socket_id); +RTE_DEFINE_PER_LCORE(unsigned, _lcore_id) = LCORE_ID_ANY; +RTE_DEFINE_PER_LCORE(unsigned, _socket_id) = (unsigned)SOCKET_ID_ANY; RTE_DEFINE_PER_LCORE(rte_cpuset_t, _cpuset); /* diff --git a/lib/librte_eal/common/include/rte_lcore.h b/lib/librte_eal/common/include/rte_lcore.h index 6a5bcbc..ad47221 100644 --- a/lib/librte_eal/common/include/rte_lcore.h +++ b/lib/librte_eal/common/include/rte_lcore.h @@ -48,7 +48,7 @@ extern "C" { #endif -#define LCORE_ID_ANY -1 /**< Any lcore. */ +#define LCORE_ID_ANY UINT32_MAX /**< Any lcore. */ #if defined(__linux__) typedef cpu_set_t rte_cpuset_t; @@ -87,7 +87,7 @@ RTE_DECLARE_PER_LCORE(rte_cpuset_t, _cpuset); /**< Per thread "cpuset". */ /** * Return the ID of the execution unit we are running on. * @return - * Logical core ID + * Logical core ID(in EAL thread) or LCORE_ID_ANY(in non-EAL thread) */ static inline unsigned rte_lcore_id(void) diff --git a/lib/librte_eal/linuxapp/eal/eal_thread.c b/lib/librte_eal/linuxapp/eal/eal_thread.c index 57b0515..5635c7d 100644 --- a/lib/librte_eal/linuxapp/eal/eal_thread.c +++ b/lib/librte_eal/linuxapp/eal/eal_thread.c @@ -56,8 +56,8 @@ #include "eal_private.h" #include "eal_thread.h" -RTE_DEFINE_PER_LCORE(unsigned, _lcore_id); -RTE_DEFINE_PER_LCORE(unsigned, _socket_id); +RTE_DEFINE_PER_LCORE(unsigned, _lcore_id) = LCORE_ID_ANY; +RTE_DEFINE_PER_LCORE(unsigned, _socket_id) = (unsigned)SOCKET_ID_ANY; RTE_DEFINE_PER_LCORE(rte_cpuset_t, _cpuset); /* -- 1.8.1.4