FD.io VPP  v16.06
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_efd_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   (20)
 
#define VLIB_THREAD_STACK_SIZE   (1<<VLIB_LOG2_THREAD_STACK_SIZE)
 
#define BARRIER_SYNC_DELAY   (0.030000)
 
#define BARRIER_SYNC_TIMEOUT   (600.1)
 
#define foreach_vlib_main(body)
 
#define VLIB_EFD_DISABLED   0
 
#define VLIB_EFD_DISCARD_ENABLED   (1 << 0)
 
#define VLIB_EFD_MONITOR_ENABLED   (1 << 1)
 
#define VLIB_EFD_DEF_WORKER_HI_THRESH_PCT   90
 
#define VLIB_REGISTER_THREAD(x, ...)
 

Typedefs

typedef voidvlib_thread_function_t) (void *arg)
 
typedef struct vlib_thread_registration_ vlib_thread_registration_t
 
typedef struct vlib_efd_t vlib_efd_t
 

Enumerations

enum  vlib_frame_queue_msg_type_t { VLIB_FRAME_QUEUE_ELT_DISPATCH_FRAME }
 
enum  vlib_fork_fixup_t { VLIB_WORKER_THREAD_FORK_FIXUP_ILLEGAL = 0, VLIB_WORKER_THREAD_FORK_FIXUP_NEW_SW_IF_INDEX }
 

Functions

void vlib_set_thread_name (char *name)
 
clib_error_tvlib_thread_init (vlib_main_t *vm)
 
vlib_worker_thread_tvlib_alloc_thread (vlib_main_t *vm)
 
int vlib_frame_queue_enqueue (vlib_main_t *vm, u32 node_runtime_index, u32 frame_queue_index, vlib_frame_t *frame, vlib_frame_queue_msg_type_t type)
 
int vlib_frame_queue_dequeue (int thread_id, vlib_main_t *vm, vlib_node_main_t *nm)
 
u64 dispatch_node (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_node_type_t type, vlib_node_state_t dispatch_state, vlib_frame_t *frame, u64 last_time_stamp)
 
u64 dispatch_pending_node (vlib_main_t *vm, vlib_pending_frame_t *p, u64 last_time_stamp)
 
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)
 
void vlib_worker_thread_barrier_sync (vlib_main_t *vm)
 
void vlib_worker_thread_barrier_release (vlib_main_t *vm)
 
always_inline void vlib_smp_unsafe_warning (void)
 
void vlib_worker_thread_fork_fixup (vlib_fork_fixup_t which)
 
static void vlib_worker_thread_barrier_check (void)
 

Variables

vlib_main_t ** vlib_mains
 
vlib_worker_thread_tvlib_worker_threads
 
vlib_frame_queue_t ** vlib_frame_queues
 
vlib_thread_main_t vlib_thread_main
 

Macro Definition Documentation

#define BARRIER_SYNC_DELAY   (0.030000)

Definition at line 173 of file threads.h.

#define BARRIER_SYNC_TIMEOUT   (600.1)

Definition at line 177 of file threads.h.

#define foreach_vlib_main (   body)
Value:
do { \
vlib_main_t ** __vlib_mains = 0, *this_vlib_main; \
int ii; \
\
if (vec_len (vlib_mains) == 0) \
vec_add1 (__vlib_mains, &vlib_global_main); \
else \
{ \
for (ii = 0; ii < vec_len (vlib_mains); ii++) \
{ \
this_vlib_main = vlib_mains[ii]; \
if (this_vlib_main) \
vec_add1 (__vlib_mains, this_vlib_main); \
} \
} \
\
for (ii = 0; ii < vec_len (__vlib_mains); ii++) \
{ \
this_vlib_main = __vlib_mains[ii]; \
/* body uses this_vlib_main... */ \
(body); \
} \
vec_free (__vlib_mains); \
} while (0);
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
Definition: vec.h:480
struct vlib_main_t vlib_main_t
vlib_main_t ** vlib_mains
Definition: threads.h:20
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:298
vlib_main_t vlib_global_main
Definition: main.c:1505
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)

Definition at line 212 of file threads.h.

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

Definition at line 61 of file threads.h.

#define VLIB_EFD_DEF_WORKER_HI_THRESH_PCT   90

