diff options
author | Tal Shnaiderman <talshn@nvidia.com> | 2021-01-06 22:35:52 +0200 |
---|---|---|
committer | Thomas Monjalon <thomas@monjalon.net> | 2021-01-11 23:27:39 +0100 |
commit | d136fae5604e8a5e638cc5c9f415a5c636f280c8 (patch) | |
tree | 1b20b9fb408d5b1bfa0b2977079b28e2b8459abe | |
parent | ef4c16fd9148215897abadf8e8a965488c82ba03 (diff) |
eal: move thread affinity functions to new file
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 <talshn@nvidia.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
-rw-r--r-- | lib/librte_eal/include/meson.build | 1 | ||||
-rw-r--r-- | lib/librte_eal/include/rte_lcore.h | 22 | ||||
-rw-r--r-- | lib/librte_eal/include/rte_thread.h | 47 |
3 files changed, 49 insertions, 21 deletions
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 <rte_per_lcore.h> #include <rte_eal.h> #include <rte_launch.h> +#include <rte_thread.h> #ifdef __cplusplus extern "C" { @@ -358,27 +359,6 @@ 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. * * @note It fails with glibc < 2.12. diff --git a/lib/librte_eal/include/rte_thread.h b/lib/librte_eal/include/rte_thread.h new file mode 100644 index 0000000000..a1ced3cf72 --- /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 <rte_os.h> + +#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 + * Pointer to CPU affinity to set. + * @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 + * Pointer to CPU affinity of current thread. + * 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_ */ |