21 #define foreach_lb_error \ 23 _(PROTO_NOT_SUPPORTED, "protocol not supported") \ 24 _(NO_SERVER, "no configured application server") 27 #define _(sym,str) LB_ERROR_##sym, 34 #define _(sym,string) string, 114 u32 n_left_from, *from, next_index, *to_next, n_left_to_next;
123 while (n_left_from > 0)
126 while (n_left_from > 0 && n_left_to_next > 0)
136 u32 value0, available_index0, hash0;
150 pi0 = to_next[0] = from[0];
164 len0 = clib_net_to_host_u16(ip40->
length);
189 key0[4] |= ((vip0 - lbm->vips));
191 lb_hash_get(sticky_ht, key0, hash0, lb_time, &available_index0, &value0);
194 as0 = &lbm->ass[value0];
199 error0 = LB_ERROR_NO_SERVER;
203 cpu_index, vip0 - lbm->vips, 1);
216 lb_hash_put(sticky_ht, key0, as0 - lbm->ass, available_index0, lb_time);
221 cpu_index, vip0 - lbm->vips, 1);
252 clib_host_to_net_u16(0x0800):
253 clib_host_to_net_u16(0x86DD);
265 p0->
error = error_node->errors[error0];
267 n_left_to_next, pi0, next0);
307 .vector_size =
sizeof (
u32),
323 .node_name =
"lb6-gre6",
332 .vector_size =
sizeof (
u32),
348 .node_name =
"lb6-gre4",
357 .vector_size =
sizeof (
u32),
373 .node_name =
"lb4-gre6",
382 .vector_size =
sizeof (
u32),
398 .node_name =
"lb4-gre4",
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.
u32 ip_lookup_next_index[LB_VIP_N_TYPES]
Node next index for IP adjacencies, for each of the traffic types.
static void vlib_increment_simple_counter(vlib_simple_counter_main_t *cm, u32 cpu_index, u32 index, u32 increment)
Increment a simple counter.
vlib_node_registration_t lb4_gre4_node
(constructor) VLIB_REGISTER_NODE (lb4_gre4_node)
format_function_t format_lb_vip
static uword lb4_gre4_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
u32 lb_hash_time_now(vlib_main_t *vm)
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.
static_always_inline lb_hash_t * lb_hash_alloc(u32 buckets, u32 timeout)
VNET_IP4_REGISTER_ADJACENCY(lb4_gre6)
ip_lookup_main_t lookup_main
u8 opaque[IP_ADJACENCY_OPAQUE_SZ]
u32 adj_index
Second ip lookup can be avoided by sending directly the packet to ip-rewrite with a configured adjace...
vlib_node_registration_t lb6_gre4_node
(constructor) VLIB_REGISTER_NODE (lb6_gre4_node)
lb_hash_t * lb_get_sticky_table(u32 cpu_index)
static_always_inline u32 lb_hash_put(lb_hash_t *h, u64 k[5], u32 value, u32 available_index, u32 time_now)
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.
#define lb_hash_nbuckets(h)
#define static_always_inline
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
u32 flow_timeout
Flow timeout in seconds.
vlib_refcount_t as_refcount
Each AS has an associated reference counter.
#define clib_warning(format, args...)
format_function_t format_lb_as
lb_vip_t * vips
Pool of all Virtual IPs.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static_always_inline void lb_hash_get(lb_hash_t *h, u64 k[5], u32 hash, u32 time_now, u32 *available_index, u32 *value)
#define lb_hash_foreach_entry(h, e)
uword os_get_cpu_number(void)
#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).
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)
static uword lb6_gre4_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static char * lb_error_strings[]
#define CLIB_PREFETCH(addr, size, type)
u32 vip_index
Index of the VIP associated with that IP adjacency.
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
static_always_inline u32 lb_hash_available_value(lb_hash_t *h, u32 available_index)
static_always_inline void lb_hash_free(lb_hash_t *h)
vlib_node_registration_t lb4_gre6_node
(constructor) VLIB_REGISTER_NODE (lb4_gre6_node)
lb_as_t * ass
Pool of ASs.
struct stored in adj->opaque data.
ip_lookup_main_t lookup_main
u32 new_flow_table_mask
New flows table length - 1 (length MUST be a power of 2)
static uword lb6_gre6_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
lb_per_cpu_t * per_cpu
Some global data is per-cpu.
#define VLIB_BUFFER_IS_TRACED
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static_always_inline u32 lb_hash_hash(u64 k[5])
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
u8 * format_lb_trace(u8 *s, va_list *args)
vlib_node_registration_t lb6_gre6_node
(constructor) VLIB_REGISTER_NODE (lb6_gre6_node)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define VLIB_REGISTER_NODE(x,...)
ip4_main_t ip4_main
Global ip4 main structure.
static uword lb4_gre6_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
lb_new_flow_entry_t * new_flow_table
Vector mapping (flow-hash & new_connect_table_mask) to AS index.
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
static_always_inline void vlib_refcount_add(vlib_refcount_t *r, u32 cpu_index, u32 counter_index, i32 v)
Load balancing service is provided per VIP.
VNET_IP6_REGISTER_ADJACENCY(lb6_gre6)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static u16 ip4_header_checksum(ip4_header_t *i)
u8 * lb_format_adjacency(u8 *s, va_list *va)
static ip_adjacency_t * ip_get_adjacency(ip_lookup_main_t *lm, u32 adj_index)