FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
load_balance.h File Reference
+ Include dependency graph for load_balance.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  load_balance_main_t_
 The load-balance object represents an ECMP choice. More...
 
struct  load_balance_path_t_
 One path from an [EU]CMP set that the client wants to add to a load-balance object. More...
 
struct  load_balance_t_
 The FIB DPO provieds;. More...
 

Macros

#define LB_NUM_INLINE_BUCKETS   4
 The number of buckets that a load-balance object can have and still fit in one cache-line. More...
 
#define LOAD_BALANCE_ATTR_NAMES
 
#define FOR_EACH_LOAD_BALANCE_ATTR(_attr)   for (_attr = 0; _attr <= LOAD_BALANCE_ATTR_STICKY; _attr++)
 
#define LB_HAS_INLINE_BUCKETS(_lb)   ((_lb)->lb_n_buckets <= LB_NUM_INLINE_BUCKETS)
 

Typedefs

typedef struct load_balance_main_t_ load_balance_main_t
 The load-balance object represents an ECMP choice. More...
 
typedef struct load_balance_path_t_ load_balance_path_t
 One path from an [EU]CMP set that the client wants to add to a load-balance object. More...
 
typedef enum load_balance_attr_t_ load_balance_attr_t
 Flags controlling load-balance creation and modification. More...
 
typedef enum load_balance_flags_t_ load_balance_flags_t
 
typedef struct load_balance_t_ load_balance_t
 The FIB DPO provieds;. More...
 
typedef enum load_balance_format_flags_t_ load_balance_format_flags_t
 Flags controlling load-balance formatting/display. More...
 

Enumerations

enum  load_balance_attr_t_ { LOAD_BALANCE_ATTR_USES_MAP = 0, LOAD_BALANCE_ATTR_STICKY = 1 }
 Flags controlling load-balance creation and modification. More...
 
enum  load_balance_flags_t_ { LOAD_BALANCE_FLAG_NONE = 0, LOAD_BALANCE_FLAG_USES_MAP = (1 << 0), LOAD_BALANCE_FLAG_STICKY = (1 << 1) }
 
enum  load_balance_format_flags_t_ { LOAD_BALANCE_FORMAT_NONE, LOAD_BALANCE_FORMAT_DETAIL = (1 << 0) }
 Flags controlling load-balance formatting/display. More...
 

Functions

 STATIC_ASSERT (sizeof(load_balance_t)<=CLIB_CACHE_LINE_BYTES, "A load_balance object size exceeds one cacheline")
 
index_t load_balance_create (u32 num_buckets, dpo_proto_t lb_proto, flow_hash_config_t fhc)
 
flow_hash_config_t load_balance_get_default_flow_hash (dpo_proto_t lb_proto)
 
void load_balance_multipath_update (const dpo_id_t *dpo, const load_balance_path_t *raw_next_hops, load_balance_flags_t flags)
 
void load_balance_set_bucket (index_t lbi, u32 bucket, const dpo_id_t *next)
 
void load_balance_set_urpf (index_t lbi, index_t urpf)
 
void load_balance_set_fib_entry_flags (index_t lbi, fib_entry_flag_t flags)
 
index_t load_balance_get_urpf (index_t lbi)
 
u8format_load_balance (u8 *s, va_list *args)
 
const dpo_id_tload_balance_get_bucket (index_t lbi, u32 bucket)
 
int load_balance_is_drop (const dpo_id_t *dpo)
 
u16 load_balance_n_buckets (index_t lbi)
 
f64 load_balance_get_multipath_tolerance (void)
 
static load_balance_tload_balance_get (index_t lbi)
 
static const dpo_id_tload_balance_get_bucket_i (const load_balance_t *lb, u32 bucket)
 
void load_balance_module_init (void)
 

Variables

load_balance_main_t load_balance_main
 The one instance of load-balance main. More...
 
load_balance_tload_balance_pool
 The encapsulation breakages are for fast DP access. More...
 

Macro Definition Documentation

◆ FOR_EACH_LOAD_BALANCE_ATTR

#define FOR_EACH_LOAD_BALANCE_ATTR (   _attr)    for (_attr = 0; _attr <= LOAD_BALANCE_ATTR_STICKY; _attr++)

Definition at line 92 of file load_balance.h.

◆ LB_HAS_INLINE_BUCKETS

#define LB_HAS_INLINE_BUCKETS (   _lb)    ((_lb)->lb_n_buckets <= LB_NUM_INLINE_BUCKETS)

Definition at line 225 of file load_balance.h.

◆ LB_NUM_INLINE_BUCKETS

#define LB_NUM_INLINE_BUCKETS   4

The number of buckets that a load-balance object can have and still fit in one cache-line.

Definition at line 56 of file load_balance.h.

◆ LOAD_BALANCE_ATTR_NAMES

#define LOAD_BALANCE_ATTR_NAMES
Value:
{ \
[LOAD_BALANCE_ATTR_USES_MAP] = "uses-map", \
[LOAD_BALANCE_ATTR_STICKY] = "sticky", \
}

Definition at line 87 of file load_balance.h.

