DPDK 25.03.0-rc0
rte_thread.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2021 Mellanox Technologies, Ltd
3 * Copyright (C) 2022 Microsoft Corporation
4 */
5
6#include <stdint.h>
7
8#include <rte_os.h>
9#include <rte_compat.h>
10
11#ifndef _RTE_THREAD_H_
12#define _RTE_THREAD_H_
13
22#ifdef __cplusplus
23extern "C" {
24#endif
25
27#define RTE_THREAD_NAME_SIZE 16
28/* Old definition, aliased for compatibility. */
29#define RTE_MAX_THREAD_NAME_LEN RTE_THREAD_NAME_SIZE
30
32#define RTE_THREAD_INTERNAL_PREFIX "dpdk-"
34#define RTE_THREAD_INTERNAL_NAME_SIZE 11
35
39typedef struct {
40 uintptr_t opaque_id;
42
53typedef uint32_t (*rte_thread_func) (void *arg);
54
63};
64
68typedef struct {
70#ifdef RTE_HAS_CPUSET
71 rte_cpuset_t cpuset;
72#endif
74
78typedef struct eal_tls_key *rte_thread_key;
79
100 const rte_thread_attr_t *thread_attr,
101 rte_thread_func thread_func, void *arg);
102
125int
126rte_thread_create_control(rte_thread_t *thread, const char *name,
127 rte_thread_func thread_func, void *arg);
128
153__rte_internal
154int
156 rte_thread_func func, void *arg);
157
171int rte_thread_join(rte_thread_t thread_id, uint32_t *value_ptr);
172
185
193
208void
209rte_thread_set_name(rte_thread_t thread_id, const char *thread_name);
210
227__rte_internal
228void
230
245
259
275 enum rte_thread_priority priority);
276
277#ifdef RTE_HAS_CPUSET
278
294 rte_cpuset_t *cpuset);
295
311 rte_cpuset_t *cpuset);
312
328 const rte_cpuset_t *cpuset);
329
345 rte_cpuset_t *cpuset);
346
356int rte_thread_set_affinity(rte_cpuset_t *cpusetp);
357
365void rte_thread_get_affinity(rte_cpuset_t *cpusetp);
366
367#endif /* RTE_HAS_CPUSET */
368
383 enum rte_thread_priority *priority);
384
399 enum rte_thread_priority priority);
400
420 void (*destructor)(void *));
421
435
450int rte_thread_value_set(rte_thread_key key, const void *value);
451
465
466#ifdef __cplusplus
467}
468#endif
469
470#endif /* _RTE_THREAD_H_ */
int rte_thread_set_priority(rte_thread_t thread_id, enum rte_thread_priority priority)
__rte_internal int rte_thread_create_internal_control(rte_thread_t *id, const char *name, rte_thread_func func, void *arg)
struct eal_tls_key * rte_thread_key
Definition: rte_thread.h:78
void * rte_thread_value_get(rte_thread_key key)
int rte_thread_get_affinity_by_id(rte_thread_t thread_id, rte_cpuset_t *cpuset)
void rte_thread_get_affinity(rte_cpuset_t *cpusetp)
__rte_internal void rte_thread_set_prefixed_name(rte_thread_t id, const char *name)
int rte_thread_key_create(rte_thread_key *key, void(*destructor)(void *))
int rte_thread_key_delete(rte_thread_key key)
int rte_thread_equal(rte_thread_t t1, rte_thread_t t2)
int rte_thread_attr_set_priority(rte_thread_attr_t *thread_attr, enum rte_thread_priority priority)
int rte_thread_attr_init(rte_thread_attr_t *attr)
int rte_thread_set_affinity_by_id(rte_thread_t thread_id, const rte_cpuset_t *cpuset)
void rte_thread_set_name(rte_thread_t thread_id, const char *thread_name)
int rte_thread_join(rte_thread_t thread_id, uint32_t *value_ptr)
int rte_thread_attr_get_affinity(rte_thread_attr_t *thread_attr, rte_cpuset_t *cpuset)
int rte_thread_create_control(rte_thread_t *thread, const char *name, rte_thread_func thread_func, void *arg)
rte_thread_priority
Definition: rte_thread.h:58
@ RTE_THREAD_PRIORITY_REALTIME_CRITICAL
Definition: rte_thread.h:61
@ RTE_THREAD_PRIORITY_NORMAL
Definition: rte_thread.h:59
int rte_thread_detach(rte_thread_t thread_id)
uint32_t(* rte_thread_func)(void *arg)
Definition: rte_thread.h:53
int rte_thread_get_priority(rte_thread_t thread_id, enum rte_thread_priority *priority)
int rte_thread_create(rte_thread_t *thread_id, const rte_thread_attr_t *thread_attr, rte_thread_func thread_func, void *arg)
int rte_thread_value_set(rte_thread_key key, const void *value)
int rte_thread_set_affinity(rte_cpuset_t *cpusetp)
rte_thread_t rte_thread_self(void)
int rte_thread_attr_set_affinity(rte_thread_attr_t *thread_attr, rte_cpuset_t *cpuset)
enum rte_thread_priority priority
Definition: rte_thread.h:69
rte_cpuset_t cpuset
Definition: rte_thread.h:71
uintptr_t opaque_id
Definition: rte_thread.h:40