FD.io VPP  v17.07-30-g839fa73
Vector Packet Processing
test_vec.h File Reference
+ Include dependency graph for test_vec.h:

Go to the source code of this file.

Macros

#define VERBOSE1(fmt, args...)
 
#define VERBOSE2(fmt, args...)
 
#define VERBOSE3(fmt, args...)
 
#define clib_mem_free_safe(p)
 
#define fill_with_random_data(ptr, bytes, seed)
 
#define compute_mem_hash(hash, ptr, bytes)
 
#define log2_align_down(value, align)
 
#define log2_align_up(value, align)
 
#define log2_align_ptr_down(ptr, align)   uword_to_pointer (log2_align_down (pointer_to_uword (ptr), align), void *)
 
#define log2_align_ptr_up(ptr, align)   uword_to_pointer (log2_align_up (pointer_to_uword (ptr), align), void *)
 
#define MAX_LOG2_ALIGN   6
 
#define MAX_UNALIGN_OFFSET   ((1 << MAX_LOG2_ALIGN) - 1)
 
#define memory_snap()
 

Functions

static u8format_u32_binary (u8 *s, va_list *va)
 
static u32 my_random_u32 (u32 *seed_return)
 
static u32 bounded_random_u32 (u32 *seed, uword lo, uword hi)
 
static void * alloc_aligned (uword size, uword log2_align, void **ptr_to_free)
 
static void * alloc_unaligned (uword size, uword offset, void **ptr_to_free)
 

Variables

uword g_verbose
 
u32 g_seed
 

Macro Definition Documentation

#define clib_mem_free_safe (   p)
Value:
do { \
if (p) \
{ \
(p) = NULL; \
} \
} while (0)
#define NULL
Definition: clib.h:55
static void clib_mem_free(void *p)
Definition: mem.h:176

Definition at line 86 of file test_vec.h.

#define compute_mem_hash (   hash,
  ptr,
  bytes 
)
Value:
({ \
u8 * _v(p) = (u8 *) (ptr); \
uword _v(b) = (uword) (bytes); \
uword _v(i); \
uword _v(h) = (u8) (hash); \
\
if (_v(p) && _v(b) > 0) \
{ \
for (_v(i) = 0; _v(i) < _v(b); _v(i)++) \
_v(h) ^= _v(p)[_v(i)]; \
} \
\
_v(h); \
})
sll srl srl sll sra u16x4 i
Definition: vector_sse2.h:337
u64 uword
Definition: types.h:112
unsigned char u8
Definition: types.h:56

Definition at line 145 of file test_vec.h.

#define fill_with_random_data (   ptr,
  bytes,
  seed 
)
Value:
do { \
u8 * _v(p) = (u8 *) (ptr); \
uword _v(b) = (bytes); \
uword _v(i); \
\
for (_v(i) = 0; _v(i) < _v(b); _v(i)++) \
_v(p)[_v(i)] = (u8) bounded_random_u32 (&(seed), 0, 255); \
\
} while (0)
sll srl srl sll sra u16x4 i
Definition: vector_sse2.h:337
static u32 bounded_random_u32(u32 *seed, uword lo, uword hi)
Definition: test_vec.h:124
u64 uword
Definition: types.h:112
unsigned char u8
Definition: types.h:56

Definition at line 134 of file test_vec.h.

#define log2_align_down (   value,
  align 
)
Value:
({ \
uword _v = (uword) (value); \
uword _a = (uword) (align); \
uword _m = (1 << _a) - 1; \
\
_v = _v & ~_m; \
})
u64 uword
Definition: types.h:112

Definition at line 161 of file test_vec.h.

#define log2_align_ptr_down (   ptr,
  align 
)    uword_to_pointer (log2_align_down (pointer_to_uword (ptr), align), void *)

Definition at line 179 of file test_vec.h.

#define log2_align_ptr_up (   ptr,
  align 
)    uword_to_pointer (log2_align_up (pointer_to_uword (ptr), align), void *)

Definition at line 182 of file test_vec.h.

#define log2_align_up (   value,
  align 
)
Value:
({ \
uword _v = (uword) (value); \
uword _a = (uword) (align); \
uword _m = (1 << _a) - 1; \
\
_v = (_v + _m) & ~_m; \
})
u64 uword
Definition: types.h:112

Definition at line 170 of file test_vec.h.

#define MAX_LOG2_ALIGN   6

Definition at line 185 of file test_vec.h.

#define MAX_UNALIGN_OFFSET   ((1 << MAX_LOG2_ALIGN) - 1)

Definition at line 186 of file test_vec.h.

#define memory_snap ( )
Value:
do { \
clib_mem_usage_t _usage = { 0 }; \
clib_mem_usage (&_usage); \
fformat (stdout, "%U\n", format_clib_mem_usage, _usage, 0); \
} while (0)
u8 * format_clib_mem_usage(u8 *s, va_list *args)
Definition: mem_mheap.c:126
word fformat(FILE *f, char *fmt,...)
Definition: format.c:453
void clib_mem_usage(clib_mem_usage_t *usage)
Definition: mem_mheap.c:133

Definition at line 227 of file test_vec.h.

#define VERBOSE1 (   fmt,
  args... 
)
Value:
do { \
if (g_verbose >= 1) \
fformat (stdout, fmt, ## args); \
} while (0)
word fformat(FILE *f, char *fmt,...)
Definition: format.c:453
uword g_verbose

Definition at line 68 of file test_vec.h.

#define VERBOSE2 (   fmt,
  args... 
)
Value:
do { \
if (g_verbose >= 2) \
fformat (stdout, fmt, ## args); \
} while (0)
word fformat(FILE *f, char *fmt,...)
Definition: format.c:453
uword g_verbose

Definition at line 74 of file test_vec.h.

#define VERBOSE3 (   fmt,
  args... 
)
Value:
do { \
if (g_verbose >= 3) \
fformat (stdout, fmt, ## args); \
} while (0)
word fformat(FILE *f, char *fmt,...)
Definition: format.c:453
uword g_verbose

Definition at line 80 of file test_vec.h.

Function Documentation

static void* alloc_aligned ( uword  size,
uword  log2_align,
void **  ptr_to_free 
)
inlinestatic

Definition at line 191 of file test_vec.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* alloc_unaligned ( uword  size,
uword  offset,
void **  ptr_to_free 
)
inlinestatic

Definition at line 209 of file test_vec.h.

+ Here is the call graph for this function:

static u32 bounded_random_u32 ( u32 seed,
uword  lo,
uword  hi 
)
static

Definition at line 124 of file test_vec.h.

+ Here is the call graph for this function:

static u8* format_u32_binary ( u8 s,
va_list *  va 
)
inlinestatic

Definition at line 52 of file test_vec.h.

+ Here is the call graph for this function:

static u32 my_random_u32 ( u32 seed_return)
static

Definition at line 98 of file test_vec.h.

+ Here is the caller graph for this function:

Variable Documentation

u32 g_seed
uword g_verbose