FD.io VPP  v20.05-21-gb1500e9ff
Vector Packet Processing
fifo.h File Reference
+ Include dependency graph for fifo.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  clib_fifo_header_t
 

Macros

#define clib_fifo_len(v)   vec_len(v)
 
#define clib_fifo_end(v)   vec_end(v)
 
#define clib_fifo_resize(f, n_elts)   f = _clib_fifo_resize ((f), (n_elts), sizeof ((f)[0]))
 
#define clib_fifo_validate(f, n_elts)   f = _clib_fifo_validate ((f), (n_elts), sizeof (f[0]))
 
#define clib_fifo_advance_tail(f, n_elts)
 
#define clib_fifo_add1(f, e)
 
#define clib_fifo_add2(f, p)
 
#define clib_fifo_add(f, e, n)
 
#define clib_fifo_sub1(f, e)
 
#define clib_fifo_sub2(f, p)
 
#define clib_fifo_head(v)   ((v) + clib_fifo_head_index (v))
 
#define clib_fifo_tail(v)   ((v) + clib_fifo_tail_index (v))
 
#define clib_fifo_free(f)   vec_free_h((f),sizeof(clib_fifo_header_t))
 
#define clib_fifo_elt_at_index(v, i)   ((v) + clib_fifo_elt_index (v, (i)))
 
#define clib_fifo_foreach(v, f, body)
 

Functions

static clib_fifo_header_tclib_fifo_header (void *f)
 
static uword clib_fifo_elts (void *v)
 
static uword clib_fifo_free_elts (void *v)
 
static void clib_fifo_reset (void *v)
 
static uword clib_fifo_advance_head (void *v, uword n_elts)
 
static uword clib_fifo_head_index (void *v)
 
static uword clib_fifo_tail_index (void *v)
 
static uword clib_fifo_elt_index (void *v, uword i)
 

Macro Definition Documentation

◆ clib_fifo_add

#define clib_fifo_add (   f,
  e,
 
)
Value:
do { \
uword _i, _l; word _n0, _n1; \
\
_n0 = (n); \
(f) = _clib_fifo_advance_tail ((f), _n0, sizeof ((f)[0]), &_i); \
_l = clib_fifo_len (f); \
_n1 = _i + _n0 - _l; \
_n1 = _n1 < 0 ? 0 : _n1; \
_n0 -= _n1; \
clib_memcpy_fast ((f) + _i, (e), _n0 * sizeof ((f)[0])); \
if (_n1) \
clib_memcpy_fast ((f) + 0, (e) + _n0, _n1 * sizeof ((f)[0])); \
} while (0)
i64 word
Definition: types.h:111
#define clib_fifo_len(v)
Definition: fifo.h:61

Definition at line 208 of file fifo.h.

◆ clib_fifo_add1

#define clib_fifo_add1 (   f,
 
)
Value:
do { \
uword _i; \
(f) = _clib_fifo_advance_tail ((f), 1, sizeof ((f)[0]), &_i); \
(f)[_i] = (e); \
} while (0)

Definition at line 192 of file fifo.h.

◆ clib_fifo_add2

#define clib_fifo_add2 (   f,
 
)
Value:
do { \
uword _i; \
(f) = _clib_fifo_advance_tail ((f), 1, sizeof ((f)[0]), &_i); \
(p) = (f) + _i; \
} while (0)

Definition at line 200 of file fifo.h.

◆ clib_fifo_advance_tail

#define clib_fifo_advance_tail (   f,
  n_elts 
)
Value:
({ \
uword _i; \
(f) = _clib_fifo_advance_tail ((f), (n_elts), sizeof ((f)[0]), &_i); \
(f) + _i; \
})

Definition at line 161 of file fifo.h.

◆ clib_fifo_elt_at_index

#define clib_fifo_elt_at_index (   v,
  i 
)    ((v) + clib_fifo_elt_index (v, (i)))

Definition at line 277 of file fifo.h.

◆ clib_fifo_end

#define clib_fifo_end (   v)    vec_end(v)

Definition at line 63 of file fifo.h.

◆ clib_fifo_foreach

