FD.io VPP  v20.05-21-gb1500e9ff
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

◆ clib_mem_free_safe

#define clib_mem_free_safe (   p)
Value:
do { \
if (p) \
{ \
clib_mem_free (p); \
(p) = NULL; \
} \
} while (0)

Definition at line 86 of file test_vec.h.

◆ compute_mem_hash

#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); \
})
unsigned char u8
Definition: types.h:56
vec_header_t h
Definition: buffer.c:322
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:317
u64 uword
Definition: types.h:112

Definition at line 145 of file test_vec.h.

◆ fill_with_random_data

#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)
static u32 bounded_random_u32(u32 *seed, uword lo, uword hi)
Definition: test_vec.h:124
for(i=1;i<=collision_buckets;i++)
unsigned char u8
Definition: types.h:56
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:317

Definition at line 134 of file test_vec.h.

◆ log2_align_down

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

Definition at line 161 of file test_vec.h.

◆ log2_align_ptr_down

#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.

◆ log2_align_ptr_up

#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.

◆ log2_align_up

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

Definition at line 170 of file test_vec.h.

◆ MAX_LOG2_ALIGN

#define MAX_LOG2_ALIGN   6

Definition at line 185 of file test_vec.h.

◆ MAX_UNALIGN_OFFSET

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

Definition at line 186 of file test_vec.h.

◆ memory_snap

#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_dlmalloc.c:266

Definition at line 227 of file test_vec.h.

◆ VERBOSE1

#define VERBOSE1 (   fmt,
  args... 
)
Value:
do { \
if (g_verbose >= 1) \
fformat (stdout, fmt, ## args); \
} while (0)
uword g_verbose

Definition at line 68 of file test_vec.h.

◆ VERBOSE2

#define VERBOSE2 (   fmt,
  args... 
)
Value:
do { \
if (g_verbose >= 2) \
fformat (stdout, fmt, ## args); \
} while (0)
uword g_verbose

Definition at line 74 of file test_vec.h.

◆ VERBOSE3

#define VERBOSE3 (   fmt,
  args... 
)
Value:
do { \
if (g_verbose >= 3) \
fformat (stdout, fmt, ## args); \
} while (0)
uword g_verbose

Definition at line 80 of file test_vec.h.

Function Documentation

◆ alloc_aligned()

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:

◆ alloc_unaligned()

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:

◆ bounded_random_u32()

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:

◆ format_u32_binary()

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:

◆ my_random_u32()

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

◆ g_seed

u32 g_seed

◆ g_verbose

uword g_verbose