FD.io VPP  v19.01.3-6-g70449b9b9
Vector Packet Processing
hash.h File Reference
+ Include dependency graph for hash.h:

Go to the source code of this file.

Data Structures

struct  hash_header
 
struct  hash_pair_t
 
struct  hash_pair_indirect_t
 
union  hash_pair_union_t
 
struct  hash_next_t
 

Macros

#define HASH_FLAG_NO_AUTO_GROW   (1 << 0)
 
#define HASH_FLAG_NO_AUTO_SHRINK   (1 << 1)
 
#define HASH_FLAG_HASH_NEXT_IN_PROGRESS   (1 << 2)
 
#define KEY_FUNC_NONE   (0) /*< sum = key */
 
#define KEY_FUNC_POINTER_UWORD   (1) /*< sum = *(uword *) key */
 
#define KEY_FUNC_POINTER_U32   (2) /*< sum = *(u32 *) key */
 
#define KEY_FUNC_STRING   (3) /*< sum = string_key_sum, etc. */
 
#define KEY_FUNC_MEM   (4) /*< sum = mem_key_sum */
 
#define LOG2_ALLOC_BITS   (5)
 
#define PAIR_BITS   (BITS (uword) - LOG2_ALLOC_BITS)
 
#define hash_set3(h, key, value, old_value)
 
#define hash_get(h, key)   _hash_get ((h), (uword) (key))
 
#define hash_get_pair(h, key)   _hash_get_pair ((h), (uword) (key))
 
#define hash_set(h, key, value)   hash_set3(h,key,value,0)
 
#define hash_set1(h, key)   (h) = _hash_set3(h,(uword) (key),0,0)
 
#define hash_unset(h, key)   ((h) = _hash_unset ((h), (uword) (key),0))
 
#define hash_unset3(h, key, old_value)   ((h) = _hash_unset ((h), (uword) (key), (void *) (old_value)))
 
#define hash_get_mem(h, key)   _hash_get ((h), pointer_to_uword (key))
 
#define hash_get_pair_mem(h, key)   _hash_get_pair ((h), pointer_to_uword (key))
 
#define hash_set_mem(h, key, value)   hash_set3 (h, pointer_to_uword (key), (value), 0)
 
#define hash_set1_mem(h, key)   hash_set3 ((h), pointer_to_uword (key), 0, 0)
 
#define hash_unset_mem(h, key)   ((h) = _hash_unset ((h), pointer_to_uword (key),0))
 
#define hash_free(h)   (h) = _hash_free ((h))
 
#define hash_foreach_pair(p, v, body)
 Iterate over hash pairs. More...
 
#define hash_foreach(key_var, value_var, h, body)
 
#define hash_foreach_mem(key_var, value_var, h, body)
 
#define hash_create2(_elts, _user, _value_bytes, _key_sum, _key_equal, _format_pair, _format_pair_arg)
 
#define hash_mix_step(a, b, c, s0, s1, s2)
 
#define hash_mix32_step_1(a, b, c)   hash_mix_step(a,b,c,13,8,13)
 
#define hash_mix32_step_2(a, b, c)   hash_mix_step(a,b,c,12,16,5)
 
#define hash_mix32_step_3(a, b, c)   hash_mix_step(a,b,c,3,10,15)
 
#define hash_mix64_step_1(a, b, c)   hash_mix_step(a,b,c,43,9,8)
 
#define hash_mix64_step_2(a, b, c)   hash_mix_step(a,b,c,38,23,5)
 
#define hash_mix64_step_3(a, b, c)   hash_mix_step(a,b,c,35,49,11)
 
#define hash_mix64_step_4(a, b, c)   hash_mix_step(a,b,c,12,18,22)
 
#define hash_mix64(a0, b0, c0)
 
#define hash_mix32(a0, b0, c0)
 
#define hash_v3_mix32(a, b, c)
 
#define hash_v3_finalize32(a, b, c)
 
#define hash_v3_mix32_step1(a, b, c)
 
#define hash_v3_mix32_step2(a, b, c)
 
#define hash_v3_mix32_step3(a, b, c)
 
#define hash_v3_finalize32_step1(a, b, c)
 
#define hash_v3_finalize32_step2(a, b, c)
 
#define hash_v3_finalize32_step3(a, b, c)
 
#define hash_v3_mix_step_1_u32x(a, b, c)
 
#define hash_v3_mix_step_2_u32x(a, b, c)
 
#define hash_v3_finalize_step_1_u32x(a, b, c)
 
