FD.io VPP  v16.06
Vector Packet Processing
smp.h File Reference
+ Include dependency graph for smp.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  clib_smp_per_cpu_main_t
 
struct  clib_smp_main_t
 
union  clib_smp_lock_header_t
 
struct  clib_smp_lock_waiting_fifo_elt_t
 
struct  clib_smp_lock_t
 

Macros

#define clib_smp_compare_and_swap(addr, new, old)   __sync_val_compare_and_swap(addr,old,new)
 
#define clib_smp_swap(addr, new)   __sync_lock_test_and_set(addr,new)
 
#define clib_smp_atomic_add(addr, increment)   __sync_fetch_and_add(addr,increment)
 
#define clib_smp_pause()   do { asm volatile ("pause"); } while (0)
 
#define clib_exec_on_global_heap(body)
 

Typedefs

typedef u8 clib_smp_quarter_word_t
 
typedef u16 clib_smp_half_word_t
 

Enumerations

enum  clib_smp_lock_type_t { CLIB_SMP_LOCK_TYPE_READER, CLIB_SMP_LOCK_TYPE_WRITER, CLIB_SMP_LOCK_TYPE_SPIN }
 
enum  clib_smp_lock_wait_type_t { CLIB_SMP_LOCK_WAIT_EMPTY, CLIB_SMP_LOCK_WAIT_DONE, CLIB_SMP_LOCK_WAIT_READER, CLIB_SMP_LOCK_WAIT_WRITER }
 

Functions

always_inline voidclib_smp_vm_base_for_cpu (clib_smp_main_t *m, uword cpu)
 
always_inline voidclib_smp_stack_top_for_cpu (clib_smp_main_t *m, uword cpu)
 
always_inline uword os_get_cpu_number_inline (void)
 
always_inline void os_sched_yield (void)
 
always_inline uword clib_smp_lock_header_is_equal (clib_smp_lock_header_t h0, clib_smp_lock_header_t h1)
 
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)
 
void clib_smp_lock_init (clib_smp_lock_t **l)
 
void clib_smp_lock_free (clib_smp_lock_t **l)
 
void clib_smp_lock_slow_path (clib_smp_lock_t *l, uword my_cpu, clib_smp_lock_header_t h, clib_smp_lock_type_t type)
 
void clib_smp_unlock_slow_path (clib_smp_lock_t *l, uword my_cpu, clib_smp_lock_header_t h, clib_smp_lock_type_t type)
 
always_inline void clib_smp_lock_inline (clib_smp_lock_t *l, clib_smp_lock_type_t type)
 
always_inline void clib_smp_unlock_inline (clib_smp_lock_t *l, clib_smp_lock_type_t type)
 
always_inline void clib_smp_lock (clib_smp_lock_t *l)
 
always_inline void clib_smp_lock_for_writer (clib_smp_lock_t *l)
 
always_inline void clib_smp_lock_for_reader (clib_smp_lock_t *l)
 
always_inline void clib_smp_unlock (clib_smp_lock_t *l)
 
always_inline void clib_smp_unlock_for_writer (clib_smp_lock_t *l)
 
always_inline void clib_smp_unlock_for_reader (clib_smp_lock_t *l)
 
uword os_smp_bootstrap (uword n_cpus, void *bootstrap_function, uword bootstrap_function_arg)
 
void clib_smp_init (void)
 

Variables

clib_smp_main_t clib_smp_main
 

Macro Definition Documentation

#define clib_exec_on_global_heap (   body)
Value:
do { \
void * __clib_exec_on_global_heap_saved_heap; \
\
/* Switch to global (thread-safe) heap. */ \
__clib_exec_on_global_heap_saved_heap = clib_mem_set_heap (clib_smp_main.global_heap); \
\
/* Execute body. */ \
body; \
\
/* Switch back to previous heap. */ \
clib_mem_set_heap (__clib_exec_on_global_heap_saved_heap); \
} while (0)
static void(BVT(clib_bihash)*h, BVT(clib_bihash_value)*v)
void * global_heap
Definition: smp.h:70
always_inline void * clib_mem_set_heap(void *heap)
Definition: mem.h:190
clib_smp_main_t clib_smp_main
Definition: mem_mheap.c:46

Definition at line 325 of file smp.h.

