FD.io VPP  v18.04-17-g3a0d853
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)
 
#define foreach_vlib_main(body)
 
#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  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 }
 
enum  sched_policy_t { SCHED_POLICY_N }
 

Functions

void vlib_set_thread_name (char *name)
 
clib_error_tvlib_thread_init (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 (vlib_main_t *vm, vlib_frame_queue_main_t *fqm)
 
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)
 
void vlib_worker_thread_barrier_release (vlib_main_t *vm)
 
void vlib_worker_thread_node_refork (void)
 
static_always_inline uword vlib_get_thread_index (void)
 
static void vlib_smp_unsafe_warning (void)
 
void vlib_worker_thread_fork_fixup (vlib_fork_fixup_t which)
 
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 void vlib_put_frame_queue_elt (vlib_frame_queue_elt_t *hf)
 
static vlib_frame_queue_elt_tvlib_get_frame_queue_elt (u32 frame_queue_index, u32 index)
 
static vlib_frame_queue_tis_vlib_frame_queue_congested (u32 frame_queue_index, u32 index, u32 queue_hi_thresh, vlib_frame_queue_t **handoff_queue_by_worker_index)
 
static vlib_frame_queue_elt_tvlib_get_worker_handoff_queue_elt (u32 frame_queue_index, u32 vlib_worker_index, vlib_frame_queue_elt_t **handoff_queue_elt_by_worker_index)
 
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)
 

Variables

vlib_main_t ** vlib_mains
 
vlib_worker_thread_tvlib_worker_threads
 
vlib_thread_main_t vlib_thread_main
 
void * rpc_call_main_thread_cb_fn
 

Macro Definition Documentation

#define BARRIER_SYNC_DELAY   (0.030000)

Definition at line 200 of file threads.h.

#define BARRIER_SYNC_TIMEOUT   (600.1)

Definition at line 204 of file threads.h.

#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 267 of file threads.h.

