DPDK
19.11.14
|
Go to the source code of this file.
Macros | |
#define | LCORE_ID_ANY UINT32_MAX |
#define | RTE_LCORE_FOREACH(i) |
#define | RTE_LCORE_FOREACH_SLAVE(i) |
Functions | |
RTE_DECLARE_PER_LCORE (unsigned, _lcore_id) | |
RTE_DECLARE_PER_LCORE (rte_cpuset_t, _cpuset) | |
enum rte_lcore_role_t | rte_eal_lcore_role (unsigned int lcore_id) |
static unsigned | rte_lcore_id (void) |
unsigned int | rte_get_master_lcore (void) |
unsigned int | rte_lcore_count (void) |
int | rte_lcore_index (int lcore_id) |
unsigned int | rte_socket_id (void) |
unsigned int | rte_socket_count (void) |
int | rte_socket_id_by_idx (unsigned int idx) |
unsigned int | rte_lcore_to_socket_id (unsigned int lcore_id) |
__rte_experimental int | rte_lcore_to_cpu_id (int lcore_id) |
__rte_experimental rte_cpuset_t | rte_lcore_cpuset (unsigned int lcore_id) |
int | rte_lcore_is_enabled (unsigned int lcore_id) |
unsigned int | rte_get_next_lcore (unsigned int i, int skip_master, int wrap) |
int | rte_thread_set_affinity (rte_cpuset_t *cpusetp) |
void | rte_thread_get_affinity (rte_cpuset_t *cpusetp) |
int | rte_thread_setname (pthread_t id, const char *name) |
int | rte_ctrl_thread_create (pthread_t *thread, const char *name, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg) |
int | rte_lcore_has_role (unsigned int lcore_id, enum rte_lcore_role_t role) |
API for lcore and socket manipulation
Definition in file rte_lcore.h.
#define LCORE_ID_ANY UINT32_MAX |
Any lcore.
Definition at line 23 of file rte_lcore.h.
#define RTE_LCORE_FOREACH | ( | i | ) |
Macro to browse all running lcores.
Definition at line 195 of file rte_lcore.h.
#define RTE_LCORE_FOREACH_SLAVE | ( | i | ) |
Macro to browse all running lcores except the master lcore.
Definition at line 203 of file rte_lcore.h.
RTE_DECLARE_PER_LCORE | ( | unsigned | , |
_lcore_id | |||
) |
Per thread "lcore id".
RTE_DECLARE_PER_LCORE | ( | rte_cpuset_t | , |
_cpuset | |||
) |
Per thread "cpuset".
enum rte_lcore_role_t rte_eal_lcore_role | ( | unsigned int | lcore_id | ) |
Get a lcore's role.
lcore_id | The identifier of the lcore, which MUST be between 0 and RTE_MAX_LCORE-1. |
|
inlinestatic |
Return the Application thread ID of the execution unit.
Note: in most cases the lcore id returned here will also correspond to the processor id of the CPU on which the thread is pinned, this will not be the case if the user has explicitly changed the thread to core affinities using –lcores EAL argument e.g. –lcores '(0-3)@10' to run threads with lcore IDs 0, 1, 2 and 3 on physical core 10..
Definition at line 51 of file rte_lcore.h.
unsigned int rte_get_master_lcore | ( | void | ) |
Get the id of the master lcore
unsigned int rte_lcore_count | ( | void | ) |
Return the number of execution units (lcores) on the system.
int rte_lcore_index | ( | int | lcore_id | ) |
Return the index of the lcore starting from zero.
When option -c or -l is given, the index corresponds to the order in the list. For example: -c 0x30, lcore 4 has index 0, and 5 has index 1. -l 22,18 lcore 22 has index 0, and 18 has index 1.
lcore_id | The targeted lcore, or -1 for the current one. |
unsigned int rte_socket_id | ( | void | ) |
Return the ID of the physical socket of the logical core we are running on.
unsigned int rte_socket_count | ( | void | ) |
Return number of physical sockets detected on the system.
Note that number of nodes may not be correspondent to their physical id's: for example, a system may report two socket id's, but the actual socket id's may be 0 and 8.
int rte_socket_id_by_idx | ( | unsigned int | idx | ) |
Return socket id with a particular index.
This will return socket id at a particular position in list of all detected physical socket id's. For example, on a machine with sockets [0, 8], passing 1 as a parameter will return 8.
idx | index of physical socket id to return |
unsigned int rte_lcore_to_socket_id | ( | unsigned int | lcore_id | ) |
Get the ID of the physical socket of the specified lcore
lcore_id | the targeted lcore, which MUST be between 0 and RTE_MAX_LCORE-1. |
__rte_experimental int rte_lcore_to_cpu_id | ( | int | lcore_id | ) |
Return the id of the lcore on a socket starting from zero.
lcore_id | The targeted lcore, or -1 for the current one. |
__rte_experimental rte_cpuset_t rte_lcore_cpuset | ( | unsigned int | lcore_id | ) |
Return the cpuset for a given lcore.
lcore_id | the targeted lcore, which MUST be between 0 and RTE_MAX_LCORE-1. |
int rte_lcore_is_enabled | ( | unsigned int | lcore_id | ) |
Test if an lcore is enabled.
lcore_id | The identifier of the lcore, which MUST be between 0 and RTE_MAX_LCORE-1. |
unsigned int rte_get_next_lcore | ( | unsigned int | i, |
int | skip_master, | ||
int | wrap | ||
) |
Get the next enabled lcore ID.
i | The current lcore (reference). |
skip_master | If true, do not return the ID of the master lcore. |
wrap | If true, go back to 0 when RTE_MAX_LCORE is reached; otherwise, return RTE_MAX_LCORE. |
int rte_thread_set_affinity | ( | rte_cpuset_t * | cpusetp | ) |
Set core affinity of the current thread. Support both EAL and non-EAL thread and update TLS.
cpusetp | Point to cpu_set_t for setting current thread affinity. |
void rte_thread_get_affinity | ( | rte_cpuset_t * | cpusetp | ) |
Get core affinity of the current thread.
cpusetp | Point to cpu_set_t for getting current thread cpu affinity. It presumes input is not NULL, otherwise it causes panic. |
int rte_thread_setname | ( | pthread_t | id, |
const char * | name | ||
) |
Set thread names.
id | Thread id. |
name | Thread name to set. |
int rte_ctrl_thread_create | ( | pthread_t * | thread, |
const char * | name, | ||
const pthread_attr_t * | attr, | ||
void *(*)(void *) | start_routine, | ||
void * | arg | ||
) |
Create a control thread.
Wrapper to pthread_create(), pthread_setname_np() and pthread_setaffinity_np(). The affinity of the new thread is based on the CPU affinity retrieved at the time rte_eal_init() was called, the dataplane and service lcores are then excluded.
thread | Filled with the thread id of the new created thread. |
name | The name of the control thread (max 16 characters including '\0'). |
attr | Attributes for the new thread. |
start_routine | Function to be executed by the new thread. |
arg | Argument passed to start_routine. |
int rte_lcore_has_role | ( | unsigned int | lcore_id, |
enum rte_lcore_role_t | role | ||
) |
Test if the core supplied has a specific role
lcore_id | The identifier of the lcore, which MUST be between 0 and RTE_MAX_LCORE-1. |
role | The role to be checked against. |