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;
300 clib_host_to_net_u16(0x0800):
301 clib_host_to_net_u16(0x86DD);
356 .vector_size =
sizeof (
u32),
373 .vector_size =
sizeof (
u32),
390 .vector_size =
sizeof (
u32),
407 .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)
sll srl srl sll sra u16x4 i
static uword lb6_gre4_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)
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 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)
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.
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)
static_always_inline uword vlib_get_thread_index(void)
#define CLIB_PREFETCH(addr, size, type)
static_always_inline uword lb_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u8 is_input_v4, u8 is_encap_v4)
u64 lb_node_get_other_ports6(ip6_header_t *ip60)
#define clib_warning(format, args...)
#define VLIB_BUFFER_IS_TRACED
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
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.
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)
#define VLIB_REGISTER_NODE(x,...)
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_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)
static_always_inline u32 lb_hash_hash(u64 k0, u64 k1, u64 k2, u64 k3, u64 k4)
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)