Typedef Documentation

◆ load_balance_attr_t

Flags controlling load-balance creation and modification.

◆ load_balance_flags_t

◆ load_balance_format_flags_t

Flags controlling load-balance formatting/display.

◆ load_balance_main_t

The load-balance object represents an ECMP choice.

The buckets of a load balance object point to the sub-graph after the choice is made. THe load-balance object is also object type returned from a FIB table lookup. As such it needs to represent the case where there is only one coice. It may seem like overkill to use a load-balance object in this case, but the reason is for performance. If the load-balance object were not the result of the FIB lookup, then some other object would be. The case where there was ECMP this other object would need a load-balance as a parent and hence just add an unnecessary indirection.

It is also the object in the DP that represents a via-fib-entry in a recursive route. Load-balance main

◆ load_balance_path_t

One path from an [EU]CMP set that the client wants to add to a load-balance object.

◆ load_balance_t

The FIB DPO provieds;.

  • load-balancing over the next DPOs in the chain/graph
  • per-route counters

Enumeration Type Documentation

◆ load_balance_attr_t_

Flags controlling load-balance creation and modification.

Enumerator
LOAD_BALANCE_ATTR_USES_MAP 
LOAD_BALANCE_ATTR_STICKY 

Definition at line 82 of file load_balance.h.

◆ load_balance_flags_t_

Enumerator
LOAD_BALANCE_FLAG_NONE 
LOAD_BALANCE_FLAG_USES_MAP 
LOAD_BALANCE_FLAG_STICKY 

Definition at line 95 of file load_balance.h.

◆ load_balance_format_flags_t_

Flags controlling load-balance formatting/display.

Enumerator
LOAD_BALANCE_FORMAT_NONE 
LOAD_BALANCE_FORMAT_DETAIL 

Definition at line 183 of file load_balance.h.

Function Documentation

◆ format_load_balance()

u8* format_load_balance ( u8 s,
va_list *  args 
)

Definition at line 202 of file load_balance.c.

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

◆ load_balance_create()

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

Definition at line 266 of file load_balance.c.

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

◆ load_balance_get()

static load_balance_t* load_balance_get ( index_t  lbi)
inlinestatic

Definition at line 220 of file load_balance.h.

◆ load_balance_get_bucket()

const dpo_id_t* load_balance_get_bucket ( index_t  lbi,
u32  bucket 
)

Definition at line 366 of file load_balance.c.

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

◆ load_balance_get_bucket_i()

static const dpo_id_t* load_balance_get_bucket_i ( const load_balance_t lb,
u32  bucket 
)
inlinestatic

Definition at line 229 of file load_balance.h.

+ Here is the caller graph for this function:

◆ load_balance_get_default_flow_hash()

flow_hash_config_t load_balance_get_default_flow_hash ( dpo_proto_t  lb_proto)

Definition at line 220 of file load_balance.c.

+ Here is the caller graph for this function:

◆ load_balance_get_multipath_tolerance()

f64 load_balance_get_multipath_tolerance ( void  )

Definition at line 71 of file load_balance.c.

◆ load_balance_get_urpf()

index_t load_balance_get_urpf ( index_t  lbi)

Definition at line 356 of file load_balance.c.

+ Here is the call graph for this function:

◆ load_balance_is_drop()

int load_balance_is_drop ( const dpo_id_t dpo)

Definition at line 299 of file load_balance.c.

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

◆ load_balance_module_init()

void load_balance_module_init ( void  )

Definition at line 1001 of file load_balance.c.

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

◆ load_balance_multipath_update()

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

Definition at line 629 of file load_balance.c.

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

◆ load_balance_n_buckets()

u16 load_balance_n_buckets ( index_t  lbi)

Definition at line 316 of file load_balance.c.

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

◆ load_balance_set_bucket()

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

Definition at line 283 of file load_balance.c.

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

◆ load_balance_set_fib_entry_flags()

void load_balance_set_fib_entry_flags ( index_t  lbi,
fib_entry_flag_t  flags 
)

Definition at line 326 of file load_balance.c.

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

◆ load_balance_set_urpf()

void load_balance_set_urpf ( index_t  lbi,
index_t  urpf 
)

Definition at line 337 of file load_balance.c.

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

◆ STATIC_ASSERT()

STATIC_ASSERT ( sizeof(load_balance_t)<=  CLIB_CACHE_LINE_BYTES,
"A load_balance object size exceeds one cacheline"   
)

Variable Documentation

◆ load_balance_main

load_balance_main_t load_balance_main

The one instance of load-balance main.

Definition at line 59 of file load_balance.c.

◆ load_balance_pool

load_balance_t* load_balance_pool

The encapsulation breakages are for fast DP access.

The encapsulation breakages are for fast DP access.

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

Definition at line 54 of file load_balance.c.

LOAD_BALANCE_ATTR_USES_MAP
@ LOAD_BALANCE_ATTR_USES_MAP
Definition: load_balance.h:83
LOAD_BALANCE_ATTR_STICKY
@ LOAD_BALANCE_ATTR_STICKY
Definition: load_balance.h:84