#define foreach_vlib_main (   body)
Value:
do { \
vlib_main_t ** __vlib_mains = 0, *this_vlib_main; \
int ii; \
for (ii = 0; ii < vec_len (vlib_mains); ii++) \
{ \
this_vlib_main = vlib_mains[ii]; \
ASSERT (ii == 0 || \
this_vlib_main->parked_at_barrier == 1); \
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:520
for(i=1;i<=collision_buckets;i++)
struct vlib_main_t vlib_main_t
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:336
#define ASSERT(truth)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_main_t ** vlib_mains
Definition: buffer.c:303

Definition at line 244 of file threads.h.

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

Definition at line 78 of file threads.h.

#define VLIB_LOG2_THREAD_STACK_SIZE   (21)

Definition at line 81 of file threads.h.

#define VLIB_MAX_CPUS   256

Definition at line 71 of file threads.h.

#define VLIB_OFFSET_MASK   (~VLIB_CPU_MASK)

Definition at line 79 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:47
vlib_thread_registration_t * next
Definition: threads.h:292
vlib_thread_main_t vlib_thread_main
Definition: threads.c:36

Definition at line 355 of file threads.h.

#define VLIB_THREAD_STACK_SIZE   (1<<VLIB_LOG2_THREAD_STACK_SIZE)

Definition at line 82 of file threads.h.

#define vlib_worker_thread_barrier_sync (   X)    vlib_worker_thread_barrier_sync_int(X)

Definition at line 212 of file threads.h.

Typedef Documentation

typedef void( vlib_thread_function_t) (void *arg)

Definition at line 42 of file threads.h.

Enumeration Type Documentation

Enumerator
SCHED_POLICY_N 

Definition at line 274 of file threads.h.

Enumerator
VLIB_WORKER_THREAD_FORK_FIXUP_ILLEGAL 
VLIB_WORKER_THREAD_FORK_FIXUP_NEW_SW_IF_INDEX 

Definition at line 236 of file threads.h.

Enumerator
VLIB_FRAME_QUEUE_ELT_DISPATCH_FRAME 

Definition at line 84 of file threads.h.

Function Documentation

static vlib_frame_queue_t* is_vlib_frame_queue_congested ( u32  frame_queue_index,
u32  index,
u32  queue_hi_thresh,
vlib_frame_queue_t **  handoff_queue_by_worker_index 
)
inlinestatic

Definition at line 470 of file threads.h.

+ Here is the caller graph for this function:

void vlib_create_worker_threads ( vlib_main_t vm,
int  n,
void(*)(void *)  thread_function 
)
int vlib_frame_queue_dequeue ( vlib_main_t vm,
vlib_frame_queue_main_t fqm 
)

Definition at line 1592 of file threads.c.

+ Here is the call graph for this function:

+ 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:

u32 vlib_frame_queue_main_init ( u32  node_index,
u32  frame_queue_nelts 
)

Definition at line 1754 of file threads.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 vlib_get_current_worker_index ( )
inlinestatic

Definition at line 386 of file threads.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static vlib_frame_queue_elt_t* vlib_get_frame_queue_elt ( u32  frame_queue_index,
u32  index 
)
inlinestatic

Definition at line 439 of file threads.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static_always_inline uword vlib_get_thread_index ( void  )

Definition at line 221 of file threads.h.

static vlib_frame_queue_elt_t* vlib_get_worker_handoff_queue_elt ( u32  frame_queue_index,
u32  vlib_worker_index,
vlib_frame_queue_elt_t **  handoff_queue_elt_by_worker_index 
)
inlinestatic

Definition at line 502 of file threads.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 vlib_get_worker_index ( u32  thread_index)
inlinestatic

Definition at line 380 of file threads.h.

static u32 vlib_get_worker_thread_index ( u32  worker_index)
inlinestatic

Definition at line 374 of file threads.h.

static vlib_main_t* vlib_get_worker_vlib_main ( u32  worker_index)
inlinestatic

Definition at line 421 of file threads.h.

+ Here is the caller graph for this function:

static u32 vlib_num_workers ( )
inlinestatic

Definition at line 368 of file threads.h.

+ Here is the caller graph for this function:

void vlib_process_signal_event_mt_helper ( vlib_process_signal_event_mt_args_t args)

Definition at line 1793 of file threads.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vlib_put_frame_queue_elt ( vlib_frame_queue_elt_t hf)
inlinestatic

Definition at line 432 of file threads.h.

+ Here is the caller graph for this function:

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

Definition at line 1804 of file threads.c.

+ Here is the caller graph for this function:

void vlib_set_thread_name ( char *  name)

Definition at line 267 of file threads.c.

+ Here is the caller graph for this function:

static void vlib_smp_unsafe_warning ( void  )
inlinestatic

Definition at line 227 of file threads.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int vlib_thread_cb_register ( struct vlib_main_t vm,
vlib_thread_callbacks_t cb 
)

Definition at line 1780 of file threads.c.

+ 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 322 of file threads.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u8* vlib_thread_stack_init ( uword  thread_index)

Definition at line 575 of file main.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 392 of file threads.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void vlib_worker_thread_barrier_release ( vlib_main_t vm)

Definition at line 1497 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_int ( vlib_main_t vm)

Definition at line 1440 of file threads.c.

+ Here is the call graph for this function:

void vlib_worker_thread_fork_fixup ( vlib_fork_fixup_t  which)

Definition at line 1402 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 633 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_refork ( void  )

Definition at line 1072 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 1227 of file threads.c.

+ Here is the caller graph for this function:

Variable Documentation

void* rpc_call_main_thread_cb_fn

Definition at line 1801 of file threads.c.

vlib_main_t** vlib_mains

Definition at line 303 of file buffer.c.

vlib_thread_main_t vlib_thread_main

Definition at line 36 of file threads.c.

vlib_worker_thread_t* vlib_worker_threads

Definition at line 35 of file threads.c.