#define clib_smp_atomic_add (   addr,
  increment 
)    __sync_fetch_and_add(addr,increment)

Definition at line 110 of file smp.h.

#define clib_smp_compare_and_swap (   addr,
  new,
  old 
)    __sync_val_compare_and_swap(addr,old,new)

Definition at line 108 of file smp.h.

#define clib_smp_pause ( )    do { asm volatile ("pause"); } while (0)

Definition at line 113 of file smp.h.

#define clib_smp_swap (   addr,
  new 
)    __sync_lock_test_and_set(addr,new)

Definition at line 109 of file smp.h.

Typedef Documentation

Definition at line 150 of file smp.h.

Definition at line 149 of file smp.h.

Enumeration Type Documentation

Enumerator
CLIB_SMP_LOCK_TYPE_READER 
CLIB_SMP_LOCK_TYPE_WRITER 
CLIB_SMP_LOCK_TYPE_SPIN 

Definition at line 132 of file smp.h.

Enumerator
CLIB_SMP_LOCK_WAIT_EMPTY 
CLIB_SMP_LOCK_WAIT_DONE 
CLIB_SMP_LOCK_WAIT_READER 
CLIB_SMP_LOCK_WAIT_WRITER 

Definition at line 138 of file smp.h.

Function Documentation

void clib_smp_init ( void  )

Definition at line 82 of file smp.c.

+ Here is the call graph for this function:

always_inline void clib_smp_lock ( clib_smp_lock_t l)

Definition at line 302 of file smp.h.

+ Here is the call graph for this function:

always_inline void clib_smp_lock_for_reader ( clib_smp_lock_t l)

Definition at line 310 of file smp.h.

+ Here is the call graph for this function:

always_inline void clib_smp_lock_for_writer ( clib_smp_lock_t l)

Definition at line 306 of file smp.h.

+ Here is the call graph for this function:

void clib_smp_lock_free ( clib_smp_lock_t **  l)

Definition at line 127 of file smp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

always_inline uword clib_smp_lock_header_is_equal ( clib_smp_lock_header_t  h0,
clib_smp_lock_header_t  h1 
)

Definition at line 177 of file smp.h.

+ Here is the caller graph for this function:

void clib_smp_lock_init ( clib_smp_lock_t **  l)

Definition at line 96 of file smp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

always_inline void clib_smp_lock_inline ( clib_smp_lock_t l,
clib_smp_lock_type_t  type 
)

Definition at line 211 of file smp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Definition at line 198 of file smp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void clib_smp_lock_slow_path ( clib_smp_lock_t l,
uword  my_cpu,
clib_smp_lock_header_t  h,
clib_smp_lock_type_t  type 
)

Definition at line 134 of file smp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

always_inline void* clib_smp_stack_top_for_cpu ( clib_smp_main_t m,
uword  cpu 
)

Definition at line 84 of file smp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

always_inline void clib_smp_unlock ( clib_smp_lock_t l)

Definition at line 314 of file smp.h.

+ Here is the call graph for this function:

always_inline void clib_smp_unlock_for_reader ( clib_smp_lock_t l)

Definition at line 322 of file smp.h.

+ Here is the call graph for this function:

always_inline void clib_smp_unlock_for_writer ( clib_smp_lock_t l)

Definition at line 318 of file smp.h.

+ Here is the call graph for this function:

always_inline void clib_smp_unlock_inline ( clib_smp_lock_t l,
clib_smp_lock_type_t  type 
)

Definition at line 256 of file smp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void clib_smp_unlock_slow_path ( clib_smp_lock_t l,
uword  my_cpu,
clib_smp_lock_header_t  h,
clib_smp_lock_type_t  type 
)

Definition at line 207 of file smp.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

always_inline void* clib_smp_vm_base_for_cpu ( clib_smp_main_t m,
uword  cpu 
)

Definition at line 78 of file smp.h.

+ Here is the caller graph for this function:

always_inline uword os_get_cpu_number_inline ( void  )

Definition at line 91 of file smp.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

always_inline void os_sched_yield ( void  )

Definition at line 124 of file smp.h.

uword os_smp_bootstrap ( uword  n_cpus,
void bootstrap_function,
uword  bootstrap_function_arg 
)

Variable Documentation

clib_smp_main_t clib_smp_main

Definition at line 46 of file mem_mheap.c.