FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
threads.h File Reference
+ Include dependency graph for threads.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  vlib_thread_registration_
 
struct  vlib_frame_queue_elt_t
 
struct  vlib_worker_thread_t
 
struct  vlib_frame_queue_t
 
struct  vlib_frame_queue_main_t
 
struct  vlib_process_signal_event_mt_args_t
 
struct  vlib_thread_callbacks_t
 
struct  vlib_thread_main_t
 

Macros

#define VLIB_MAX_CPUS   256
 
#define VLIB_CPU_MASK   (VLIB_MAX_CPUS - 1) /* 0x3f, max */
 
#define VLIB_OFFSET_MASK   (~VLIB_CPU_MASK)
 
#define VLIB_LOG2_THREAD_STACK_SIZE   (21)
 
#define VLIB_THREAD_STACK_SIZE   (1<<VLIB_LOG2_THREAD_STACK_SIZE)
 
#define BARRIER_SYNC_DELAY   (0.030000)
 
#define BARRIER_SYNC_TIMEOUT   (600.1)
 
#define vlib_worker_thread_barrier_sync(X)   {vlib_worker_thread_barrier_sync_int(X, __FUNCTION__);}
 
#define foreach_vlib_main()
 
#define foreach_sched_policy
 
#define VLIB_REGISTER_THREAD(x, ...)
 

Typedefs

typedef void() vlib_thread_function_t(void *arg)
 
typedef struct vlib_thread_registration_ vlib_thread_registration_t
 

Enumerations

enum  sched_policy_t { SCHED_POLICY_N }
 

Functions

void vlib_set_thread_name (char *name)
 
clib_error_tvlib_thread_init (vlib_main_t *vm)
 
void vlib_worker_thread_node_runtime_update (void)
 
void vlib_create_worker_threads (vlib_main_t *vm, int n, void(*thread_function)(void *))
 
void vlib_worker_thread_init (vlib_worker_thread_t *w)
 
u32 vlib_frame_queue_main_init (u32 node_index, u32 frame_queue_nelts)
 
void vlib_worker_thread_barrier_sync_int (vlib_main_t *vm, const char *func_name)
 
void vlib_worker_thread_barrier_release (vlib_main_t *vm)
 
u8 vlib_worker_thread_barrier_held (void)
 Return true if the wroker thread barrier is held. More...
 
void vlib_worker_thread_initial_barrier_sync_and_release (vlib_main_t *vm)
 
void vlib_worker_thread_node_refork (void)
 
void vlib_worker_wait_one_loop (void)
 Wait until each of the workers has been once around the track. More...
 
static_always_inline uword vlib_get_thread_index (void)
 
static void vlib_smp_unsafe_warning (void)
 
static u32 vlib_num_workers ()
 
static u32 vlib_get_worker_thread_index (u32 worker_index)
 
static u32 vlib_get_worker_index (u32 thread_index)
 
static u32 vlib_get_current_worker_index ()
 
static void vlib_worker_thread_barrier_check (void)
 
static vlib_main_tvlib_get_worker_vlib_main (u32 worker_index)
 
static u8 vlib_thread_is_main_w_barrier (void)
 
u8vlib_thread_stack_init (uword thread_index)
 
int vlib_thread_cb_register (struct vlib_main_t *vm, vlib_thread_callbacks_t *cb)
 
void vlib_process_signal_event_mt_helper (vlib_process_signal_event_mt_args_t *args)
 
void vlib_rpc_call_main_thread (void *function, u8 *args, u32 size)
 
void vlib_get_thread_core_numa (vlib_worker_thread_t *w, unsigned cpu_id)
 
vlib_thread_main_tvlib_get_thread_main_not_inline (void)
 

Variables

vlib_worker_thread_tvlib_worker_threads
 
vlib_thread_main_t vlib_thread_main
 
void * rpc_call_main_thread_cb_fn
 

Macro Definition Documentation

◆ BARRIER_SYNC_DELAY

#define BARRIER_SYNC_DELAY   (0.030000)

Definition at line 164 of file threads.h.

◆ BARRIER_SYNC_TIMEOUT

#define BARRIER_SYNC_TIMEOUT   (600.1)

Definition at line 168 of file threads.h.

◆ foreach_sched_policy

