1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2010-2014 Intel Corporation 3 */ 4 5 #ifndef EAL_THREAD_H 6 #define EAL_THREAD_H 7 8 #include <rte_lcore.h> 9 10 /** 11 * Basic loop of EAL thread, called for each worker thread by rte_eal_init(). 12 * 13 * @param arg 14 * The lcore_id (passed as an integer) of this worker thread. 15 */ 16 __rte_noreturn void *eal_thread_loop(void *arg); 17 18 /** 19 * Get the NUMA socket id from cpu id. 20 * This function is private to EAL. 21 * 22 * @param cpu_id 23 * The logical process id. 24 * @return 25 * socket_id or SOCKET_ID_ANY 26 */ 27 unsigned eal_cpu_socket_id(unsigned cpu_id); 28 29 /** 30 * Default buffer size to use with eal_thread_dump_affinity() 31 */ 32 #define RTE_CPU_AFFINITY_STR_LEN 256 33 34 /** 35 * Dump the cpuset as a human readable string. 36 * This function is private to EAL. 37 * 38 * Note: 39 * If the dump size is greater than the size of given buffer, 40 * the string will be truncated and with '\0' at the end. 41 * 42 * @param cpuset 43 * The CPU affinity object to dump. 44 * @param str 45 * The string buffer the cpuset will dump to. 46 * @param size 47 * The string buffer size. 48 * @return 49 * 0 for success, -1 if truncation happens. 50 */ 51 int 52 eal_thread_dump_affinity(rte_cpuset_t *cpuset, char *str, unsigned int size); 53 54 /** 55 * Dump the current thread cpuset. 56 * This is a wrapper on eal_thread_dump_affinity(). 57 */ 58 int 59 eal_thread_dump_current_affinity(char *str, unsigned int size); 60 61 /** 62 * Called by the main thread to wake up a worker in 'WAIT' state. 63 * This function blocks until the worker acknowledge it started processing a 64 * new command. 65 * This function is private to EAL. 66 * 67 * @param worker_id 68 * The lcore_id of a worker thread. 69 */ 70 void 71 eal_thread_wake_worker(unsigned int worker_id); 72 73 /** 74 * Called by a worker thread to sleep after entering 'WAIT' state. 75 * This function is private to EAL. 76 */ 77 void 78 eal_thread_wait_command(void); 79 80 /** 81 * Called by a worker thread to acknowledge new command after leaving 'WAIT' 82 * state. 83 * This function is private to EAL. 84 */ 85 void 86 eal_thread_ack_command(void); 87 88 #endif /* EAL_THREAD_H */ 89