From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (xvm-189-124.dc0.ghst.net [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 22B2DA09FF; Wed, 6 Jan 2021 21:36:24 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DDE36140E1D; Wed, 6 Jan 2021 21:36:23 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by mails.dpdk.org (Postfix) with ESMTP id 14B7A40FA7 for ; Wed, 6 Jan 2021 21:36:21 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from talshn@nvidia.com) with SMTP; 6 Jan 2021 22:36:20 +0200 Received: from nvidia.com (l-wincomp04-vm.mtl.labs.mlnx [10.237.1.5]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 106KaKmu026677; Wed, 6 Jan 2021 22:36:20 +0200 From: Tal Shnaiderman To: dev@dpdk.org Cc: thomas@monjalon.net, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com, navasile@linux.microsoft.com, dmitrym@microsoft.com, david.marchand@redhat.com Date: Wed, 6 Jan 2021 22:35:52 +0200 Message-Id: <20210106203553.9876-2-talshn@nvidia.com> X-Mailer: git-send-email 2.16.1.windows.4 In-Reply-To: <20210106203553.9876-1-talshn@nvidia.com> References: <20210106194543.14024-1-talshn@nvidia.com> <20210106203553.9876-1-talshn@nvidia.com> Subject: [dpdk-dev] [PATCH v9 1/2] eal: move thread affinity functions to new file 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 Sender: "dev" Move the definition of the functions rte_thread_set_affinity and rte_thread_get_affinity to new file, rte_thread.h The file will implement generic threading functionality and will only host threading functions which do not reference pthread API. Signed-off-by: Tal Shnaiderman --- lib/librte_eal/include/meson.build | 1 + lib/librte_eal/include/rte_lcore.h | 22 +---------------- lib/librte_eal/include/rte_thread.h | 47 +++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 21 deletions(-) create mode 100644 lib/librte_eal/include/rte_thread.h diff --git a/lib/librte_eal/include/meson.build b/lib/librte_eal/include/meson.build index dc007084ff..0dea342e1d 100644 --- a/lib/librte_eal/include/meson.build +++ b/lib/librte_eal/include/meson.build @@ -40,6 +40,7 @@ headers += files( 'rte_service_component.h', 'rte_string_fns.h', 'rte_tailq.h', + 'rte_thread.h', 'rte_time.h', 'rte_trace.h', 'rte_trace_point.h', diff --git a/lib/librte_eal/include/rte_lcore.h b/lib/librte_eal/include/rte_lcore.h index 48b87e253a..0fe0bd839c 100644 --- a/lib/librte_eal/include/rte_lcore.h +++ b/lib/librte_eal/include/rte_lcore.h @@ -15,6 +15,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -357,27 +358,6 @@ __rte_experimental void rte_lcore_dump(FILE *f); -/** - * Set core affinity of the current thread. - * Support both EAL and non-EAL thread and update TLS. - * - * @param cpusetp - * Point to cpu_set_t for setting current thread affinity. - * @return - * On success, return 0; otherwise return -1; - */ -int rte_thread_set_affinity(rte_cpuset_t *cpusetp); - -/** - * Get core affinity of the current thread. - * - * @param cpusetp - * Point to cpu_set_t for getting current thread cpu affinity. - * It presumes input is not NULL, otherwise it causes panic. - * - */ -void rte_thread_get_affinity(rte_cpuset_t *cpusetp); - /** * Set thread names. * diff --git a/lib/librte_eal/include/rte_thread.h b/lib/librte_eal/include/rte_thread.h new file mode 100644 index 0000000000..43bf568d59 --- /dev/null +++ b/lib/librte_eal/include/rte_thread.h @@ -0,0 +1,47 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2021 Mellanox Technologies, Ltd + */ + +#include + +#ifndef _RTE_THREAD_H_ +#define _RTE_THREAD_H_ + +/** + * @file + * + * Threading functions + * + * Simple threads functionality supplied by EAL. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Set core affinity of the current thread. + * Support both EAL and non-EAL thread and update TLS. + * + * @param cpusetp + * Point to cpu_set_t for setting current thread affinity. + * @return + * On success, return 0; otherwise return -1; + */ +int rte_thread_set_affinity(rte_cpuset_t *cpusetp); + +/** + * Get core affinity of the current thread. + * + * @param cpusetp + * Point to cpu_set_t for getting current thread cpu affinity. + * It presumes input is not NULL, otherwise it causes panic. + * + */ +void rte_thread_get_affinity(rte_cpuset_t *cpusetp); + +#ifdef __cplusplus +} +#endif + +#endif /* _RTE_THREAD_H_ */ -- 2.16.1.windows.4