Definition at line 244 of file threads.h.

#define VLIB_EFD_DISABLED   0

Definition at line 240 of file threads.h.

#define VLIB_EFD_DISCARD_ENABLED   (1 << 0)

Definition at line 241 of file threads.h.

#define VLIB_EFD_MONITOR_ENABLED   (1 << 1)

Definition at line 242 of file threads.h.

#define VLIB_LOG2_THREAD_STACK_SIZE   (20)

Definition at line 64 of file threads.h.

#define VLIB_MAX_CPUS   256

Definition at line 54 of file threads.h.

#define VLIB_OFFSET_MASK   (~VLIB_CPU_MASK)

Definition at line 62 of file threads.h.

#define VLIB_REGISTER_THREAD (   x,
  ... 
)
Value:
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; \
} \
struct vlib_thread_registration_ * next
Definition: threads.h:30
vlib_thread_main_t vlib_thread_main
Definition: threads.h:307
vlib_thread_registration_t * next
Definition: threads.h:258

Definition at line 309 of file threads.h.

#define VLIB_THREAD_STACK_SIZE   (1<<VLIB_LOG2_THREAD_STACK_SIZE)

Definition at line 65 of file threads.h.

Typedef Documentation

typedef struct vlib_efd_t vlib_efd_t
typedef void( vlib_thread_function_t) (void *arg)

Definition at line 26 of file threads.h.

Enumeration Type Documentation

Enumerator
VLIB_WORKER_THREAD_FORK_FIXUP_ILLEGAL 
VLIB_WORKER_THREAD_FORK_FIXUP_NEW_SW_IF_INDEX 

Definition at line 194 of file threads.h.

Enumerator
VLIB_FRAME_QUEUE_ELT_DISPATCH_FRAME 

Definition at line 67 of file threads.h.

Function Documentation

u64 dispatch_node ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_node_type_t  type,
vlib_node_state_t  dispatch_state,
vlib_frame_t frame,
u64  last_time_stamp 
)

Definition at line 918 of file main.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u64 dispatch_pending_node ( vlib_main_t vm,
vlib_pending_frame_t p,
u64  last_time_stamp 
)

Definition at line 1076 of file main.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

vlib_worker_thread_t* vlib_alloc_thread ( vlib_main_t vm)

Definition at line 269 of file threads.c.

void vlib_create_worker_threads ( vlib_main_t vm,
int  n,
void(*)(void *)  thread_function 
)
int vlib_frame_queue_dequeue ( int  thread_id,
vlib_main_t vm,
vlib_node_main_t nm 
)

+ Here is the caller graph for this function:

int vlib_frame_queue_enqueue ( vlib_main_t vm,
u32  node_runtime_index,
u32  frame_queue_index,
vlib_frame_t frame,
vlib_frame_queue_msg_type_t  type 
)

+ Here is the caller graph for this function:

void vlib_set_thread_name ( char *  name)

Definition at line 85 of file threads.c.

+ Here is the caller graph for this function:

always_inline void vlib_smp_unsafe_warning ( void  )

Definition at line 185 of file threads.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

clib_error_t* vlib_thread_init ( vlib_main_t vm)

Definition at line 132 of file threads.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vlib_worker_thread_barrier_check ( void  )
inlinestatic

Definition at line 201 of file threads.h.

+ Here is the caller graph for this function:

void vlib_worker_thread_barrier_release ( vlib_main_t vm)

Definition at line 1131 of file threads.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void vlib_worker_thread_barrier_sync ( vlib_main_t vm)

Definition at line 1100 of file threads.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void vlib_worker_thread_fork_fixup ( vlib_fork_fixup_t  which)

Definition at line 1078 of file threads.c.

+ Here is the call graph for this function:

void vlib_worker_thread_init ( vlib_worker_thread_t w)

Definition at line 439 of file threads.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void vlib_worker_thread_node_runtime_update ( void  )

Definition at line 796 of file threads.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

vlib_frame_queue_t** vlib_frame_queues

Definition at line 139 of file threads.h.

vlib_main_t** vlib_mains

Definition at line 20 of file threads.h.

vlib_thread_main_t vlib_thread_main

Definition at line 307 of file threads.h.

vlib_worker_thread_t* vlib_worker_threads

Definition at line 106 of file threads.h.