diff options
Diffstat (limited to 'src/vlib')
-rw-r--r-- | src/vlib/threads.c | 42 | ||||
-rw-r--r-- | src/vlib/threads.h | 17 |
2 files changed, 6 insertions, 53 deletions
diff --git a/src/vlib/threads.c b/src/vlib/threads.c index 760aa8b5776..f4d95c45059 100644 --- a/src/vlib/threads.c +++ b/src/vlib/threads.c @@ -175,6 +175,7 @@ vlib_thread_init (vlib_main_t * vm) vlib_thread_main_t *tm = &vlib_thread_main; vlib_worker_thread_t *w; vlib_thread_registration_t *tr; + cpu_set_t cpuset; u32 n_vlib_mains = 1; u32 first_index = 1; u32 i; @@ -223,17 +224,9 @@ vlib_thread_init (vlib_main_t * vm) tm->cpu_socket_bitmap = clib_bitmap_set (0, 0, 1); /* pin main thread to main_lcore */ - if (tm->cb.vlib_thread_set_lcore_cb) - { - tm->cb.vlib_thread_set_lcore_cb (0, tm->main_lcore); - } - else - { - cpu_set_t cpuset; - CPU_ZERO (&cpuset); - CPU_SET (tm->main_lcore, &cpuset); - pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset); - } + CPU_ZERO (&cpuset); + CPU_SET (tm->main_lcore, &cpuset); + pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset); /* Set up thread 0 */ vec_validate_aligned (vlib_worker_threads, 0, CLIB_CACHE_LINE_BYTES); @@ -463,6 +456,8 @@ vlib_launch_thread_int (void *fp, vlib_worker_thread_t * w, unsigned cpu_id) { clib_mem_main_t *mm = &clib_mem_main; vlib_thread_main_t *tm = &vlib_thread_main; + pthread_t worker; + cpu_set_t cpuset; void *(*fp_arg) (void *) = fp; void *numa_heap; @@ -489,12 +484,6 @@ vlib_launch_thread_int (void *fp, vlib_worker_thread_t * w, unsigned cpu_id) } } - if (tm->cb.vlib_launch_thread_cb && !w->registration->use_pthreads) - return tm->cb.vlib_launch_thread_cb (fp, (void *) w, cpu_id); - else - { - pthread_t worker; - cpu_set_t cpuset; CPU_ZERO (&cpuset); CPU_SET (cpu_id, &cpuset); @@ -505,7 +494,6 @@ vlib_launch_thread_int (void *fp, vlib_worker_thread_t * w, unsigned cpu_id) return clib_error_return_unix (0, "pthread_setaffinity_np"); return 0; - } } static clib_error_t * @@ -1520,7 +1508,6 @@ vlib_worker_thread_fn (void *arg) { vlib_global_main_t *vgm = vlib_get_global_main (); vlib_worker_thread_t *w = (vlib_worker_thread_t *) arg; - vlib_thread_main_t *tm = vlib_get_thread_main (); vlib_main_t *vm = vlib_get_main (); clib_error_t *e; @@ -1540,10 +1527,6 @@ vlib_worker_thread_fn (void *arg) if (e) clib_error_report (e); - /* Wait until the dpdk init sequence is complete */ - while (tm->extern_thread_mgmt && tm->worker_thread_release == 0) - vlib_worker_thread_barrier_check (); - vlib_worker_loop (vm); } @@ -1586,19 +1569,6 @@ vlib_frame_queue_main_init (u32 node_index, u32 frame_queue_nelts) return (fqm - tm->frame_queue_mains); } -int -vlib_thread_cb_register (struct vlib_main_t *vm, vlib_thread_callbacks_t * cb) -{ - vlib_thread_main_t *tm = vlib_get_thread_main (); - - if (tm->extern_thread_mgmt) - return -1; - - tm->cb.vlib_launch_thread_cb = cb->vlib_launch_thread_cb; - tm->extern_thread_mgmt = 1; - return 0; -} - void vlib_process_signal_event_mt_helper (vlib_process_signal_event_mt_args_t * args) diff --git a/src/vlib/threads.h b/src/vlib/threads.h index 91727bacc23..e406dde5b07 100644 --- a/src/vlib/threads.h +++ b/src/vlib/threads.h @@ -235,13 +235,6 @@ typedef enum typedef struct { - clib_error_t *(*vlib_launch_thread_cb) (void *fp, vlib_worker_thread_t * w, - unsigned cpu_id); - clib_error_t *(*vlib_thread_set_lcore_cb) (u32 thread, u16 cpu); -} vlib_thread_callbacks_t; - -typedef struct -{ /* Link list of registrations, built by constructors */ vlib_thread_registration_t *next; @@ -252,10 +245,6 @@ typedef struct vlib_worker_thread_t *worker_threads; - /* - * Launch all threads as pthreads, - * not eal_rte_launch (strict affinity) threads - */ int use_pthreads; /* Number of vlib_main / vnet_main clones */ @@ -297,10 +286,6 @@ typedef struct /* scheduling policy priority */ u32 sched_priority; - /* callbacks */ - vlib_thread_callbacks_t cb; - int extern_thread_mgmt; - /* NUMA-bound heap size */ uword numa_heap_size; @@ -490,8 +475,6 @@ vlib_thread_is_main_w_barrier (void) } u8 *vlib_thread_stack_init (uword thread_index); -int vlib_thread_cb_register (struct vlib_main_t *vm, - vlib_thread_callbacks_t * cb); extern void *rpc_call_main_thread_cb_fn; void |