FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
sparse_vec.h File Reference
+ Include dependency graph for sparse_vec.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  sparse_vec_header_t
 

Macros

#define SPARSE_VEC_IS_RANGE   (1 << 0)
 
#define SPARSE_VEC_IS_VALID_RANGE   (1 << 1)
 
#define SPARSE_VEC_INVALID_INDEX   (0)
 
#define sparse_vec_free(v)   vec_free(v)
 
#define sparse_vec_elt_at_index(v, i)   vec_elt_at_index ((v), sparse_vec_index ((v), (i)))
 
#define sparse_vec_validate(v, i)
 

Functions

static sparse_vec_header_tsparse_vec_header (void *v)
 
static void * sparse_vec_new (uword elt_bytes, uword sparse_index_bits)
 
static uword sparse_vec_index_internal (void *v, uword sparse_index, uword maybe_range, u32 *insert)
 
static uword sparse_vec_index (void *v, uword sparse_index)
 
static void sparse_vec_index2 (void *v, u32 si0, u32 si1, u32 *i0_return, u32 *i1_return)
 

Macro Definition Documentation

◆ sparse_vec_elt_at_index

#define sparse_vec_elt_at_index (   v,
  i 
)    vec_elt_at_index ((v), sparse_vec_index ((v), (i)))

Definition at line 228 of file sparse_vec.h.

◆ sparse_vec_free

#define sparse_vec_free (   v)    vec_free(v)

Definition at line 226 of file sparse_vec.h.

◆ SPARSE_VEC_INVALID_INDEX

#define SPARSE_VEC_INVALID_INDEX   (0)

Definition at line 68 of file sparse_vec.h.

◆ SPARSE_VEC_IS_RANGE

#define SPARSE_VEC_IS_RANGE   (1 << 0)

Definition at line 54 of file sparse_vec.h.

◆ SPARSE_VEC_IS_VALID_RANGE

#define SPARSE_VEC_IS_VALID_RANGE   (1 << 1)

Definition at line 55 of file sparse_vec.h.

◆ sparse_vec_validate

#define sparse_vec_validate (   v,
  i 
)
Value:
({ \
uword _i; \
u32 _insert; \
if (! (v)) \
(v) = sparse_vec_new (sizeof ((v)[0]), BITS (u16)); \
\
_i = sparse_vec_index_internal ((v), (i), \
/* maybe range */ 0, \
/* insert? */ &_insert); \
if (_insert) \
vec_insert_ha ((v), 1, _i, \
/* header size */ sizeof (sparse_vec_header_t), \
/* align */ 0); \
\
/* Invalid index is 0. */ \
ASSERT (_i > 0); \
\
(v) + _i; \
})

Definition at line 231 of file sparse_vec.h.

Function Documentation

◆ sparse_vec_header()

static sparse_vec_header_t* sparse_vec_header ( void *  v)
inlinestatic

Definition at line 60 of file sparse_vec.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sparse_vec_index()

static uword sparse_vec_index ( void *  v,
uword  sparse_index 
)
inlinestatic

Definition at line 161 of file sparse_vec.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sparse_vec_index2()

static void sparse_vec_index2 ( void *  v,
u32  si0,
u32  si1,
u32 i0_return,
u32 i1_return 
)
inlinestatic

Definition at line 169 of file sparse_vec.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sparse_vec_index_internal()

static uword sparse_vec_index_internal ( void *  v,
uword  sparse_index,
uword  maybe_range,
u32 insert 
)
inlinestatic

Definition at line 101 of file sparse_vec.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sparse_vec_new()

static void* sparse_vec_new ( uword  elt_bytes,
uword  sparse_index_bits 
)
inlinestatic

Definition at line 71 of file sparse_vec.h.

+ Here is the caller graph for this function:
u16
unsigned short u16
Definition: types.h:57
sparse_vec_index_internal
static uword sparse_vec_index_internal(void *v, uword sparse_index, uword maybe_range, u32 *insert)
Definition: sparse_vec.h:101
BITS
#define BITS(x)
Definition: clib.h:69
if
if(node->flags &VLIB_NODE_FLAG_TRACE) vnet_interface_output_trace(vm
i
sll srl srl sll sra u16x4 i
Definition: vector_sse42.h:261
sparse_vec_header_t
Definition: sparse_vec.h:46
sparse_vec_new
static void * sparse_vec_new(uword elt_bytes, uword sparse_index_bits)
Definition: sparse_vec.h:71