21 #define foreach_lb_error \ 23 _(PROTO_NOT_SUPPORTED, "protocol not supported") 26 #define _(sym,str) LB_ERROR_##sym, 33 #define _(sym,string) string, 51 s =
format(s,
"lb vip[%d]: This VIP was freed since capture\n");
56 s =
format(s,
"lb as[%d]: This AS was freed since capture\n");
155 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
168 while (n_left_from > 0)
171 while (n_left_from > 0 && n_left_to_next > 0)
178 u32 available_index0;
180 u32 hash0 = nexthash0;
201 pi0 = to_next[0] = from[0];
215 len0 = clib_net_to_host_u16(ip40->
length);
225 lb_time, &available_index0, &asindex0);
230 counter = LB_VIP_COUNTER_NEXT_PACKET;
236 counter = LB_VIP_COUNTER_FIRST_PACKET;
237 counter = (asindex0 == 0)?LB_VIP_COUNTER_NO_SERVER:counter;
253 available_index0, lb_time);
259 counter = LB_VIP_COUNTER_UNTRACKED_PACKET;
304 clib_host_to_net_u16(0x0800):
305 clib_host_to_net_u16(0x86DD);
314 ip40->
tos = (
u8)((vip0->
dscp & 0x3F)<<2);
381 .vector_size =
sizeof (
u32),
398 .vector_size =
sizeof (
u32),
415 .vector_size =
sizeof (
u32),
432 .vector_size =
sizeof (
u32),
449 .vector_size =
sizeof (
u32),
u8 * format_lb_trace(u8 *s, va_list *args)
format_function_t format_lb_vip
u32 lb_hash_time_now(vlib_main_t *vm)
u8 dscp
DSCP bits for L3DSR.
static uword lb6_gre4_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static uword lb4_l3dsr_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
vlib_node_registration_t lb6_gre6_node
(constructor) VLIB_REGISTER_NODE (lb6_gre6_node)
u32 per_cpu_sticky_buckets
Number of buckets in the per-cpu sticky hash table.
static_always_inline lb_hash_t * lb_hash_alloc(u32 buckets, u32 timeout)
static void vlib_increment_simple_counter(vlib_simple_counter_main_t *cm, u32 thread_index, u32 index, u64 increment)
Increment a simple counter.
static_always_inline u32 lb_hash_available_value(lb_hash_t *h, u32 hash, u32 available_index)
struct _tcp_header tcp_header_t
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.
static uword lb4_gre6_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define lb_hash_nbuckets(h)
#define static_always_inline
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
u32 flow_timeout
Flow timeout in seconds.
vlib_refcount_t as_refcount
Each AS has an associated reference counter.
static void * ip4_next_header(ip4_header_t *i)
format_function_t format_lb_as
lb_vip_t * vips
Pool of all Virtual IPs.
ip4_address_t ip4_src_address
Source address used for IPv4 encapsulated traffic.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
u32 value[LBHASH_ENTRY_PER_BUCKET]
vlib_node_registration_t lb4_gre4_node
(constructor) VLIB_REGISTER_NODE (lb4_gre4_node)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static_always_inline void lb_hash_prefetch_bucket(lb_hash_t *ht, u32 hash)
lb_hash_t * lb_get_sticky_table(u32 thread_index)
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
vlib_node_registration_t lb6_gre4_node
(constructor) VLIB_REGISTER_NODE (lb6_gre4_node)
static_always_inline void vlib_refcount_add(vlib_refcount_t *r, u32 thread_index, u32 counter_index, i32 v)
static_always_inline u32 lb_node_get_hash(vlib_buffer_t *p, u8 is_input_v4)
#define lb_hash_foreach_entry(h, bucket, i)
#define VLIB_REGISTER_NODE(x,...)
static_always_inline uword vlib_get_thread_index(void)
#define CLIB_PREFETCH(addr, size, type)
u64 lb_node_get_other_ports6(ip6_header_t *ip60)
static_always_inline uword lb_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u8 is_input_v4, lb_encap_type_t encap_type)
#define clib_warning(format, args...)
vlib_node_registration_t lb4_l3dsr_node
(constructor) VLIB_REGISTER_NODE (lb4_l3dsr_node)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
static_always_inline void lb_hash_free(lb_hash_t *h)
lb_as_t * ass
Pool of ASs.
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
u16 ip4_tcp_udp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip4_header_t *ip0)
u32 new_flow_table_mask
New flows table length - 1 (length MUST be a power of 2)
static char * lb_error_strings[]
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
lb_per_cpu_t * per_cpu
Some global data is per-cpu.
vlib_simple_counter_main_t vip_counters[LB_N_VIP_COUNTERS]
Per VIP counter.
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
ip6_address_t ip6_src_address
Source address used in IPv6 encapsulated traffic.
index_t dpoi_index
the index of objects of that type
u64 lb_node_get_other_ports4(ip4_header_t *ip40)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static uword lb6_gre6_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static_always_inline u32 lb_hash_hash(u64 k0, u64 k1, u64 k2, u64 k3, u64 k4)
dpo_id_t dpo
The next DPO in the graph to follow.
u16 dpoi_next_node
The next VLIB node to follow.
lb_new_flow_entry_t * new_flow_table
Vector mapping (flow-hash & new_connect_table_mask) to AS index.
static uword lb4_gre4_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
Load balancing service is provided per VIP.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static_always_inline void lb_hash_get(lb_hash_t *ht, u32 hash, u32 vip, u32 time_now, u32 *available_index, u32 *found_value)
static u16 ip4_header_checksum(ip4_header_t *i)
vlib_node_registration_t lb4_gre6_node
(constructor) VLIB_REGISTER_NODE (lb4_gre6_node)
static_always_inline void lb_hash_put(lb_hash_t *h, u32 hash, u32 value, u32 vip, u32 available_index, u32 time_now)