#define hash_v3_finalize_step_2_u32x(a, b, c)
 
#define hash_v3_mix_u32x(a, b, c)
 
#define hash_v3_finalize_u32x(a, b, c)
 
#define hash_create_mem(elts, key_bytes, value_bytes)   hash_create2((elts),(key_bytes),(value_bytes),mem_key_sum,mem_key_equal,0,0)
 
#define hash_create_vec(elts, key_bytes, value_bytes)
 
#define hash_create_shmem(elts, key_bytes, value_bytes)
 
#define hash_create_string(elts, value_bytes)
 
#define hash_create(elts, value_bytes)
 
#define hash_create_uword(elts, value_bytes)
 
#define hash_create_u32(elts, value_bytes)
 

Typedefs

typedef uword() hash_key_sum_function_t(struct hash_header *, uword key)
 
typedef uword() hash_key_equal_function_t(struct hash_header *, uword key1, uword key2)
 
typedef struct hash_header hash_t
 

Functions

static uword hash_header_bytes (void *v)
 
static hash_thash_header (void *v)
 
static uword hash_elts (void *v)
 
static uword hash_capacity (void *v)
 
static uword hash_is_user (void *v, uword i)
 
static void hash_set_pair_format (void *v, format_function_t *format_pair, void *format_pair_arg)
 
static void hash_set_flags (void *v, uword flags)
 
static uword indirect_pair_get_log2_bytes (hash_pair_indirect_t *p)
 
static uword indirect_pair_get_len (hash_pair_indirect_t *p)
 
static void indirect_pair_set (hash_pair_indirect_t *p, uword log2_alloc, uword len)
 
void * hash_resize (void *old, uword new_size)
 
void * hash_dup (void *old)
 
uword hash_bytes (void *v)
 
static void hash_set_mem_alloc (uword **h, void *key, uword v)
 
static void hash_unset_mem_free (uword **h, void *key)
 
clib_error_thash_validate (void *v)
 
static uword hash_value_bytes (hash_t *h)
 
static uword hash_pair_log2_bytes (hash_t *h)
 
static uword hash_pair_bytes (hash_t *h)
 
static void * hash_forward1 (hash_t *h, void *v)
 
static void * hash_forward (hash_t *h, void *v, uword n)
 
hash_pair_thash_next (void *v, hash_next_t *hn)
 
static void hash_set_value_bytes (hash_t *h, uword value_bytes)
 
static uword hash32_rotate_left (u32 x, u32 i)
 
uword hash_memory (void *p, word n_bytes, uword state)
 
uword mem_key_sum (hash_t *h, uword key)
 
uword mem_key_equal (hash_t *h, uword key1, uword key2)
 
uword vec_key_sum (hash_t *h, uword key)
 
uword vec_key_equal (hash_t *h, uword key1, uword key2)
 
u8vec_key_format_pair (u8 *s, va_list *args)
 
uword string_key_sum (hash_t *h, uword key)
 
uword string_key_equal (hash_t *h, uword key1, uword key2)
 
u8string_key_format_pair (u8 *s, va_list *args)
 
u8format_hash (u8 *s, va_list *va)
 
int test_hash_main (unformat_input_t *input)
 

Variables

unformat_function_t unformat_hash_vec_string
 
unformat_function_t unformat_hash_string
 

Macro Definition Documentation

◆ hash_create

#define hash_create (   elts,
  value_bytes 
)
Value:
hash_create2((elts),0,(value_bytes), \
(hash_key_equal_function_t *) KEY_FUNC_NONE, \
0,0)
#define KEY_FUNC_NONE
Definition: hash.h:76
uword() hash_key_equal_function_t(struct hash_header *, uword key1, uword key2)
Definition: hash.h:50
uword() hash_key_sum_function_t(struct hash_header *, uword key)
Definition: hash.h:48
#define hash_create2(_elts, _user, _value_bytes, _key_sum, _key_equal, _format_pair, _format_pair_arg)
Definition: hash.h:494

Definition at line 696 of file hash.h.

◆ hash_create2

#define hash_create2 (   _elts,
  _user,
  _value_bytes,
  _key_sum,
  _key_equal,
  _format_pair,
  _format_pair_arg 
)
Value:
({ \
hash_t _h; \
clib_memset (&_h, 0, sizeof (_h)); \
_h.user = (_user); \
_h.key_sum = (hash_key_sum_function_t *) (_key_sum); \
_h.key_equal = (_key_equal); \
hash_set_value_bytes (&_h, (_value_bytes)); \
_h.format_pair = (format_function_t *) (_format_pair); \
_h.format_pair_arg = (_format_pair_arg); \
_hash_create ((_elts), &_h); \
})
u8 *() format_function_t(u8 *s, va_list *args)
Definition: format.h:48
uword() hash_key_sum_function_t(struct hash_header *, uword key)
Definition: hash.h:48

