FD.io VPP  v17.07.01-10-g3be13f0
Vector Packet Processing
clib.h File Reference
+ Include dependency graph for clib.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CLIB_UNIX
 
#define NULL   ((void *) 0)
 
#define BITS(x)   (8*sizeof(x))
 
#define ARRAY_LEN(x)   (sizeof (x)/sizeof (x[0]))
 
#define STRUCT_OFFSET_OF(t, f)   ((uword) & _STRUCT_FIELD (t, f))
 
#define STRUCT_BIT_OFFSET_OF(t, f)   (BITS(u8) * (uword) & _STRUCT_FIELD (t, f))
 
#define STRUCT_SIZE_OF(t, f)   (sizeof (_STRUCT_FIELD (t, f)))
 
#define STRUCT_BITS_OF(t, f)   (BITS (_STRUCT_FIELD (t, f)))
 
#define STRUCT_ARRAY_LEN(t, f)   ARRAY_LEN (_STRUCT_FIELD (t, f))
 
#define STRUCT_MARK(mark)   u8 mark[0]
 
#define STRUCT_MARK_PTR(v, f)   &(v)->f
 
#define STRUCT_STRIDE_OF(t, f)
 
#define STRUCT_OFFSET_OF_VAR(v, f)   ((uword) (&(v)->f) - (uword) (v))
 
#define CLIB_PACKED(x)   x __attribute__ ((packed))
 
#define CLIB_UNUSED(x)   x __attribute__ ((unused))
 
#define never_inline   __attribute__ ((__noinline__))
 
#define always_inline   static inline
 
#define static_always_inline   static inline
 
#define u8   pad_from[(to) - (from)] u8 pad_##from[(to) - (from)]
 Padding. More...
 
#define PREDICT_FALSE(x)   __builtin_expect((x),0)
 
#define PREDICT_TRUE(x)   __builtin_expect((x),1)
 
#define CLIB_MEMORY_BARRIER()   __sync_synchronize ()
 
#define CLIB_MEMORY_STORE_BARRIER()   __builtin_ia32_sfence ()
 
#define INIT_FUNCTION(decl)
 
#define EXIT_FUNCTION(decl)
 
#define clib_max(x, y)
 
#define clib_min(x, y)
 
#define clib_abs(x)
 

Functions

static uword min_log2 (uword x)
 
static uword max_log2 (uword x)
 
static u64 min_log2_u64 (u64 x)
 
static uword pow2_mask (uword x)
 
static uword max_pow2 (uword x)
 
static uword is_pow2 (uword x)
 
static uword round_pow2 (uword x, uword pow2)
 
static u64 round_pow2_u64 (u64 x, u64 pow2)
 
static uword first_set (uword x)
 
static uword log2_first_set (uword x)
 
static f64 flt_round_down (f64 x)
 
static word flt_round_nearest (f64 x)
 
static f64 flt_round_to_multiple (f64 x, f64 f)
 
uword clib_backtrace (uword *callers, uword max_callers, uword n_frames_to_skip)
 

Macro Definition Documentation

#define always_inline   static inline

Definition at line 84 of file clib.h.

#define ARRAY_LEN (   x)    (sizeof (x)/sizeof (x[0]))

Definition at line 59 of file clib.h.

#define BITS (   x)    (8*sizeof(x))

Definition at line 58 of file clib.h.

#define clib_abs (   x)
Value:
({ \
__typeof__ (x) _x = (x); \
_x < 0 ? -_x : _x; \
})

Definition at line 339 of file clib.h.

#define clib_max (   x,
  y 
)
Value:
({ \
__typeof__ (x) _x = (x); \
__typeof__ (y) _y = (y); \
_x > _y ? _x : _y; \
})
add_epi add_epi sub_epi sub_epi adds_epu subs_epu i16x8 y
Definition: vector_sse2.h:293

Definition at line 325 of file clib.h.

#define CLIB_MEMORY_BARRIER ( )    __sync_synchronize ()

Definition at line 101 of file clib.h.

#define CLIB_MEMORY_STORE_BARRIER ( )    __builtin_ia32_sfence ()

Definition at line 104 of file clib.h.

#define clib_min (   x,
  y 
)
Value:
({ \
__typeof__ (x) _x = (x); \
__typeof__ (y) _y = (y); \
_x < _y ? _x : _y; \
})
add_epi add_epi sub_epi sub_epi adds_epu subs_epu i16x8 y
Definition: vector_sse2.h:293

Definition at line 332 of file clib.h.