#define foreach_sched_policy
Value:
_(SCHED_OTHER, OTHER, "other") \
_(SCHED_BATCH, BATCH, "batch") \
_(SCHED_IDLE, IDLE, "idle") \
_(SCHED_FIFO, FIFO, "fifo") \
_(SCHED_RR, RR, "rr")

Definition at line 221 of file threads.h.

◆ foreach_vlib_main

#define foreach_vlib_main ( )
Value:
for (vlib_main_t *ii = 0, *this_vlib_main; \
__foreach_vlib_main_helper (ii, &this_vlib_main); ii++) \
if (this_vlib_main)

Definition at line 216 of file threads.h.

◆ VLIB_CPU_MASK

#define VLIB_CPU_MASK   (VLIB_MAX_CPUS - 1) /* 0x3f, max */

Definition at line 61 of file threads.h.

◆ VLIB_LOG2_THREAD_STACK_SIZE

#define VLIB_LOG2_THREAD_STACK_SIZE   (21)

Definition at line 64 of file threads.h.

◆ VLIB_MAX_CPUS

#define VLIB_MAX_CPUS   256

Definition at line 54 of file threads.h.

◆ VLIB_OFFSET_MASK

#define VLIB_OFFSET_MASK   (~VLIB_CPU_MASK)

Definition at line 62 of file threads.h.

◆ VLIB_REGISTER_THREAD

#define VLIB_REGISTER_THREAD (   x,
  ... 
)
Value:
__VA_ARGS__ vlib_thread_registration_t x; \
static void __vlib_add_thread_registration_##x (void) \
__attribute__((__constructor__)) ; \
static void __vlib_add_thread_registration_##x (void) \
{ \
vlib_thread_main_t * tm = &vlib_thread_main; \
x.next = tm->next; \
tm->next = &x; \
} \
static void __vlib_rm_thread_registration_##x (void) \
__attribute__((__destructor__)) ; \
static void __vlib_rm_thread_registration_##x (void) \
{ \
vlib_thread_main_t * tm = &vlib_thread_main; \
VLIB_REMOVE_FROM_LINKED_LIST (tm->next, &x, next); \
} \

Definition at line 313 of file threads.h.

◆ VLIB_THREAD_STACK_SIZE

#define VLIB_THREAD_STACK_SIZE   (1<<VLIB_LOG2_THREAD_STACK_SIZE)

Definition at line 65 of file threads.h.

◆ vlib_worker_thread_barrier_sync

#define vlib_worker_thread_barrier_sync (   X)    {vlib_worker_thread_barrier_sync_int(X, __FUNCTION__);}

Definition at line 173 of file threads.h.

Typedef Documentation

◆ vlib_thread_function_t

typedef void() vlib_thread_function_t(void *arg)

Definition at line 25 of file threads.h.

◆ vlib_thread_registration_t

Enumeration Type Documentation

◆ sched_policy_t

Enumerator
SCHED_POLICY_N 

Definition at line 228 of file threads.h.

Function Documentation

◆ vlib_create_worker_threads()

void vlib_create_worker_threads ( vlib_main_t vm,
int  n,
void(*)(void *)  thread_function 
)

◆ vlib_frame_queue_main_init()

u32 vlib_frame_queue_main_init ( u32  node_index,
u32  frame_queue_nelts 
)

Definition at line 1561 of file threads.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_get_current_worker_index()

static u32 vlib_get_current_worker_index ( )
inlinestatic

Definition at line 351 of file threads.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_get_thread_core_numa()

void vlib_get_thread_core_numa ( vlib_worker_thread_t w,
unsigned  cpu_id 
)

Definition at line 428 of file threads.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_get_thread_index()

static_always_inline uword vlib_get_thread_index ( void  )

Definition at line 187 of file threads.h.

◆ vlib_get_thread_main_not_inline()

vlib_thread_main_t* vlib_get_thread_main_not_inline ( void  )

Definition at line 1685 of file threads.c.

+ Here is the call graph for this function:

◆ vlib_get_worker_index()

static u32 vlib_get_worker_index ( u32  thread_index)
inlinestatic

Definition at line 345 of file threads.h.

+ Here is the caller graph for this function:

◆ vlib_get_worker_thread_index()

static u32 vlib_get_worker_thread_index ( u32  worker_index)
inlinestatic

Definition at line 339 of file threads.h.

+ Here is the caller graph for this function:

◆ vlib_get_worker_vlib_main()

static vlib_main_t* vlib_get_worker_vlib_main ( u32  worker_index)
inlinestatic

Definition at line 474 of file threads.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_num_workers()

static u32 vlib_num_workers ( )
inlinestatic

Definition at line 333 of file threads.h.

◆ vlib_process_signal_event_mt_helper()

void vlib_process_signal_event_mt_helper ( vlib_process_signal_event_mt_args_t args)

Definition at line 1605 of file threads.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_rpc_call_main_thread()

void vlib_rpc_call_main_thread ( void *  function,
u8 args,
u32  size 
)

Definition at line 1616 of file threads.c.

+ Here is the caller graph for this function:

◆ vlib_set_thread_name()

void vlib_set_thread_name ( char *  name)

Definition at line 145 of file threads.c.

+ Here is the caller graph for this function:

◆ vlib_smp_unsafe_warning()

static void vlib_smp_unsafe_warning ( void  )
inlinestatic

Definition at line 193 of file threads.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_thread_cb_register()

int vlib_thread_cb_register ( struct vlib_main_t vm,
vlib_thread_callbacks_t cb 
)

Definition at line 1592 of file threads.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_thread_init()

clib_error_t* vlib_thread_init ( vlib_main_t vm)

Definition at line 173 of file threads.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_thread_is_main_w_barrier()

static u8 vlib_thread_is_main_w_barrier ( void  )
inlinestatic

Definition at line 485 of file threads.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_thread_stack_init()

u8* vlib_thread_stack_init ( uword  thread_index)

Definition at line 678 of file main.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_worker_thread_barrier_check()

static void vlib_worker_thread_barrier_check ( void  )
inlinestatic

Definition at line 357 of file threads.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_worker_thread_barrier_held()

u8 vlib_worker_thread_barrier_held ( void  )

Return true if the wroker thread barrier is held.

Definition at line 1270 of file threads.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_worker_thread_barrier_release()

void vlib_worker_thread_barrier_release ( vlib_main_t vm)

Definition at line 1375 of file threads.c.

+ Here is the call graph for this function:

◆ vlib_worker_thread_barrier_sync_int()

void vlib_worker_thread_barrier_sync_int ( vlib_main_t vm,
const char *  func_name 
)

Definition at line 1279 of file threads.c.

+ Here is the call graph for this function:

◆ vlib_worker_thread_init()

void vlib_worker_thread_init ( vlib_worker_thread_t w)

Definition at line 369 of file threads.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlib_worker_thread_initial_barrier_sync_and_release()

void vlib_worker_thread_initial_barrier_sync_and_release ( vlib_main_t vm)

Definition at line 1242 of file threads.c.

+ Here is the call graph for this function:

◆ vlib_worker_thread_node_refork()

void vlib_worker_thread_node_refork ( void  )

Definition at line 884 of file threads.c.

+ Here is the call graph for this function:

◆ vlib_worker_thread_node_runtime_update()

void vlib_worker_thread_node_runtime_update ( void  )

Definition at line 1077 of file threads.c.

+ Here is the caller graph for this function:

◆ vlib_worker_wait_one_loop()

void vlib_worker_wait_one_loop ( void  )

Wait until each of the workers has been once around the track.

Definition at line 1488 of file threads.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ rpc_call_main_thread_cb_fn

void* rpc_call_main_thread_cb_fn

Definition at line 1613 of file threads.c.

◆ vlib_thread_main

vlib_thread_main_t vlib_thread_main

Definition at line 36 of file threads.c.

◆ vlib_worker_threads

vlib_worker_thread_t* vlib_worker_threads

Definition at line 35 of file threads.c.

vlib_thread_main_t::next
vlib_thread_registration_t * next
Definition: threads.h:246
next
u16 * next
Definition: nat44_ei_out2in.c:718
vlib_thread_registration_::next
struct vlib_thread_registration_ * next
Definition: threads.h:30
vlib_main_t
Definition: main.h:102
vlib_thread_main
vlib_thread_main_t vlib_thread_main
Definition: threads.c:36
vlib_thread_registration_
Definition: threads.h:27