30 #ifndef LB_PLUGIN_LB_LB_H_ 31 #define LB_PLUGIN_LB_LB_H_ 44 #define LB_DEFAULT_PER_CPU_STICKY_BUCKETS 1 << 10 45 #define LB_DEFAULT_FLOW_TIMEOUT 40 83 #define LB_AS_FLAGS_USED 0x1 119 #define lb_foreach_vip_counter \ 120 _(NEXT_PACKET, "packet from existing sessions", 0) \ 121 _(FIRST_PACKET, "first session packet", 1) \ 122 _(UNTRACKED_PACKET, "untracked packet", 2) \ 123 _(NO_SERVER, "no server configured", 3) 126 #define _(a,b,c) LB_VIP_COUNTER_##a = c, 221 #define LB_VIP_FLAGS_USED 0x1 230 #define lb_vip_is_ip4(vip) ((vip)->type == LB_VIP_TYPE_IP4_GRE6 \ 231 || (vip)->type == LB_VIP_TYPE_IP4_GRE4 \ 232 || (vip)->type == LB_VIP_TYPE_IP4_L3DSR ) 234 #define lb_vip_is_gre4(vip) ((vip)->type == LB_VIP_TYPE_IP6_GRE4 \ 235 || (vip)->type == LB_VIP_TYPE_IP4_GRE4) 236 #define lb_vip_is_gre6(vip) ((vip)->type == LB_VIP_TYPE_IP6_GRE6 \ 237 || (vip)->type == LB_VIP_TYPE_IP4_GRE6) 238 #define lb_vip_is_l3dsr(vip) (vip)->type == LB_VIP_TYPE_IP4_L3DSR 240 #define lb_encap_is_ip4(vip) ((vip)->type == LB_VIP_TYPE_IP6_GRE4 \ 241 || (vip)->type == LB_VIP_TYPE_IP4_GRE4 \ 242 || (vip)->type == LB_VIP_TYPE_IP4_L3DSR) 342 u32 sticky_buckets,
u32 flow_timeout);
345 u32 new_length,
u32 *vip_index);
350 #define lb_vip_get_by_index(index) (pool_is_free_index(lb_main.vips, index)?NULL:pool_elt_at_index(lb_main.vips, index)) format_function_t format_lb_vip
u8 dscp
DSCP bits for L3DSR.
int lb_vip_add_ass(u32 vip_index, ip46_address_t *addresses, u32 n)
Each VIP is configured with a set of application server.
u32 per_cpu_sticky_buckets
Number of buckets in the per-cpu sticky hash table.
u16 msg_id_base
API dynamically registered base ID.
ip46_address_t prefix
A Virtual IP represents a given service delivered by a set of application servers.
format_function_t format_lb_vip_type
u32 vip_index
ASs are indexed by address and VIP Index.
lb_hash_t * sticky_ht
Each CPU has its own sticky flow hash table.
ip46_address_t address
Destination address used to tunnel traffic towards that application server.
int lb_conf(ip4_address_t *ip4_address, ip6_address_t *ip6_address, u32 sticky_buckets, u32 flow_timeout)
Fix global load-balancer parameters.
enum dpo_type_t_ dpo_type_t
Common types of data-path objects New types can be dynamically added using dpo_register_new_type() ...
unformat_function_t unformat_lb_vip_type
u32 flow_timeout
Flow timeout in seconds.
fib_node_type_t fib_node_type
Node type for registering to fib changes.
dpo_type_t dpo_gre4_type
DPO used to send packet from IP4/6 lookup to LB node.
vlib_refcount_t as_refcount
Each AS has an associated reference counter.
format_function_t format_lb_as
A collection of simple counters.
lb_vip_t * vips
Pool of all Virtual IPs.
u32 last_used
Rotating timestamp of when LB_AS_FLAGS_USED flag was last set.
ip4_address_t ip4_src_address
Source address used for IPv4 encapsulated traffic.
u8 plen
The VIP prefix length.
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
format_function_t format_lb_main
An node in the FIB graph.
fib_node_t fib_node
Registration to FIB event.
vlib_node_registration_t lb6_node
volatile u32 * writer_lock
#define lb_foreach_vip_counter
u32 fib_node_index_t
A typedef of a node index.
u32 last_garbage_collection
Last time garbage collection was run to free the ASs.
lb_as_t * ass
Pool of ASs.
vlib_node_registration_t lb4_node
int lb_vip_find_index(ip46_address_t *prefix, u8 plen, u32 *vip_index)
lb_vip_type_t type
The type of traffic for this.
int lb_vip_del(u32 vip_index)
lb_vip_type_t
The load balancer supports IPv4 and IPv6 traffic and GRE4, GRE6 and L3DSR encap.
void lb_garbage_collection()
u32 new_flow_table_mask
New flows table length - 1 (length MUST be a power of 2)
format_function_t format_lb_vip_detailed
lb_per_cpu_t * per_cpu
Some global data is per-cpu.
int lb_vip_del_ass(u32 vip_index, ip46_address_t *addresses, u32 n)
struct _vlib_node_registration vlib_node_registration_t
ip6_address_t ip6_src_address
Source address used in IPv6 encapsulated traffic.
u32 next_hop_child_index
The child index on the FIB entry.
dpo_type_t dpo_l3dsr_type
int lb_vip_add(ip46_address_t *prefix, u8 plen, lb_vip_type_t type, u8 dscp, u32 new_length, u32 *vip_index)
enum fib_node_type_t_ fib_node_type_t
The types of nodes in a FIB graph.
u32 lb_hash_time_now(vlib_main_t *vm)
dpo_id_t dpo
The next DPO in the graph to follow.
u8 flags
Some per-AS flags.
lb_new_flow_entry_t * new_flow_table
Vector mapping (flow-hash & new_connect_table_mask) to AS index.
u8 flags
Flags related to this VIP.
Load balancing service is provided per VIP.
u32 * as_indexes
Pool of AS indexes used for this VIP.
fib_node_index_t next_hop_fib_entry_index
The FIB entry index for the next-hop.