Definition at line 494 of file hash.h.

◆ hash_create_mem

#define hash_create_mem (   elts,
  key_bytes,
  value_bytes 
)    hash_create2((elts),(key_bytes),(value_bytes),mem_key_sum,mem_key_equal,0,0)

Definition at line 661 of file hash.h.

◆ hash_create_shmem

#define hash_create_shmem (   elts,
  key_bytes,
  value_bytes 
)
Value:
hash_create2((elts),(key_bytes),(value_bytes), \
(hash_key_equal_function_t *)KEY_FUNC_MEM, \
0, 0)
#define KEY_FUNC_MEM
Definition: hash.h:80
uword() hash_key_equal_function_t(struct hash_header *, uword key1, uword key2)
Definition: hash.h:50
uword() hash_key_sum_function_t(struct hash_header *, uword key)
Definition: hash.h:48
#define hash_create2(_elts, _user, _value_bytes, _key_sum, _key_equal, _format_pair, _format_pair_arg)
Definition: hash.h:494

Definition at line 684 of file hash.h.

◆ hash_create_string

#define hash_create_string (   elts,
  value_bytes 
)
Value:
hash_create2((elts),0,(value_bytes), \
(hash_key_equal_function_t *)KEY_FUNC_STRING, \
0, 0)
#define KEY_FUNC_STRING
Definition: hash.h:79
uword() hash_key_equal_function_t(struct hash_header *, uword key1, uword key2)
Definition: hash.h:50
uword() hash_key_sum_function_t(struct hash_header *, uword key)
Definition: hash.h:48
#define hash_create2(_elts, _user, _value_bytes, _key_sum, _key_equal, _format_pair, _format_pair_arg)
Definition: hash.h:494

Definition at line 690 of file hash.h.

◆ hash_create_u32

#define hash_create_u32 (   elts,
  value_bytes 
)
Value:
hash_create2((elts),0,(value_bytes), \
(hash_key_equal_function_t *) KEY_FUNC_POINTER_U32, \
0,0)
#define KEY_FUNC_POINTER_U32
Definition: hash.h:78
uword() hash_key_equal_function_t(struct hash_header *, uword key1, uword key2)
Definition: hash.h:50
uword() hash_key_sum_function_t(struct hash_header *, uword key)
Definition: hash.h:48
#define hash_create2(_elts, _user, _value_bytes, _key_sum, _key_equal, _format_pair, _format_pair_arg)
Definition: hash.h:494

Definition at line 708 of file hash.h.

◆ hash_create_uword

#define hash_create_uword (   elts,
  value_bytes 
)
Value:
hash_create2((elts),0,(value_bytes), \
(hash_key_equal_function_t *) KEY_FUNC_POINTER_UWORD, \
0,0)
#define KEY_FUNC_POINTER_UWORD
Definition: hash.h:77
uword() hash_key_equal_function_t(struct hash_header *, uword key1, uword key2)
Definition: hash.h:50
uword() hash_key_sum_function_t(struct hash_header *, uword key)
Definition: hash.h:48
#define hash_create2(_elts, _user, _value_bytes, _key_sum, _key_equal, _format_pair, _format_pair_arg)
Definition: hash.h:494

Definition at line 702 of file hash.h.

◆ hash_create_vec

#define hash_create_vec (   elts,
  key_bytes,
  value_bytes 
)
Value:
hash_create2((elts),(key_bytes),(value_bytes),\
uword vec_key_equal(hash_t *h, uword key1, uword key2)
Definition: hash.c:817
#define hash_create2(_elts, _user, _value_bytes, _key_sum, _key_equal, _format_pair, _format_pair_arg)
Definition: hash.h:494
u8 * vec_key_format_pair(u8 *s, va_list *args)
Definition: hash.c:827
uword vec_key_sum(hash_t *h, uword key)
Definition: hash.c:810

Definition at line 668 of file hash.h.

◆ HASH_FLAG_HASH_NEXT_IN_PROGRESS

#define HASH_FLAG_HASH_NEXT_IN_PROGRESS   (1 << 2)

Definition at line 66 of file hash.h.

◆ HASH_FLAG_NO_AUTO_GROW

#define HASH_FLAG_NO_AUTO_GROW   (1 << 0)

Definition at line 62 of file hash.h.

◆ HASH_FLAG_NO_AUTO_SHRINK

#define HASH_FLAG_NO_AUTO_SHRINK   (1 << 1)

Definition at line 64 of file hash.h.

◆ hash_foreach

#define hash_foreach (   key_var,
  value_var,
  h,
  body 
)
Value:
do { \
hash_pair_t * _r; \
hash_foreach_pair (_r, (h), { \
(key_var) = (__typeof__ (key_var)) _r->key; \
(value_var) = (__typeof__ (value_var)) _r->value[0]; \
do { body; } while (0); \
}); \
} while (0)

Definition at line 442 of file hash.h.

◆ hash_foreach_mem

#define hash_foreach_mem (   key_var,
  value_var,
  h,
  body 
)
Value:
do { \
hash_pair_t * _r; \
hash_foreach_pair (_r, (h), { \
(key_var) = (__typeof__ (key_var)) uword_to_pointer (_r->key, void *); \
(value_var) = (__typeof__ (value_var)) _r->value[0]; \
do { body; } while (0); \
}); \
} while (0)
#define uword_to_pointer(u, type)
Definition: types.h:136

Definition at line 461 of file hash.h.

◆ hash_foreach_pair

#define hash_foreach_pair (   p,
  v,
  body 
)

Iterate over hash pairs.

Parameters
pThe current (key,value) pair. This should be of type (hash_pair_t *).
vThe hash table to iterate.
bodyThe operation to perform on each (key,value) pair.

Executes the expression or code block body with each active hash pair.

Definition at line 373 of file hash.h.

◆ hash_free

#define hash_free (   h)    (h) = _hash_free ((h))

Definition at line 310 of file hash.h.

◆ hash_get

#define hash_get (   h,
  key 
)    _hash_get ((h), (uword) (key))

Definition at line 249 of file hash.h.

◆ hash_get_mem

#define hash_get_mem (   h,
  key 
)    _hash_get ((h), pointer_to_uword (key))

Definition at line 269 of file hash.h.

◆ hash_get_pair

#define hash_get_pair (   h,
  key 
)    _hash_get_pair ((h), (uword) (key))

Definition at line 252 of file hash.h.

◆ hash_get_pair_mem

#define hash_get_pair_mem (   h,
  key 
)    _hash_get_pair ((h), pointer_to_uword (key))

Definition at line 272 of file hash.h.

◆ hash_mix32

#define hash_mix32 (   a0,
  b0,
  c0 
)
Value:
do { \
hash_mix32_step_1 (a0, b0, c0); \
hash_mix32_step_2 (a0, b0, c0); \
hash_mix32_step_3 (a0, b0, c0); \
} while (0) \

Definition at line 539 of file hash.h.

◆ hash_mix32_step_1

#define hash_mix32_step_1 (   a,
  b,
  c 
)    hash_mix_step(a,b,c,13,8,13)

Definition at line 520 of file hash.h.

◆ hash_mix32_step_2

#define hash_mix32_step_2 (   a,
  b,
  c 
)    hash_mix_step(a,b,c,12,16,5)

Definition at line 521 of file hash.h.

◆ hash_mix32_step_3

#define hash_mix32_step_3 (   a,
  b,
  c 
)    hash_mix_step(a,b,c,3,10,15)

Definition at line 522 of file hash.h.

◆ hash_mix64

#define hash_mix64 (   a0,
  b0,
  c0 
)
Value:
do { \
hash_mix64_step_1 (a0, b0, c0); \
hash_mix64_step_2 (a0, b0, c0); \
hash_mix64_step_3 (a0, b0, c0); \
hash_mix64_step_4 (a0, b0, c0); \
} while (0) \

Definition at line 531 of file hash.h.

◆ hash_mix64_step_1

#define hash_mix64_step_1 (   a,
  b,
  c 
)    hash_mix_step(a,b,c,43,9,8)

Definition at line 524 of file hash.h.

◆ hash_mix64_step_2

#define hash_mix64_step_2 (   a,
  b,
  c 
)    hash_mix_step(a,b,c,38,23,5)

Definition at line 525 of file hash.h.

◆ hash_mix64_step_3

#define hash_mix64_step_3 (   a,
  b,
  c 
)    hash_mix_step(a,b,c,35,49,11)

Definition at line 526 of file hash.h.

◆ hash_mix64_step_4

#define hash_mix64_step_4 (   a,
  b,
  c 
)    hash_mix_step(a,b,c,12,18,22)

Definition at line 527 of file hash.h.

◆ hash_mix_step

#define hash_mix_step (   a,
  b,
  c,
  s0,
  s1,
  s2 
)
Value:
do { \
(a) -= (b) + (c); (a) ^= (c) >> (s0); \
(b) -= (c) + (a); (b) ^= (a) << (s1); \
(c) -= (a) + (b); (c) ^= (b) >> (s2); \
} while (0)
a
Definition: bitmap.h:538
svmdb_client_t * c

Definition at line 513 of file hash.h.

◆ hash_set

#define hash_set (   h,
  key,
  value 
)    hash_set3(h,key,value,0)

Definition at line 255 of file hash.h.

◆ hash_set1

#define hash_set1 (   h,
  key 
)    (h) = _hash_set3(h,(uword) (key),0,0)

Definition at line 258 of file hash.h.

◆ hash_set1_mem

#define hash_set1_mem (   h,
  key 
)    hash_set3 ((h), pointer_to_uword (key), 0, 0)

Definition at line 288 of file hash.h.

◆ hash_set3

#define hash_set3 (   h,
  key,
  value,
  old_value 
)
Value:
({ \
uword _v = (uword) (value); \
(h) = _hash_set3 ((h), (uword) (key), (void *) &_v, (old_value)); \
})
u64 uword
Definition: types.h:112

Definition at line 242 of file hash.h.

◆ hash_set_mem

#define hash_set_mem (   h,
  key,
  value 
)    hash_set3 (h, pointer_to_uword (key), (value), 0)

Definition at line 275 of file hash.h.

◆ hash_unset

#define hash_unset (   h,
  key 
)    ((h) = _hash_unset ((h), (uword) (key),0))

Definition at line 261 of file hash.h.

◆ hash_unset3

#define hash_unset3 (   h,
  key,
  old_value 
)    ((h) = _hash_unset ((h), (uword) (key), (void *) (old_value)))

Definition at line 264 of file hash.h.

◆ hash_unset_mem

#define hash_unset_mem (   h,
  key 
)    ((h) = _hash_unset ((h), pointer_to_uword (key),0))

Definition at line 291 of file hash.h.

◆ hash_v3_finalize32

#define hash_v3_finalize32 (   a,
  b,
  c 
)
Value:
do { \
(c) ^= (b); (c) -= hash32_rotate_left ((b), 14); \
(a) ^= (c); (a) -= hash32_rotate_left ((c), 11); \
(b) ^= (a); (b) -= hash32_rotate_left ((a), 25); \
(c) ^= (b); (c) -= hash32_rotate_left ((b), 16); \
(a) ^= (c); (a) -= hash32_rotate_left ((c), 4); \
(b) ^= (a); (b) -= hash32_rotate_left ((a), 14); \
(c) ^= (b); (c) -= hash32_rotate_left ((b), 24); \
} while (0)
a
Definition: bitmap.h:538
svmdb_client_t * c
static uword hash32_rotate_left(u32 x, u32 i)
Definition: hash.h:549

Definition at line 564 of file hash.h.

◆ hash_v3_finalize32_step1

#define hash_v3_finalize32_step1 (   a,
  b,
  c 
)
Value:
do { \
(c) ^= (b); (c) -= hash32_rotate_left ((b), 14); \
(a) ^= (c); (a) -= hash32_rotate_left ((c), 11); \
} while (0)
a
Definition: bitmap.h:538
svmdb_client_t * c
static uword hash32_rotate_left(u32 x, u32 i)
Definition: hash.h:549

Definition at line 595 of file hash.h.

◆ hash_v3_finalize32_step2

#define hash_v3_finalize32_step2 (   a,
  b,
  c 
)
Value:
do { \
(b) ^= (a); (b) -= hash32_rotate_left ((a), 25); \
(c) ^= (b); (c) -= hash32_rotate_left ((b), 16); \
} while (0)
a
Definition: bitmap.h:538
svmdb_client_t * c
static uword hash32_rotate_left(u32 x, u32 i)
Definition: hash.h:549

Definition at line 601 of file hash.h.

◆ hash_v3_finalize32_step3

#define hash_v3_finalize32_step3 (   a,
  b,
  c 
)
Value:
do { \
(a) ^= (c); (a) -= hash32_rotate_left ((c), 4); \
(b) ^= (a); (b) -= hash32_rotate_left ((a), 14); \
(c) ^= (b); (c) -= hash32_rotate_left ((b), 24); \
} while (0)
a
Definition: bitmap.h:538
svmdb_client_t * c
static uword hash32_rotate_left(u32 x, u32 i)
Definition: hash.h:549

Definition at line 607 of file hash.h.

◆ hash_v3_finalize_step_1_u32x

#define hash_v3_finalize_step_1_u32x (   a,
  b,
  c 
)
Value:
do { \
(c) ^= (b); (c) -= u32x_irotate_left ((b), 14); \
(a) ^= (c); (a) -= u32x_irotate_left ((c), 11); \
(b) ^= (a); (b) -= u32x_irotate_left ((a), 25); \
} while (0)
a
Definition: bitmap.h:538
svmdb_client_t * c

Definition at line 629 of file hash.h.

◆ hash_v3_finalize_step_2_u32x

#define hash_v3_finalize_step_2_u32x (   a,
  b,
  c 
)
Value:
do { \
(c) ^= (b); (c) -= u32x_irotate_left ((b), 16); \
(a) ^= (c); (a) -= u32x_irotate_left ((c), 4); \
(b) ^= (a); (b) -= u32x_irotate_left ((a), 14); \
(c) ^= (b); (c) -= u32x_irotate_left ((b), 24); \
} while (0)
a
Definition: bitmap.h:538
svmdb_client_t * c

Definition at line 636 of file hash.h.

◆ hash_v3_finalize_u32x

#define hash_v3_finalize_u32x (   a,
  b,
  c 
)
Value:
do { \
hash_v3_finalize_step_1_u32x(a,b,c); \
hash_v3_finalize_step_2_u32x(a,b,c); \
} while (0)
a
Definition: bitmap.h:538
svmdb_client_t * c

Definition at line 650 of file hash.h.

◆ hash_v3_mix32

#define hash_v3_mix32 (   a,
  b,
  c 
)
Value:
do { \
(a) -= (c); (a) ^= hash32_rotate_left ((c), 4); (c) += (b); \
(b) -= (a); (b) ^= hash32_rotate_left ((a), 6); (a) += (c); \
(c) -= (b); (c) ^= hash32_rotate_left ((b), 8); (b) += (a); \
(a) -= (c); (a) ^= hash32_rotate_left ((c),16); (c) += (b); \
(b) -= (a); (b) ^= hash32_rotate_left ((a),19); (a) += (c); \
(c) -= (b); (c) ^= hash32_rotate_left ((b), 4); (b) += (a); \
} while (0)
a
Definition: bitmap.h:538
svmdb_client_t * c
static uword hash32_rotate_left(u32 x, u32 i)
Definition: hash.h:549

Definition at line 554 of file hash.h.

◆ hash_v3_mix32_step1

#define hash_v3_mix32_step1 (   a,
  b,
  c 
)
Value:
do { \
(a) -= (c); (a) ^= hash32_rotate_left ((c), 4); (c) += (b); \
(b) -= (a); (b) ^= hash32_rotate_left ((a), 6); (a) += (c); \
} while (0)
a
Definition: bitmap.h:538
svmdb_client_t * c
static uword hash32_rotate_left(u32 x, u32 i)
Definition: hash.h:549

Definition at line 577 of file hash.h.

◆ hash_v3_mix32_step2

#define hash_v3_mix32_step2 (   a,
  b,
  c 
)
Value:
do { \
(c) -= (b); (c) ^= hash32_rotate_left ((b), 8); (b) += (a); \
(a) -= (c); (a) ^= hash32_rotate_left ((c),16); (c) += (b); \
} while (0)
a
Definition: bitmap.h:538
svmdb_client_t * c
static uword hash32_rotate_left(u32 x, u32 i)
Definition: hash.h:549

Definition at line 583 of file hash.h.

◆ hash_v3_mix32_step3

#define hash_v3_mix32_step3 (   a,
  b,
  c 
)
Value:
do { \
(b) -= (a); (b) ^= hash32_rotate_left ((a),19); (a) += (c); \
(c) -= (b); (c) ^= hash32_rotate_left ((b), 4); (b) += (a); \
} while (0)
a
Definition: bitmap.h:538
svmdb_client_t * c
static uword hash32_rotate_left(u32 x, u32 i)
Definition: hash.h:549

Definition at line 589 of file hash.h.

◆ hash_v3_mix_step_1_u32x

