FD.io VPP  v16.12-rc0-308-g931be3a
Vector Packet Processing
load_balance.c File Reference
+ Include dependency graph for load_balance.c:

Go to the source code of this file.

Data Structures

struct  load_balance_trace_t_
 

Macros

#define LB_DBG(_p, _fmt, _args...)
 

Typedefs

typedef struct load_balance_trace_t_ load_balance_trace_t
 

Functions

f64 load_balance_get_multipath_tolerance (void)
 
static index_t load_balance_get_index (const load_balance_t *lb)
 
static dpo_id_tload_balance_get_buckets (load_balance_t *lb)
 
static load_balance_tload_balance_alloc_i (void)
 
static u8load_balance_format (index_t lbi, load_balance_format_flags_t flags, u32 indent, u8 *s)
 
u8format_load_balance (u8 *s, va_list *args)
 
static u8format_load_balance_dpo (u8 *s, va_list *args)
 
static load_balance_tload_balance_create_i (u32 num_buckets, dpo_proto_t lb_proto, flow_hash_config_t fhc)
 
index_t load_balance_create (u32 n_buckets, dpo_proto_t lb_proto, flow_hash_config_t fhc)
 
static void load_balance_set_bucket_i (load_balance_t *lb, u32 bucket, dpo_id_t *buckets, const dpo_id_t *next)
 
void load_balance_set_bucket (index_t lbi, u32 bucket, const dpo_id_t *next)
 
int load_balance_is_drop (const dpo_id_t *dpo)
 
void load_balance_set_urpf (index_t lbi, index_t urpf)
 
index_t load_balance_get_urpf (index_t lbi)
 
const dpo_id_tload_balance_get_bucket (index_t lbi, u32 bucket)
 
static int next_hop_sort_by_weight (load_balance_path_t *n1, load_balance_path_t *n2)
 
u32 ip_multipath_normalize_next_hops (load_balance_path_t *raw_next_hops, load_balance_path_t **normalized_next_hops, u32 *sum_weight_in, f64 multipath_next_hop_error_tolerance)
 
static load_balance_path_tload_balance_multipath_next_hop_fixup (load_balance_path_t *nhs, dpo_proto_t drop_proto)
 
static void load_balance_fill_buckets (load_balance_t *lb, load_balance_path_t *nhs, dpo_id_t *buckets, u32 n_buckets)
 
static void load_balance_set_n_buckets (load_balance_t *lb, u32 n_buckets)
 
void load_balance_multipath_update (const dpo_id_t *dpo, load_balance_path_t *raw_next_hops, load_balance_flags_t flags)
 
static void load_balance_lock (dpo_id_t *dpo)
 
static void load_balance_destroy (load_balance_t *lb)
 
static void load_balance_unlock (dpo_id_t *dpo)
 
static void load_balance_mem_show (void)
 
void load_balance_module_init (void)
 
static clib_error_tload_balance_show (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static u32 ip_flow_hash (void *data)
 
static u64 mac_to_u64 (u8 *m)
 
static u32 l2_flow_hash (vlib_buffer_t *b0)
 
static uword l2_load_balance (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
static u8format_load_balance_trace (u8 *s, va_list *args)
 

Variables

const f64 multipath_next_hop_error_tolerance = 0.1
 
load_balance_tload_balance_pool
 Pool of all DPOs. More...
 
load_balance_main_t load_balance_main
 The one instance of load-balance main. More...
 
static const dpo_vft_t lb_vft
 
static const char *const load_balance_ip4_nodes []
 The per-protocol VLIB graph nodes that are assigned to a load-balance object. More...
 
static const char *const load_balance_ip6_nodes []
 
static const char *const load_balance_mpls_nodes []
 
static const char *const load_balance_l2_nodes []
 
static const char *const *const load_balance_nodes [DPO_PROTO_NUM]
 
static vlib_cli_command_t load_balance_show_command
 (constructor) VLIB_CLI_COMMAND (load_balance_show_command) More...
 
vlib_node_registration_t l2_load_balance_node
 (constructor) VLIB_REGISTER_NODE (l2_load_balance_node) More...
 

Macro Definition Documentation

#define LB_DBG (   _p,
  _fmt,
  _args... 
)

Definition at line 43 of file load_balance.c.

Typedef Documentation

Function Documentation

u8* format_load_balance ( u8 s,
va_list *  args 
)

Definition at line 149 of file load_balance.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u8* format_load_balance_dpo ( u8 s,
va_list *  args 
)
static

Definition at line 157 of file load_balance.c.

+ Here is the call graph for this function:

static u8* format_load_balance_trace ( u8 s,
va_list *  args 
)
static

Definition at line 927 of file load_balance.c.

+ Here is the call graph for this function:

static u32 ip_flow_hash ( void *  data)
inlinestatic

Definition at line 815 of file load_balance.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 ip_multipath_normalize_next_hops ( load_balance_path_t raw_next_hops,
load_balance_path_t **  normalized_next_hops,
u32 sum_weight_in,
f64  multipath_next_hop_error_tolerance 
)

Definition at line 292 of file load_balance.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 l2_flow_hash ( vlib_buffer_t b0)
inlinestatic

Definition at line 832 of file load_balance.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uword l2_load_balance ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)
static

