15 #ifndef included_vlib_threads_h 16 #define included_vlib_threads_h 54 #define VLIB_MAX_CPUS 256 57 #if VLIB_MAX_CPUS > CLIB_MAX_MHEAPS 58 #error Please increase number of per-cpu mheaps 61 #define VLIB_CPU_MASK (VLIB_MAX_CPUS - 1) 62 #define VLIB_OFFSET_MASK (~VLIB_CPU_MASK) 64 #define VLIB_LOG2_THREAD_STACK_SIZE (20) 65 #define VLIB_THREAD_STACK_SIZE (1<<VLIB_LOG2_THREAD_STACK_SIZE) 97 void (*thread_function) (
void *);
168 void (*thread_function) (
void *));
173 #define BARRIER_SYNC_DELAY (0.030000) 177 #define BARRIER_SYNC_TIMEOUT (600.1) 179 #define BARRIER_SYNC_TIMEOUT (1.0) 191 fformat (stderr,
"%s: SMP unsafe warning...\n", __FUNCTION__);
215 #define foreach_vlib_main(body) \ 217 vlib_main_t ** __vlib_mains = 0, *this_vlib_main; \ 220 if (vec_len (vlib_mains) == 0) \ 221 vec_add1 (__vlib_mains, &vlib_global_main); \ 224 for (ii = 0; ii < vec_len (vlib_mains); ii++) \ 226 this_vlib_main = vlib_mains[ii]; \ 227 if (this_vlib_main) \ 228 vec_add1 (__vlib_mains, this_vlib_main); \ 232 for (ii = 0; ii < vec_len (__vlib_mains); ii++) \ 234 this_vlib_main = __vlib_mains[ii]; \ 238 vec_free (__vlib_mains); \ 243 #define VLIB_EFD_DISABLED 0 244 #define VLIB_EFD_DISCARD_ENABLED (1 << 0) 245 #define VLIB_EFD_MONITOR_ENABLED (1 << 1) 247 #define VLIB_EFD_DEF_WORKER_HI_THRESH_PCT 90 321 #define VLIB_REGISTER_THREAD(x,...) \ 322 __VA_ARGS__ vlib_thread_registration_t x; \ 323 static void __vlib_add_thread_registration_##x (void) \ 324 __attribute__((__constructor__)) ; \ 325 static void __vlib_add_thread_registration_##x (void) \ 327 vlib_thread_main_t * tm = &vlib_thread_main; \ 331 __VA_ARGS__ vlib_thread_registration_t x
u8 pad[3]
log2 (size of the packing page block)
void vlib_worker_thread_init(vlib_worker_thread_t *w)
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)
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
vlib_worker_thread_t * vlib_alloc_thread(vlib_main_t *vm)
void vlib_set_thread_name(char *name)
void * thread_function_arg
frame_queue_trace_t * frame_queue_traces
vlib_worker_thread_t * vlib_worker_threads
struct vlib_thread_registration_ * next
static void vlib_smp_unsafe_warning(void)
u32 handoff_dispatch_node_index
static void vlib_worker_thread_barrier_check(void)
vlib_thread_registration_t * next
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)
#define clib_smp_atomic_add(addr, increment)
vlib_frame_queue_msg_type_t
vlib_frame_queue_elt_t * elts
vlib_frame_queue_t ** vlib_frame_queues
uword os_get_cpu_number(void)
void vlib_worker_thread_barrier_release(vlib_main_t *vm)
void vlib_worker_thread_node_runtime_update(void)
struct vlib_efd_t vlib_efd_t
void vlib_worker_thread_fork_fixup(vlib_fork_fixup_t which)
vlib_worker_thread_t * worker_threads
int vlib_frame_queue_dequeue(int thread_id, vlib_main_t *vm, vlib_node_main_t *nm)
volatile u32 * wait_at_barrier
frame_queue_nelt_counter_t * frame_queue_histogram
struct vlib_thread_registration_ vlib_thread_registration_t
uword * thread_registrations_by_name
clib_error_t * vlib_thread_init(vlib_main_t *vm)
int no_data_structure_clone
vlib_main_t ** vlib_mains
void vlib_create_worker_threads(vlib_main_t *vm, int n, void(*thread_function)(void *))
void vlib_worker_thread_barrier_sync(vlib_main_t *vm)
volatile u32 * workers_at_barrier
u64 dispatch_pending_node(vlib_main_t *vm, vlib_pending_frame_t *p, u64 last_time_stamp)
uword * cpu_socket_bitmap
void( vlib_thread_function_t)(void *arg)
vlib_thread_registration_t ** registrations
vlib_thread_main_t vlib_thread_main
#define CLIB_CACHE_LINE_BYTES
vlib_thread_registration_t * registration
volatile u32 worker_thread_release