#define hash_v3_mix_step_1_u32x (   a,
  b,
  c 
)
Value:
do { \
(a) -= (c); (a) ^= u32x_irotate_left ((c), 4); (c) += (b); \
(b) -= (a); (b) ^= u32x_irotate_left ((a), 6); (a) += (c); \
(c) -= (b); (c) ^= u32x_irotate_left ((b), 8); (b) += (a); \
} while (0)
a
Definition: bitmap.h:538
svmdb_client_t * c

Definition at line 615 of file hash.h.

◆ hash_v3_mix_step_2_u32x

#define hash_v3_mix_step_2_u32x (   a,
  b,
  c 
)
Value:
do { \
(a) -= (c); (a) ^= u32x_irotate_left ((c),16); (c) += (b); \
(b) -= (a); (b) ^= u32x_irotate_left ((a),19); (a) += (c); \
(c) -= (b); (c) ^= u32x_irotate_left ((b), 4); (b) += (a); \
} while (0)
a
Definition: bitmap.h:538
svmdb_client_t * c

Definition at line 622 of file hash.h.

◆ hash_v3_mix_u32x

#define hash_v3_mix_u32x (   a,
  b,
  c 
)
Value:
do { \
hash_v3_mix_step_1_u32x(a,b,c); \
hash_v3_mix_step_2_u32x(a,b,c); \
} while (0)
a
Definition: bitmap.h:538
svmdb_client_t * c

Definition at line 644 of file hash.h.

◆ KEY_FUNC_MEM

#define KEY_FUNC_MEM   (4) /*< sum = mem_key_sum */

Definition at line 80 of file hash.h.

◆ KEY_FUNC_NONE

#define KEY_FUNC_NONE   (0) /*< sum = key */

Definition at line 76 of file hash.h.

◆ KEY_FUNC_POINTER_U32

#define KEY_FUNC_POINTER_U32   (2) /*< sum = *(u32 *) key */

Definition at line 78 of file hash.h.

◆ KEY_FUNC_POINTER_UWORD

#define KEY_FUNC_POINTER_UWORD   (1) /*< sum = *(uword *) key */

Definition at line 77 of file hash.h.

◆ KEY_FUNC_STRING

#define KEY_FUNC_STRING   (3) /*< sum = string_key_sum, etc. */

Definition at line 79 of file hash.h.

◆ LOG2_ALLOC_BITS

#define LOG2_ALLOC_BITS   (5)

Definition at line 191 of file hash.h.

◆ PAIR_BITS

#define PAIR_BITS   (BITS (uword) - LOG2_ALLOC_BITS)

Definition at line 192 of file hash.h.

Typedef Documentation

◆ hash_key_equal_function_t

typedef uword() hash_key_equal_function_t(struct hash_header *, uword key1, uword key2)

Definition at line 50 of file hash.h.

◆ hash_key_sum_function_t

typedef uword() hash_key_sum_function_t(struct hash_header *, uword key)

Definition at line 48 of file hash.h.

◆ hash_t

typedef struct hash_header hash_t

Function Documentation

◆ format_hash()

u8* format_hash ( u8 s,
va_list *  va 
)

Definition at line 968 of file hash.c.

+ Here is the call graph for this function:

◆ hash32_rotate_left()

static uword hash32_rotate_left ( u32  x,
u32  i 
)
inlinestatic

Definition at line 549 of file hash.h.

◆ hash_bytes()

uword hash_bytes ( void *  v)

Definition at line 943 of file hash.c.

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

◆ hash_capacity()

static uword hash_capacity ( void *  v)
inlinestatic

Definition at line 126 of file hash.h.

+ Here is the caller graph for this function:

◆ hash_dup()

void* hash_dup ( void *  old)

Definition at line 783 of file hash.c.

+ Here is the call graph for this function:

◆ hash_elts()

static uword hash_elts ( void *  v)
inlinestatic

Definition at line 118 of file hash.h.

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

◆ hash_forward()

static void* hash_forward ( hash_t h,
void *  v,
uword  n 
)
inlinestatic

Definition at line 351 of file hash.h.

+ Here is the caller graph for this function:

◆ hash_forward1()

static void* hash_forward1 ( hash_t h,
void *  v 
)
inlinestatic

Definition at line 344 of file hash.h.

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

◆ hash_header()

static hash_t* hash_header ( void *  v)
inlinestatic

Definition at line 111 of file hash.h.

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

◆ hash_header_bytes()

static uword hash_header_bytes ( void *  v)
inlinestatic

Definition at line 101 of file hash.h.

+ Here is the caller graph for this function:

◆ hash_is_user()

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

Definition at line 133 of file hash.h.

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

◆ hash_memory()

uword hash_memory ( void *  p,
word  n_bytes,
uword  state 
)

Definition at line 224 of file hash.c.

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

◆ hash_next()

hash_pair_t* hash_next ( void *  v,
hash_next_t hn 
)

Definition at line 606 of file hash.c.

+ Here is the call graph for this function:

◆ hash_pair_bytes()

static uword hash_pair_bytes ( hash_t h)
inlinestatic

Definition at line 337 of file hash.h.

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

◆ hash_pair_log2_bytes()

static uword hash_pair_log2_bytes ( hash_t h)
inlinestatic

Definition at line 324 of file hash.h.

+ Here is the caller graph for this function:

◆ hash_resize()

void* hash_resize ( void *  old,
uword  new_size 
)

Definition at line 777 of file hash.c.

+ Here is the call graph for this function:

◆ hash_set_flags()

static void hash_set_flags ( void *  v,
uword  flags 
)
inlinestatic

Definition at line 153 of file hash.h.

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

◆ hash_set_mem_alloc()

static void hash_set_mem_alloc ( uword **  h,
void *  key,
uword  v 
)
inlinestatic

Definition at line 279 of file hash.h.

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

◆ hash_set_pair_format()

static void hash_set_pair_format ( void *  v,
format_function_t format_pair,
void *  format_pair_arg 
)
inlinestatic

Definition at line 143 of file hash.h.

+ Here is the call graph for this function:

◆ hash_set_value_bytes()

static void hash_set_value_bytes ( hash_t h,
uword  value_bytes 
)
inlinestatic

Definition at line 486 of file hash.h.

+ Here is the call graph for this function:

◆ hash_unset_mem_free()

static void hash_unset_mem_free ( uword **  h,
void *  key 
)
inlinestatic

Definition at line 295 of file hash.h.

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

◆ hash_validate()

clib_error_t* hash_validate ( void *  v)

Definition at line 1063 of file hash.c.

+ Here is the call graph for this function:

◆ hash_value_bytes()

static uword hash_value_bytes ( hash_t h)
inlinestatic

Definition at line 316 of file hash.h.

+ Here is the caller graph for this function:

◆ indirect_pair_get_len()

static uword indirect_pair_get_len ( hash_pair_indirect_t p)
inlinestatic

Definition at line 203 of file hash.h.

+ Here is the caller graph for this function:

◆ indirect_pair_get_log2_bytes()

static uword indirect_pair_get_log2_bytes ( hash_pair_indirect_t p)
inlinestatic

Definition at line 196 of file hash.h.

+ Here is the caller graph for this function:

◆ indirect_pair_set()

static void indirect_pair_set ( hash_pair_indirect_t p,
uword  log2_alloc,
uword  len 
)
inlinestatic

Definition at line 213 of file hash.h.

+ Here is the caller graph for this function:

◆ mem_key_equal()

uword mem_key_equal ( hash_t h,
uword  key1,
uword  key2 
)

Definition at line 885 of file hash.c.

+ Here is the caller graph for this function:

◆ mem_key_sum()

uword mem_key_sum ( hash_t h,
uword  key 
)

Definition at line 878 of file hash.c.

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

◆ string_key_equal()

uword string_key_equal ( hash_t h,
uword  key1,
uword  key2 
)

Definition at line 900 of file hash.c.

+ Here is the caller graph for this function:

◆ string_key_format_pair()

u8* string_key_format_pair ( u8 s,
va_list *  args 
)

Definition at line 908 of file hash.c.

+ Here is the call graph for this function:

◆ string_key_sum()

uword string_key_sum ( hash_t h,
uword  key 
)

Definition at line 893 of file hash.c.

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

◆ test_hash_main()

int test_hash_main ( unformat_input_t input)

◆ vec_key_equal()

uword vec_key_equal ( hash_t h,
uword  key1,
uword  key2 
)

Definition at line 817 of file hash.c.

◆ vec_key_format_pair()

u8* vec_key_format_pair ( u8 s,
va_list *  args 
)

Definition at line 827 of file hash.c.

+ Here is the call graph for this function:

◆ vec_key_sum()

uword vec_key_sum ( hash_t h,
uword  key 
)

Definition at line 810 of file hash.c.

+ Here is the call graph for this function:

Variable Documentation

◆ unformat_hash_string

unformat_function_t unformat_hash_string

Definition at line 719 of file hash.h.

◆ unformat_hash_vec_string

unformat_function_t unformat_hash_vec_string

Definition at line 718 of file hash.h.