FD.io VPP  v19.01.3-6-g70449b9b9
Vector Packet Processing
lbhash.h File Reference
+ Include dependency graph for lbhash.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  lb_hash_bucket_t
 
struct  lb_hash_t
 

Macros

#define LBHASH_ENTRY_PER_BUCKET   4
 vppinfra already includes tons of different hash tables. More...
 
#define LB_HASH_DO_NOT_USE_SSE_BUCKETS   0
 
#define lb_hash_nbuckets(h)   (((h)->buckets_mask) + 1)
 
#define lb_hash_size(h)   ((h)->buckets_mask + LBHASH_ENTRY_PER_BUCKET)
 
#define lb_hash_foreach_bucket(h, bucket)
 
#define lb_hash_foreach_entry(h, bucket, i)
 
#define lb_hash_foreach_valid_entry(h, bucket, i, now)
 

Functions

static_always_inline lb_hash_tlb_hash_alloc (u32 buckets, u32 timeout)
 
static_always_inline void lb_hash_free (lb_hash_t *h)
 
static_always_inline void lb_hash_prefetch_bucket (lb_hash_t *ht, u32 hash)
 
static_always_inline void lb_hash_get (lb_hash_t *ht, u32 hash, u32 vip, u32 time_now, u32 *available_index, u32 *found_value)
 
static_always_inline u32 lb_hash_available_value (lb_hash_t *h, u32 hash, u32 available_index)
 
static_always_inline void lb_hash_put (lb_hash_t *h, u32 hash, u32 value, u32 vip, u32 available_index, u32 time_now)
 
static_always_inline u32 lb_hash_elts (lb_hash_t *h, u32 time_now)
 

Macro Definition Documentation

◆ LB_HASH_DO_NOT_USE_SSE_BUCKETS

#define LB_HASH_DO_NOT_USE_SSE_BUCKETS   0

Definition at line 44 of file lbhash.h.

◆ lb_hash_foreach_bucket

#define lb_hash_foreach_bucket (   h,
  bucket 
)
Value:
for (bucket = (h)->buckets; \
bucket < (h)->buckets + lb_hash_nbuckets(h); \
bucket++)
#define lb_hash_nbuckets(h)
Definition: lbhash.h:64

Definition at line 67 of file lbhash.h.

◆ lb_hash_foreach_entry

#define lb_hash_foreach_entry (   h,
  bucket,
  i 
)
Value:
for (i = 0; i < LBHASH_ENTRY_PER_BUCKET; i++)
#define LBHASH_ENTRY_PER_BUCKET
vppinfra already includes tons of different hash tables.
Definition: lbhash.h:42
int i
#define lb_hash_foreach_bucket(h, bucket)
Definition: lbhash.h:67

Definition at line 72 of file lbhash.h.

◆ lb_hash_foreach_valid_entry

#define lb_hash_foreach_valid_entry (   h,
  bucket,
  i,
  now 
)
Value:
if (!clib_u32_loop_gt((now), bucket->timeout[i]))
#define clib_u32_loop_gt(a, b)
32 bits integer comparison for running values.
Definition: util.h:38
int i
#define lb_hash_foreach_entry(h, bucket, i)
Definition: lbhash.h:72

Definition at line 76 of file lbhash.h.

◆ lb_hash_nbuckets

#define lb_hash_nbuckets (   h)    (((h)->buckets_mask) + 1)

Definition at line 64 of file lbhash.h.

◆ lb_hash_size

#define lb_hash_size (   h)    ((h)->buckets_mask + LBHASH_ENTRY_PER_BUCKET)

Definition at line 65 of file lbhash.h.

◆ LBHASH_ENTRY_PER_BUCKET

#define LBHASH_ENTRY_PER_BUCKET   4

vppinfra already includes tons of different hash tables.

MagLev flow table is a bit different. It has to be very efficient for both writing and reading operations. But it does not need to be 100% reliable (write can fail). It also needs to recycle old entries in a lazy way.

This hash table is the most dummy hash table you can do. Fixed total size, fixed bucket size. Advantage is that it could be very efficient (maybe).

Definition at line 42 of file lbhash.h.

Function Documentation

◆ lb_hash_alloc()

static_always_inline lb_hash_t* lb_hash_alloc ( u32  buckets,
u32  timeout 
)

Definition at line 81 of file lbhash.h.

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

◆ lb_hash_available_value()

static_always_inline u32 lb_hash_available_value ( lb_hash_t h,
u32  hash,
u32  available_index 
)

Definition at line 168 of file lbhash.h.

+ Here is the caller graph for this function:

◆ lb_hash_elts()

static_always_inline u32 lb_hash_elts ( lb_hash_t h,
u32  time_now 
)

Definition at line 185 of file lbhash.h.

+ Here is the caller graph for this function:

◆ lb_hash_free()

static_always_inline void lb_hash_free ( lb_hash_t h)

Definition at line 99 of file lbhash.h.

+ Here is the caller graph for this function:

◆ lb_hash_get()

static_always_inline void lb_hash_get ( lb_hash_t ht,
u32  hash,
u32  vip,
u32  time_now,
u32 available_index,
u32 found_value 
)

Definition at line 113 of file lbhash.h.

+ Here is the caller graph for this function:

◆ lb_hash_prefetch_bucket()

static_always_inline void lb_hash_prefetch_bucket ( lb_hash_t ht,
u32  hash 
)

Definition at line 106 of file lbhash.h.

+ Here is the caller graph for this function:

◆ lb_hash_put()

static_always_inline void lb_hash_put ( lb_hash_t h,
u32  hash,
u32  value,
u32  vip,
u32  available_index,
u32  time_now 
)

Definition at line 174 of file lbhash.h.

+ Here is the caller graph for this function: