FD.io VPP  v18.01-8-g0eacf49
Vector Packet Processing
lb.h File Reference
+ Include dependency graph for lb.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  lb_as_t
 Each VIP is configured with a set of application server. More...
 
struct  lb_new_flow_entry_t
 
struct  lb_vip_t
 Load balancing service is provided per VIP. More...
 
struct  lb_per_cpu_t
 
struct  lb_main_t
 

Macros

#define LB_DEFAULT_PER_CPU_STICKY_BUCKETS   1 << 10
 lb-plugin implements a MagLev-like load balancer. More...
 
#define LB_DEFAULT_FLOW_TIMEOUT   40
 
#define LB_AS_FLAGS_USED   0x1
 
#define lb_foreach_vip_counter
 
#define LB_VIP_FLAGS_USED   0x1
 
#define lb_vip_is_ip4(vip)   ((vip)->type == LB_VIP_TYPE_IP4_GRE6 || (vip)->type == LB_VIP_TYPE_IP4_GRE4)
 
#define lb_vip_is_gre4(vip)   ((vip)->type == LB_VIP_TYPE_IP6_GRE4 || (vip)->type == LB_VIP_TYPE_IP4_GRE4)
 
#define lb_vip_get_by_index(index)   (pool_is_free_index(lb_main.vips, index)?NULL:pool_elt_at_index(lb_main.vips, index))
 

Enumerations

enum  lb_next_t { LB_NEXT_DROP, LB_N_NEXT }
 
enum  lb_vip_counter_t { LB_N_VIP_COUNTERS }
 
enum  lb_vip_type_t {
  LB_VIP_TYPE_IP6_GRE6, LB_VIP_TYPE_IP6_GRE4, LB_VIP_TYPE_IP4_GRE6, LB_VIP_TYPE_IP4_GRE4,
  LB_VIP_N_TYPES
}
 The load balancer supports IPv4 and IPv6 traffic and GRE4 and GRE6 encap. More...
 

Functions

int lb_conf (ip4_address_t *ip4_address, ip6_address_t *ip6_address, u32 sticky_buckets, u32 flow_timeout)
 Fix global load-balancer parameters. More...
 
int lb_vip_add (ip46_address_t *prefix, u8 plen, lb_vip_type_t type, u32 new_length, u32 *vip_index)
 
int lb_vip_del (u32 vip_index)
 
int lb_vip_find_index (ip46_address_t *prefix, u8 plen, u32 *vip_index)
 
int lb_vip_add_ass (u32 vip_index, ip46_address_t *addresses, u32 n)
 
int lb_vip_del_ass (u32 vip_index, ip46_address_t *addresses, u32 n)
 
u32 lb_hash_time_now (vlib_main_t *vm)
 
void lb_garbage_collection ()
 

Variables

format_function_t format_lb_as
 
format_function_t format_lb_vip_type
 
unformat_function_t unformat_lb_vip_type
 
format_function_t format_lb_vip
 
format_function_t format_lb_vip_detailed
 
lb_main_t lb_main
 
vlib_node_registration_t lb6_node
 
vlib_node_registration_t lb4_node
 
format_function_t format_lb_main
 

Macro Definition Documentation

#define LB_AS_FLAGS_USED   0x1

Definition at line 82 of file lb.h.

#define LB_DEFAULT_FLOW_TIMEOUT   40

Definition at line 44 of file lb.h.

#define LB_DEFAULT_PER_CPU_STICKY_BUCKETS   1 << 10

lb-plugin implements a MagLev-like load balancer.

http://research.google.com/pubs/pub44824.html

It hasn't been tested for interoperability with the original MagLev but intends to provide similar functionality. The load-balancer receives traffic destined to VIP (Virtual IP) addresses from one or multiple(ECMP) routers. The load-balancer tunnels the traffic toward many application servers ensuring session stickyness (i.e. that a single sessions is tunneled towards a single application server).

Definition at line 43 of file lb.h.

#define lb_foreach_vip_counter
Value:
_(NEXT_PACKET, "packet from existing sessions", 0) \
_(FIRST_PACKET, "first session packet", 1) \
_(UNTRACKED_PACKET, "untracked packet", 2) \
_(NO_SERVER, "no server configured", 3)

Definition at line 118 of file lb.h.

#define LB_VIP_FLAGS_USED   0x1

Definition at line 206 of file lb.h.

#define lb_vip_get_by_index (   index)    (pool_is_free_index(lb_main.vips, index)?NULL:pool_elt_at_index(lb_main.vips, index))

Definition at line 322 of file lb.h.

#define lb_vip_is_gre4 (   vip)    ((vip)->type == LB_VIP_TYPE_IP6_GRE4 || (vip)->type == LB_VIP_TYPE_IP4_GRE4)

Definition at line 216 of file lb.h.

#define lb_vip_is_ip4 (   vip)    ((vip)->type == LB_VIP_TYPE_IP4_GRE6 || (vip)->type == LB_VIP_TYPE_IP4_GRE4)

Definition at line 215 of file lb.h.

Enumeration Type Documentation

enum lb_next_t
Enumerator
LB_NEXT_DROP 
LB_N_NEXT 

Definition at line 46 of file lb.h.

Enumerator
LB_N_VIP_COUNTERS 

Definition at line 124 of file lb.h.

The load balancer supports IPv4 and IPv6 traffic and GRE4 and GRE6 encap.

Enumerator
LB_VIP_TYPE_IP6_GRE6 
LB_VIP_TYPE_IP6_GRE4 
LB_VIP_TYPE_IP4_GRE6 
LB_VIP_TYPE_IP4_GRE4 
LB_VIP_N_TYPES 

Definition at line 135 of file lb.h.

Function Documentation

int lb_conf ( ip4_address_t ip4_address,
ip6_address_t ip6_address,
u32  sticky_buckets,
u32  flow_timeout 
)

Fix global load-balancer parameters.

Parameters
ip4_addressIPv4 source address used for encapsulated traffic
ip6_addressIPv6 source address used for encapsulated traffic
Returns
0 on success. VNET_LB_ERR_XXX on error

Definition at line 364 of file lb.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void lb_garbage_collection ( )

Definition at line 235 of file lb.c.

+ Here is the caller graph for this function:

u32 lb_hash_time_now ( vlib_main_t vm)

Definition at line 51 of file lb.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int lb_vip_add ( ip46_address_t *  prefix,
u8  plen,
lb_vip_type_t  type,
u32  new_length,
u32 vip_index 
)

Definition at line 639 of file lb.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int lb_vip_add_ass ( u32  vip_index,
ip46_address_t *  addresses,
u32  n 
)

Definition at line 427 of file lb.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int lb_vip_del ( u32  vip_index)

Definition at line 697 of file lb.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int lb_vip_del_ass ( u32  vip_index,
ip46_address_t *  addresses,
u32  n 
)

Definition at line 584 of file lb.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int lb_vip_find_index ( ip46_address_t *  prefix,
u8  plen,
u32 vip_index 
)

Definition at line 400 of file lb.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

format_function_t format_lb_as

Definition at line 112 of file lb.h.

format_function_t format_lb_main

Definition at line 331 of file lb.h.

format_function_t format_lb_vip

Definition at line 217 of file lb.h.

format_function_t format_lb_vip_detailed

Definition at line 218 of file lb.h.

format_function_t format_lb_vip_type

Definition at line 143 of file lb.h.

lb_main_t lb_main

Definition at line 27 of file lb.c.

unformat_function_t unformat_lb_vip_type

Definition at line 144 of file lb.h.