51 uword vm_size, stack_size, mheap_flags;
89 clib_error (
"error allocating virtual memory");
91 for (cpu = 0; cpu < m->
n_cpus; cpu++)
99 uword i, n_bytes, n_fifo_elts;
113 n_bytes =
sizeof (l[0]) + n_fifo_elts *
sizeof (l->
waiting_fifo[0]);
118 memset (l, 0, n_bytes);
150 my_tail = my_tail >= n_fifo_elts ? my_tail - n_fifo_elts : my_tail;
217 uword head_index, must_wait_for_readers;
245 must_wait_for_readers =
250 if (! must_wait_for_readers)
266 h1.
waiting_fifo.head_index = head_index == n_fifo_elts ? 0 : head_index;
283 if (must_wait_for_readers)
sll srl srl sll sra u16x4 i
always_inline void * clib_smp_stack_top_for_cpu(clib_smp_main_t *m, uword cpu)
volatile clib_smp_lock_wait_type_t wait_type
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
always_inline void clib_mem_free(void *p)
always_inline void * clib_smp_vm_base_for_cpu(clib_smp_main_t *m, uword cpu)
#define clib_error(format, args...)
always_inline void * clib_mem_vm_alloc(uword size)
void clib_smp_lock_slow_path(clib_smp_lock_t *l, uword my_cpu, clib_smp_lock_header_t h0, clib_smp_lock_type_t type)
clib_smp_lock_waiting_fifo_elt_t waiting_fifo[0]
#define MHEAP_FLAG_THREAD_SAFE
#define vec_resize(V, N)
Resize a vector (no header, unspecified alignment) Add N elements to end of given vector V...
clib_smp_per_cpu_main_t * per_cpu_mains
void clib_smp_lock_free(clib_smp_lock_t **pl)
always_inline void * clib_mem_alloc_aligned(uword size, uword align)
clib_smp_main_t clib_smp_main
always_inline clib_smp_lock_header_t clib_smp_lock_set_header(clib_smp_lock_t *l, clib_smp_lock_header_t new_hdr, clib_smp_lock_header_t old)
clib_smp_lock_wait_type_t
uword os_get_cpu_number(void)
#define ASSERT_AND_PANIC(truth)
always_inline void * clib_mem_set_heap(void *heap)
always_inline uword clib_smp_lock_header_is_equal(clib_smp_lock_header_t h0, clib_smp_lock_header_t h1)
always_inline void clib_smp_unlock_inline(clib_smp_lock_t *l, clib_smp_lock_type_t type)
void * mheap_alloc_with_flags(void *memory, uword memory_size, uword flags)
static uword allocate_per_cpu_mheap(uword cpu)
u8 log2_n_per_cpu_vm_bytes
always_inline void clib_mem_vm_free(void *addr, uword size)
u8 log2_n_per_cpu_stack_bytes
#define MHEAP_FLAG_SMALL_OBJECT_CACHE
void clib_smp_lock_init(clib_smp_lock_t **pl)
uword clib_calljmp(uword(*func)(uword func_arg), uword func_arg, void *stack)
void clib_smp_free(clib_smp_main_t *m)
#define CLIB_CACHE_LINE_BYTES
void clib_smp_unlock_slow_path(clib_smp_lock_t *l, uword my_cpu, clib_smp_lock_header_t h0, clib_smp_lock_type_t type)