79 #define LOAD_BALANCE_MAP_DBG(_pl, _fmt, _args...) \ 81 vlib_log_debug(load_balance_map_logger, \ 89 return (lbm - load_balance_map_pool);
96 u32 indent = va_arg(*ap,
u32);
103 s =
format(s,
"load-balance-map: index:%d buckets:%d", lbmi, n_buckets);
105 for (ii = 0; ii < n_buckets; ii++)
110 for (ii = 0; ii < n_buckets; ii++)
122 u32 old_lbm_hash, new_lbm_hash, hash;
133 return (new_lbm_hash);
205 p =
hash_get(load_balance_map_db, lbm);
292 u32 n_buckets, bucket, ii, jj;
312 tmp_buckets[jj++] = bucket++;
320 _vec_len(tmp_buckets) = jj;
345 for (bucket = 0; bucket < n_buckets; bucket++)
374 jj = (jj + 1) %
vec_len(tmp_buckets);
417 load_balance_map_logger =
428 pool_put(load_balance_map_pool, lbm);
515 p =
hash_get(lb_maps_by_path_index, path_index);
529 load_balance_map_db =
584 .path =
"show load-balance-map",
585 .short_help =
"show load-balance-map [<index>]",
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
int fib_path_is_resolved(fib_node_index_t path_index)
void load_balance_map_unlock(index_t lbmi)
#define vec_foreach_index(var, v)
Iterate over vector indices.
struct load_balance_map_path_t_ * lbm_paths
the vector of paths this MAP represents
index_t load_balance_map_add_or_lock(u32 n_buckets, u32 sum_of_weights, const load_balance_path_t *paths)
vlib_log_class_t load_balance_map_logger
the logger
#define hash_set(h, key, value)
fib_node_index_t path_index
The index of the FIB path.
static index_t load_balance_map_get_index(load_balance_map_t *lbm)
static uword load_balance_map_db_hash_key_2_index(uword key)
#define hash_unset(h, key)
void load_balance_map_path_state_change(fib_node_index_t path_index)
the state of a path has changed (it has no doubt gone down).
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
enum load_balance_map_path_flags_t_ load_balance_map_path_flags_t
static int load_balance_map_path_state_change_walk(fib_node_ptr_t *fptr, void *ctx)
clib_memset(h->entries, 0, sizeof(h->entries[0])*entries)
void fib_node_list_walk(fib_node_list_t list, fib_node_list_walk_cb_t fn, void *args)
Walk the list of node.
#define pool_len(p)
Number of elements in pool vector.
static load_balance_map_t * load_balance_map_get(index_t lbmi)
static index_t load_balance_map_db_find(load_balance_map_t *lbm)
fib_node_index_t fnp_index
node's index
void fib_node_list_remove(fib_node_list_t list, u32 sibling)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
void load_balance_map_module_init(void)
Make/add a new or lock an existing Load-balance map.
static uword load_balance_map_db_hash_key_is_index(uword key)
static uword load_balance_map_db_hash_key_sum(hash_t *h, uword key)
u32 lbm_sum_of_norm_weights
the sum of the normalised weights.
fib_node_index_t lbmp_index
Index of the path.
void fib_show_memory_usage(const char *name, u32 in_use_elts, u32 allocd_elts, size_t size_elt)
Show the memory usage for a type.
static uword load_balance_map_db_hash_key_from_index(uword index)
A representation of one pointer to another node.
load_balance_map_t * load_balance_map_pool
The global pool of LB maps.
#define pool_put(P, E)
Free an object E in pool P.
static clib_error_t * load_balance_map_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define LOAD_BALANCE_MAP_DBG(_pl, _fmt, _args...)
u32 fib_node_list_push_front(fib_node_list_t list, int owner_id, fib_node_type_t type, fib_node_index_t index)
Insert an element at the from of the list.
u8 * format_load_balance_map(u8 *s, va_list *ap)
struct load_balance_map_path_t_ load_balance_map_path_t
load_balance_map_path_flags_t lbmp_flags
The sate of the path.
void load_balance_map_lock(index_t lbmi)
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P with alignment A.
static load_balance_map_t * load_balance_map_db_get_from_hash_key(uword key)
load_balance_map_path_flags_t_
static uword load_balance_map_db_hash_key_equal(hash_t *h, uword key1, uword key2)
#define vec_free(V)
Free vector's memory (no header).
void load_balance_map_show_mem(void)
static uword * lb_maps_by_path_index
A hash-table of load-balance maps by path index.
#define hash_mix32(a0, b0, c0)
static void load_balance_map_db_insert(load_balance_map_t *lbm)
static load_balance_map_t * load_balance_map_alloc(const load_balance_path_t *paths)
u32 fib_node_index_t
A typedef of a node index.
static void load_balance_map_destroy(load_balance_map_t *lbm)
#define hash_create2(_elts, _user, _value_bytes,_key_sum, _key_equal,_format_pair, _format_pair_arg)
#define VLIB_CLI_COMMAND(x,...)
#define hash_create(elts, value_bytes)
#define uword_to_pointer(u, type)
fib_node_list_t fib_node_list_create(void)
Create a new node list.
u16 * lbm_buckets
The buckets of the map that provide the index to index translation.
static void load_balance_map_db_remove(load_balance_map_t *lbm)
static load_balance_map_t * load_balance_map_init(load_balance_map_t *lbm, u32 n_buckets, u32 sum_of_weights)
u32 lbmp_weight
the normalised wegiht of the path
#define FIB_NODE_INDEX_INVALID
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
u32 path_weight
weight for the path.
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
fib_node_index_t lbmp_sibling
Sibling Index in the list of all maps with this path index.
One path from an [EU]CMP set that the client wants to add to a load-balance object.
u32 fib_node_list_t
A list of FIB nodes.
static uword load_balance_map_hash(load_balance_map_t *lbm)
#define vec_foreach(var, vec)
Vector iterator.
#define CLIB_CACHE_LINE_BYTES
static uword * load_balance_map_db
A hash-table of load-balance maps by set of paths.
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
u32 lbm_locks
Number of locks.
static void load_balance_map_fill(load_balance_map_t *lbm)
from the paths that are usable, fill the Map.
static uword pool_elts(void *v)
Number of active elements in a pool.