#define CLIB_PACKED (   x)    x __attribute__ ((packed))

Definition at line 78 of file clib.h.

#define CLIB_UNIX

Definition at line 43 of file clib.h.

#define CLIB_UNUSED (   x )    x __attribute__ ((unused))

Definition at line 79 of file clib.h.

#define EXIT_FUNCTION (   decl)
Value:
decl __attribute ((destructor)); \
decl

Definition at line 115 of file clib.h.

#define INIT_FUNCTION (   decl)
Value:
decl __attribute ((constructor)); \
decl

Definition at line 110 of file clib.h.

#define never_inline   __attribute__ ((__noinline__))

Definition at line 81 of file clib.h.

#define NULL   ((void *) 0)

Definition at line 55 of file clib.h.

#define PREDICT_FALSE (   x)    __builtin_expect((x),0)

Definition at line 97 of file clib.h.

#define PREDICT_TRUE (   x)    __builtin_expect((x),1)

Definition at line 98 of file clib.h.

#define static_always_inline   static inline

Definition at line 85 of file clib.h.

#define STRUCT_ARRAY_LEN (   t,
 
)    ARRAY_LEN (_STRUCT_FIELD (t, f))

Definition at line 66 of file clib.h.

#define STRUCT_BIT_OFFSET_OF (   t,
 
)    (BITS(u8) * (uword) & _STRUCT_FIELD (t, f))

Definition at line 63 of file clib.h.

#define STRUCT_BITS_OF (   t,
 
)    (BITS (_STRUCT_FIELD (t, f)))

Definition at line 65 of file clib.h.

#define STRUCT_MARK (   mark)    u8 mark[0]

Definition at line 67 of file clib.h.

#define STRUCT_MARK_PTR (   v,
 
)    &(v)->f

Definition at line 68 of file clib.h.

#define STRUCT_OFFSET_OF (   t,
 
)    ((uword) & _STRUCT_FIELD (t, f))

Definition at line 62 of file clib.h.

#define STRUCT_OFFSET_OF_VAR (   v,
 
)    ((uword) (&(v)->f) - (uword) (v))

Definition at line 75 of file clib.h.

#define STRUCT_SIZE_OF (   t,
 
)    (sizeof (_STRUCT_FIELD (t, f)))

Definition at line 64 of file clib.h.

#define STRUCT_STRIDE_OF (   t,
 
)
Value:
( ((uword) & (((t *) 0)[1].f)) \
- ((uword) & (((t *) 0)[0].f)))
u64 uword
Definition: types.h:112

Definition at line 71 of file clib.h.

#define u8   pad_from[(to) - (from)] u8 pad_##from[(to) - (from)]

Padding.

Definition at line 94 of file clib.h.

Function Documentation

uword clib_backtrace ( uword callers,
uword  max_callers,
uword  n_frames_to_skip 
)

Definition at line 232 of file backtrace.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uword first_set ( uword  x)
inlinestatic

Definition at line 290 of file clib.h.

+ Here is the caller graph for this function:

static f64 flt_round_down ( f64  x)
inlinestatic

Definition at line 308 of file clib.h.

static word flt_round_nearest ( f64  x)
inlinestatic

Definition at line 314 of file clib.h.

+ Here is the caller graph for this function:

static f64 flt_round_to_multiple ( f64  x,
f64  f 
)
inlinestatic

Definition at line 320 of file clib.h.

+ Here is the call graph for this function:

static uword is_pow2 ( uword  x)
inlinestatic

Definition at line 272 of file clib.h.

+ Here is the caller graph for this function:

static uword log2_first_set ( uword  x)
inlinestatic

Definition at line 296 of file clib.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uword max_log2 ( uword  x)
inlinestatic

Definition at line 228 of file clib.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uword max_pow2 ( uword  x)
inlinestatic

Definition at line 263 of file clib.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uword min_log2 ( uword  x)
inlinestatic

Definition at line 189 of file clib.h.

+ Here is the caller graph for this function:

static u64 min_log2_u64 ( u64  x)
inlinestatic

Definition at line 237 of file clib.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uword pow2_mask ( uword  x)
inlinestatic

Definition at line 257 of file clib.h.

+ Here is the caller graph for this function:

static uword round_pow2 ( uword  x,
uword  pow2 
)
inlinestatic

Definition at line 278 of file clib.h.

+ Here is the caller graph for this function:

static u64 round_pow2_u64 ( u64  x,
u64  pow2 
)
inlinestatic

Definition at line 284 of file clib.h.

+ Here is the caller graph for this function: