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) 93 void (*thread_function)(
void *);
159 u64 last_time_stamp);
163 u64 last_time_stamp);
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) 190 fformat(stderr,
"%s: SMP unsafe warning...\n", __FUNCTION__);
212 #define foreach_vlib_main(body) \ 214 vlib_main_t ** __vlib_mains = 0, *this_vlib_main; \ 217 if (vec_len (vlib_mains) == 0) \ 218 vec_add1 (__vlib_mains, &vlib_global_main); \ 221 for (ii = 0; ii < vec_len (vlib_mains); ii++) \ 223 this_vlib_main = vlib_mains[ii]; \ 224 if (this_vlib_main) \ 225 vec_add1 (__vlib_mains, this_vlib_main); \ 229 for (ii = 0; ii < vec_len (__vlib_mains); ii++) \ 231 this_vlib_main = __vlib_mains[ii]; \ 235 vec_free (__vlib_mains); \ 240 #define VLIB_EFD_DISABLED 0 241 #define VLIB_EFD_DISCARD_ENABLED (1 << 0) 242 #define VLIB_EFD_MONITOR_ENABLED (1 << 1) 244 #define VLIB_EFD_DEF_WORKER_HI_THRESH_PCT 90 309 #define VLIB_REGISTER_THREAD(x,...) \ 310 __VA_ARGS__ vlib_thread_registration_t x; \ 311 static void __vlib_add_thread_registration_##x (void) \ 312 __attribute__((__constructor__)) ; \ 313 static void __vlib_add_thread_registration_##x (void) \ 315 vlib_thread_main_t * tm = &vlib_thread_main; \ 319 __VA_ARGS__ vlib_thread_registration_t x
static void(BVT(clib_bihash)*h, BVT(clib_bihash_value)*v)
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
void vlib_worker_thread_fork_fixup(vlib_fork_fixup_t which)
static void vlib_worker_thread_barrier_check(void)
void * thread_function_arg
struct vlib_thread_registration_ * next
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)
vlib_thread_main_t vlib_thread_main
vlib_thread_registration_t * next
#define clib_smp_atomic_add(addr, increment)
void vlib_worker_thread_init(vlib_worker_thread_t *w)
void vlib_worker_thread_barrier_release(vlib_main_t *vm)
u64 dispatch_pending_node(vlib_main_t *vm, vlib_pending_frame_t *p, u64 last_time_stamp)
vlib_frame_queue_elt_t * elts
uword os_get_cpu_number(void)
vlib_main_t ** vlib_mains
vlib_frame_queue_t ** vlib_frame_queues
u32 main_thread_is_io_node
clib_error_t * vlib_thread_init(vlib_main_t *vm)
vlib_worker_thread_t * vlib_alloc_thread(vlib_main_t *vm)
struct vlib_thread_registration_ vlib_thread_registration_t
vlib_worker_thread_t * worker_threads
volatile u32 * wait_at_barrier
vlib_worker_thread_t * vlib_worker_threads
struct vlib_efd_t vlib_efd_t
void vlib_set_thread_name(char *name)
uword * thread_registrations_by_name
void( vlib_thread_function_t)(void *arg)
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)
vlib_frame_queue_msg_type_t
void vlib_worker_thread_node_runtime_update(void)
int no_data_structure_clone
volatile u32 * workers_at_barrier
int vlib_frame_queue_dequeue(int thread_id, vlib_main_t *vm, vlib_node_main_t *nm)
void vlib_create_worker_threads(vlib_main_t *vm, int n, void(*thread_function)(void *))
uword * cpu_socket_bitmap
void vlib_worker_thread_barrier_sync(vlib_main_t *vm)
vlib_thread_registration_t ** registrations
always_inline void vlib_smp_unsafe_warning(void)
#define CLIB_CACHE_LINE_BYTES
vlib_thread_registration_t * registration