From patchwork Thu Feb 26 12:48:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Horman X-Patchwork-Id: 3749 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 1FA7E5697; Thu, 26 Feb 2015 13:48:43 +0100 (CET) Received: from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58]) by dpdk.org (Postfix) with ESMTP id 04DEB5681 for ; Thu, 26 Feb 2015 13:48:42 +0100 (CET) Received: from cpe-098-026-070-093.nc.res.rr.com ([98.26.70.93] helo=localhost) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1YQxrn-0001Bf-Rj; Thu, 26 Feb 2015 07:48:40 -0500 From: Neil Horman To: dev@dpdk.org Date: Thu, 26 Feb 2015 07:48:26 -0500 Message-Id: <1424954906-15886-1-git-send-email-nhorman@tuxdriver.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1424874849-8973-1-git-send-email-nhorman@tuxdriver.com> References: <1424874849-8973-1-git-send-email-nhorman@tuxdriver.com> X-Spam-Score: -2.9 (--) X-Spam-Status: No Subject: [dpdk-dev] [PATCH v2] eal: Clean up export of per_lcore__socket_id 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Theres no need to export this variable. Its set and queried from an API call that doesn't exist in the hot path. Instead just export the rte_socket_id symbol and make the variable private to protect it from type changes. We should do this with the other exported variables too, but I think its too late in the release cycle to do that. tested using distributor_autotest (which uses rte_socket_id), successfully. Only tested on linux, as I don't currently have a bsd system spun up, but the changes are symmetric, and should be fine Signed-off-by: Neil Horman Acked-by: Cunming Liang Acked-by: David Marchand --- Change Notes: v2) Moved rte_socket_id to be a common function --- lib/librte_eal/bsdapp/eal/eal_thread.c | 1 - lib/librte_eal/bsdapp/eal/rte_eal_version.map | 2 +- lib/librte_eal/common/eal_common_thread.c | 7 +++++++ lib/librte_eal/common/include/rte_lcore.h | 7 +------ lib/librte_eal/linuxapp/eal/eal_thread.c | 1 - lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/librte_eal/bsdapp/eal/eal_thread.c b/lib/librte_eal/bsdapp/eal/eal_thread.c index ca95c72..3672cdb 100644 --- a/lib/librte_eal/bsdapp/eal/eal_thread.c +++ b/lib/librte_eal/bsdapp/eal/eal_thread.c @@ -59,7 +59,6 @@ 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); - /* * Send a message to a slave lcore identified by slave_id to call a * function f with argument arg. Once the execution is done, the diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map index 17515a9..d83524d 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -10,7 +10,6 @@ DPDK_2.0 { pci_driver_list; per_lcore__lcore_id; per_lcore__rte_errno; - per_lcore__socket_id; rte_cpu_check_supported; rte_cpu_get_flag_enabled; rte_cycles_vmware_tsc_map; @@ -82,6 +81,7 @@ DPDK_2.0 { rte_set_log_level; rte_set_log_type; rte_snprintf; + rte_socket_id; rte_strerror; rte_strsplit; rte_sys_gettid; diff --git a/lib/librte_eal/common/eal_common_thread.c b/lib/librte_eal/common/eal_common_thread.c index f4d9892..2405e93 100644 --- a/lib/librte_eal/common/eal_common_thread.c +++ b/lib/librte_eal/common/eal_common_thread.c @@ -46,6 +46,13 @@ #include "eal_thread.h" +RTE_DECLARE_PER_LCORE(unsigned , _socket_id); + +unsigned rte_socket_id(void) +{ + return RTE_PER_LCORE(_socket_id); +} + int eal_cpuset_socket_id(rte_cpuset_t *cpusetp) { unsigned cpu = 0; diff --git a/lib/librte_eal/common/include/rte_lcore.h b/lib/librte_eal/common/include/rte_lcore.h index 20a58eb..e03264e 100644 --- a/lib/librte_eal/common/include/rte_lcore.h +++ b/lib/librte_eal/common/include/rte_lcore.h @@ -81,7 +81,6 @@ struct lcore_config { extern struct lcore_config lcore_config[RTE_MAX_LCORE]; RTE_DECLARE_PER_LCORE(unsigned, _lcore_id); /**< Per thread "lcore id". */ -RTE_DECLARE_PER_LCORE(unsigned, _socket_id); /**< Per thread "socket id". */ RTE_DECLARE_PER_LCORE(rte_cpuset_t, _cpuset); /**< Per thread "cpuset". */ /** @@ -145,11 +144,7 @@ rte_lcore_index(int lcore_id) * @return * the ID of current lcoreid's physical socket */ -static inline unsigned -rte_socket_id(void) -{ - return RTE_PER_LCORE(_socket_id); -} +unsigned rte_socket_id(void); /** * Get the ID of the physical socket of the specified lcore diff --git a/lib/librte_eal/linuxapp/eal/eal_thread.c b/lib/librte_eal/linuxapp/eal/eal_thread.c index 5635c7d..65bcbe3 100644 --- a/lib/librte_eal/linuxapp/eal/eal_thread.c +++ b/lib/librte_eal/linuxapp/eal/eal_thread.c @@ -59,7 +59,6 @@ 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); - /* * Send a message to a slave lcore identified by slave_id to call a * function f with argument arg. Once the execution is done, the diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map index 17515a9..d83524d 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -10,7 +10,6 @@ DPDK_2.0 { pci_driver_list; per_lcore__lcore_id; per_lcore__rte_errno; - per_lcore__socket_id; rte_cpu_check_supported; rte_cpu_get_flag_enabled; rte_cycles_vmware_tsc_map; @@ -82,6 +81,7 @@ DPDK_2.0 { rte_set_log_level; rte_set_log_type; rte_snprintf; + rte_socket_id; rte_strerror; rte_strsplit; rte_sys_gettid;