Definition at line 864 of file load_balance.c.

+ Here is the call graph for this function:

static load_balance_t* load_balance_alloc_i ( void  )
static

Definition at line 83 of file load_balance.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

index_t load_balance_create ( u32  n_buckets,
dpo_proto_t  lb_proto,
flow_hash_config_t  fhc 
)

Definition at line 192 of file load_balance.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static load_balance_t* load_balance_create_i ( u32  num_buckets,
dpo_proto_t  lb_proto,
flow_hash_config_t  fhc 
)
static

Definition at line 167 of file load_balance.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void load_balance_destroy ( load_balance_t lb)
static

Definition at line 669 of file load_balance.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void load_balance_fill_buckets ( load_balance_t lb,
load_balance_path_t nhs,
dpo_id_t buckets,
u32  n_buckets 
)
static

Definition at line 423 of file load_balance.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u8* load_balance_format ( index_t  lbi,
load_balance_format_flags_t  flags,
u32  indent,
u8 s 
)
static

Definition at line 105 of file load_balance.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const dpo_id_t* load_balance_get_bucket ( index_t  lbi,
u32  bucket 
)

Definition at line 271 of file load_balance.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static dpo_id_t* load_balance_get_buckets ( load_balance_t lb)
inlinestatic

Definition at line 70 of file load_balance.c.

+ Here is the caller graph for this function:

static index_t load_balance_get_index ( const load_balance_t lb)
inlinestatic

Definition at line 64 of file load_balance.c.

+ Here is the caller graph for this function:

f64 load_balance_get_multipath_tolerance ( void  )

Definition at line 58 of file load_balance.c.

index_t load_balance_get_urpf ( index_t  lbi)

Definition at line 261 of file load_balance.c.

+ Here is the call graph for this function:

int load_balance_is_drop ( const dpo_id_t dpo)

Definition at line 225 of file load_balance.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void load_balance_lock ( dpo_id_t dpo)
static

Definition at line 659 of file load_balance.c.

+ Here is the call graph for this function:

static void load_balance_mem_show ( void  )
static

Definition at line 709 of file load_balance.c.

+ Here is the call graph for this function:

void load_balance_module_init ( void  )

Definition at line 765 of file load_balance.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static load_balance_path_t* load_balance_multipath_next_hop_fixup ( load_balance_path_t nhs,
dpo_proto_t  drop_proto 
)
static

Definition at line 399 of file load_balance.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void load_balance_multipath_update ( const dpo_id_t dpo,
load_balance_path_t raw_next_hops,
load_balance_flags_t  flags 
)

Definition at line 456 of file load_balance.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void load_balance_set_bucket ( index_t  lbi,
u32  bucket,
const dpo_id_t next 
)

Definition at line 209 of file load_balance.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void load_balance_set_bucket_i ( load_balance_t lb,
u32  bucket,
dpo_id_t buckets,
const dpo_id_t next 
)
inlinestatic

Definition at line 200 of file load_balance.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void load_balance_set_n_buckets ( load_balance_t lb,
u32  n_buckets 
)
inlinestatic

Definition at line 448 of file load_balance.c.

+ Here is the caller graph for this function:

void load_balance_set_urpf ( index_t  lbi,
index_t  urpf 
)

Definition at line 242 of file load_balance.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* load_balance_show ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 773 of file load_balance.c.

+ Here is the call graph for this function:

static void load_balance_unlock ( dpo_id_t dpo)
static

Definition at line 694 of file load_balance.c.

+ Here is the call graph for this function:

static u64 mac_to_u64 ( u8 m)
inlinestatic

Definition at line 826 of file load_balance.c.

+ Here is the caller graph for this function:

static int next_hop_sort_by_weight ( load_balance_path_t n1,
load_balance_path_t n2 
)
static

Definition at line 282 of file load_balance.c.

+ Here is the caller graph for this function:

Variable Documentation

vlib_node_registration_t l2_load_balance_node
Initial value:
= {
.function = l2_load_balance,
.name = "l2-load-balance",
.vector_size = sizeof (u32),
.format_trace = format_load_balance_trace,
.n_next_nodes = 1,
.next_nodes = {
[0] = "error-drop",
},
}
static u8 * format_load_balance_trace(u8 *s, va_list *args)
Definition: load_balance.c:927
unsigned int u32
Definition: types.h:88
static uword l2_load_balance(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Definition: load_balance.c:864

(constructor) VLIB_REGISTER_NODE (l2_load_balance_node)

Definition at line 940 of file load_balance.c.

const dpo_vft_t lb_vft
static
Initial value:
= {
.dv_lock = load_balance_lock,
.dv_unlock = load_balance_unlock,
.dv_mem_show = load_balance_mem_show,
}
static u8 * format_load_balance_dpo(u8 *s, va_list *args)
Definition: load_balance.c:157
static void load_balance_mem_show(void)
Definition: load_balance.c:709
static void load_balance_lock(dpo_id_t *dpo)
Definition: load_balance.c:659
static void load_balance_unlock(dpo_id_t *dpo)
Definition: load_balance.c:694

Definition at line 718 of file load_balance.c.

const char* const load_balance_ip4_nodes[]
static
Initial value:
=
{
"ip4-load-balance",
}
#define NULL
Definition: clib.h:55

The per-protocol VLIB graph nodes that are assigned to a load-balance object.

this means that these graph nodes are ones from which a load-balance is the parent object in the DPO-graph.

We do not list all the load-balance nodes, such as the *-lookup. instead we are relying on the correct use of the .sibling_of field when setting up these sibling nodes.

Definition at line 736 of file load_balance.c.

const char* const load_balance_ip6_nodes[]
static
Initial value:
=
{
"ip6-load-balance",
}
#define NULL
Definition: clib.h:55

Definition at line 741 of file load_balance.c.

const char* const load_balance_l2_nodes[]
static
Initial value:
=
{
"l2-load-balance",
}
#define NULL
Definition: clib.h:55

Definition at line 751 of file load_balance.c.

load_balance_main_t load_balance_main

The one instance of load-balance main.

Definition at line 55 of file load_balance.c.

const char* const load_balance_mpls_nodes[]
static
Initial value:
=
{
"mpls-load-balance",
}
#define NULL
Definition: clib.h:55

Definition at line 746 of file load_balance.c.

const char* const* const load_balance_nodes[DPO_PROTO_NUM]
static
Initial value:
=
{
}
static const char *const load_balance_ip6_nodes[]
Definition: load_balance.c:741
static const char *const load_balance_mpls_nodes[]
Definition: load_balance.c:746
static const char *const load_balance_ip4_nodes[]
The per-protocol VLIB graph nodes that are assigned to a load-balance object.
Definition: load_balance.c:736
static const char *const load_balance_l2_nodes[]
Definition: load_balance.c:751

Definition at line 756 of file load_balance.c.

load_balance_t* load_balance_pool

Pool of all DPOs.

The encapsulation breakages are for fast DP access.

It's not static so the DP can have fast access

Definition at line 50 of file load_balance.c.

vlib_cli_command_t load_balance_show_command
static
Initial value:
= {
.path = "show load-balance",
.short_help = "show load-balance [<index>]",
.function = load_balance_show,
}
static clib_error_t * load_balance_show(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: load_balance.c:773

(constructor) VLIB_CLI_COMMAND (load_balance_show_command)

Definition at line 807 of file load_balance.c.

const f64 multipath_next_hop_error_tolerance = 0.1

Definition at line 28 of file load_balance.c.