#define clib_fifo_foreach (   v,
  f,
  body 
)
Value:
do { \
uword _i, _l, _n; \
\
_l = clib_fifo_len (f); \
_n = clib_fifo_elts (f); \
while (_n > 0) \
{ \
(v) = (f) + _i; \
do { body; } while (0); \
_n--; \
_i++; \
_i = _i >= _l ? 0 : _i; \
} \
} while (0)
static uword clib_fifo_elts(void *v)
Definition: fifo.h:66
static uword clib_fifo_head_index(void *v)
Definition: fifo.h:241
#define clib_fifo_len(v)
Definition: fifo.h:61

Definition at line 279 of file fifo.h.

◆ clib_fifo_free

#define clib_fifo_free (   f)    vec_free_h((f),sizeof(clib_fifo_header_t))

Definition at line 257 of file fifo.h.

◆ clib_fifo_head

#define clib_fifo_head (   v)    ((v) + clib_fifo_head_index (v))

Definition at line 254 of file fifo.h.

◆ clib_fifo_len

#define clib_fifo_len (   v)    vec_len(v)

Definition at line 61 of file fifo.h.

◆ clib_fifo_resize

#define clib_fifo_resize (   f,
  n_elts 
)    f = _clib_fifo_resize ((f), (n_elts), sizeof ((f)[0]))

Definition at line 101 of file fifo.h.

◆ clib_fifo_sub1

#define clib_fifo_sub1 (   f,
 
)
Value:
do { \
uword _i; \
ASSERT (clib_fifo_elts (f) >= 1); \
_i = clib_fifo_advance_head ((f), 1); \
(e) = (f)[_i]; \
} while (0)
static uword clib_fifo_elts(void *v)
Definition: fifo.h:66
static uword clib_fifo_advance_head(void *v, uword n_elts)
Definition: fifo.h:169

Definition at line 224 of file fifo.h.

◆ clib_fifo_sub2

#define clib_fifo_sub2 (   f,
 
)
Value:
do { \
uword _i; \
ASSERT (clib_fifo_elts (f) >= 1); \
_i = clib_fifo_advance_head ((f), 1); \
(p) = (f) + _i; \
} while (0)
static uword clib_fifo_elts(void *v)
Definition: fifo.h:66
static uword clib_fifo_advance_head(void *v, uword n_elts)
Definition: fifo.h:169

Definition at line 232 of file fifo.h.

◆ clib_fifo_tail

#define clib_fifo_tail (   v)    ((v) + clib_fifo_tail_index (v))

Definition at line 255 of file fifo.h.

◆ clib_fifo_validate

#define clib_fifo_validate (   f,
  n_elts 
)    f = _clib_fifo_validate ((f), (n_elts), sizeof (f[0]))

Definition at line 112 of file fifo.h.

Function Documentation

◆ clib_fifo_advance_head()

static uword clib_fifo_advance_head ( void *  v,
uword  n_elts 
)
inlinestatic

Definition at line 169 of file fifo.h.

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

◆ clib_fifo_elt_index()

static uword clib_fifo_elt_index ( void *  v,
uword  i 
)
inlinestatic

Definition at line 260 of file fifo.h.

+ Here is the call graph for this function:

◆ clib_fifo_elts()

static uword clib_fifo_elts ( void *  v)
inlinestatic

Definition at line 66 of file fifo.h.

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

◆ clib_fifo_free_elts()

static uword clib_fifo_free_elts ( void *  v)
inlinestatic

Definition at line 82 of file fifo.h.

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

◆ clib_fifo_head_index()

static uword clib_fifo_head_index ( void *  v)
inlinestatic

Definition at line 241 of file fifo.h.

+ Here is the call graph for this function:

◆ clib_fifo_header()

static clib_fifo_header_t* clib_fifo_header ( void *  f)
inlinestatic

Definition at line 55 of file fifo.h.

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

◆ clib_fifo_reset()

static void clib_fifo_reset ( void *  v)
inlinestatic

Definition at line 88 of file fifo.h.

+ Here is the call graph for this function:

◆ clib_fifo_tail_index()

static uword clib_fifo_tail_index ( void *  v)
inlinestatic

Definition at line 248 of file fifo.h.

+ Here is the call graph for this function: