|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
22 #define foreach_lb_error \
24 _(PROTO_NOT_SUPPORTED, "protocol not supported")
28 #define _(sym,str) LB_ERROR_##sym,
36 #define _(sym,string) string,
73 s =
format (s,
"lb vip[%d]: This VIP was freed since capture\n");
82 s =
format (s,
"lb as[%d]: This AS was freed since capture\n");
104 s =
format (s,
"lb vip[%d]: This VIP was freed since capture\n");
113 s =
format (s,
"lb as[%d]: This AS was freed since capture\n");
120 s =
format (s,
"lb nat: rx_sw_if_index = %d, next_index = %d",
178 u32 *hash,
u32 *vip_idx,
u8 per_port_vip)
189 key.vip_prefix_index = *vip_idx;
200 || ip40->
protocol == IP_PROTOCOL_UDP))
211 key.port = (
u16)(ports & 0xFFFF);
222 || ip60->
protocol == IP_PROTOCOL_UDP))
236 key.port = (
u16)(ports & 0xFFFF);
250 *vip_idx =
value.value;
273 u32 next_vip_idx0 = ~0;
278 &next_vip_idx0, per_port_vip);
291 u32 available_index0;
293 u32 hash0 = nexthash0;
294 u32 vip_index0 = next_vip_idx0;
302 &nexthash0, &next_vip_idx0,
318 pi0 = to_next[0] =
from[0];
332 len0 = clib_net_to_host_u16 (ip40->
length);
344 &available_index0, &asindex0);
349 counter = LB_VIP_COUNTER_NEXT_PACKET;
356 counter = LB_VIP_COUNTER_FIRST_PACKET;
357 counter = (asindex0 == 0) ? LB_VIP_COUNTER_NO_SERVER : counter;
374 available_index0, lb_time);
381 counter = LB_VIP_COUNTER_UNTRACKED_PACKET;
407 ip40->
length = clib_host_to_net_u16 (
423 clib_host_to_net_u32 (0x6 << 28);
432 clib_host_to_net_u16 (0x0800) :
433 clib_host_to_net_u16 (0x86DD);
439 u32 old_dst, new_dst;
444 new_dst = lbm->
ass[asindex0].
address.ip4.as_u32;
461 if (ip40->
protocol == IP_PROTOCOL_TCP)
468 else if (ip40->
protocol == IP_PROTOCOL_UDP)
499 if (ip40->
protocol == IP_PROTOCOL_UDP)
517 ip6_address_t old_dst;
536 csum, lbm->
ass[asindex0].
address.ip6.as_u64[0]);
538 csum, lbm->
ass[asindex0].
address.ip6.as_u64[1]);
566 return frame->n_vectors;
580 s =
format (s,
"lb vip[%d]: This VIP was freed since capture\n");
631 pi0 = to_next[0] =
from[0];
678 return frame->n_vectors;
699 if (clib_bihash_search_8_8 (mapping_hash, &kv4, &
value))
724 m_key6.
addr.as_u64[0] = match->
addr.as_u64[0];
725 m_key6.
addr.as_u64[1] = match->
addr.as_u64[1];
734 if (clib_bihash_search_24_8 (mapping_hash, &kv6, &
value))
749 u32 pkts_processed = 0;
751 u32 stats_node_index;
773 u16 old_port0, new_port0;
797 u32 old_addr0, new_addr0;
819 new_addr0 = sm40->
src_ip.ip4.as_u32;
832 old_port0 = tcp0->src_port;
833 tcp0->src_port = new_port0;
835 csum = tcp0->checksum;
860 ip6_address_t old_addr0, new_addr0;
883 new_addr0.as_u64[0] = sm60->
src_ip.as_u64[0];
884 new_addr0.as_u64[1] = sm60->
src_ip.as_u64[1];
894 old_port0 = tcp0->src_port;
895 tcp0->src_port = new_port0;
897 csum = tcp0->checksum;
934 n_left_to_next, bi0, next0);
941 LB_NAT_IN2OUT_ERROR_IN2OUT_PACKETS,
943 return frame->n_vectors;
1048 .vector_size =
sizeof(
u32),
1061 .vector_size =
sizeof(
u32),
1074 .vector_size =
sizeof(
u32),
1087 .vector_size =
sizeof(
u32),
1099 .name =
"lb6-gre6-port",
1100 .vector_size =
sizeof(
u32),
1112 .name =
"lb6-gre4-port",
1113 .vector_size =
sizeof(
u32),
1125 .name =
"lb4-gre6-port",
1126 .vector_size =
sizeof(
u32),
1138 .name =
"lb4-gre4-port",
1139 .vector_size =
sizeof(
u32),
1151 .name =
"lb4-l3dsr-port",
1152 .vector_size =
sizeof(
u32),
1164 .name =
"lb4-l3dsr",
1165 .vector_size =
sizeof(
u32),
1177 .name =
"lb6-nat6-port",
1178 .vector_size =
sizeof(
u32),
1190 .name =
"lb4-nat4-port",
1191 .vector_size =
sizeof(
u32),
1217 .name =
"lb4-nodeport",
1218 .vector_size =
sizeof(
u32),
1233 .name =
"lb6-nodeport",
1234 .vector_size =
sizeof(
u32),
1248 .arc_name =
"ip4-unicast",
1249 .node_name =
"lb-nat4-in2out",
1256 .name =
"lb-nat4-in2out",
1257 .vector_size =
sizeof(
u32),
1271 .arc_name =
"ip6-unicast",
1272 .node_name =
"lb-nat6-in2out",
1279 .name =
"lb-nat6-in2out",
1280 .vector_size =
sizeof(
u32),
static uword lb4_nodeport_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
clib_bihash_8_8_t vip_index_per_port
vlib_node_registration_t lb4_gre6_node
(constructor) VLIB_REGISTER_NODE (lb4_gre6_node)
u16 dpoi_next_node
The next VLIB node to follow.
vlib_node_registration_t lb6_gre6_port_node
(constructor) VLIB_REGISTER_NODE (lb6_gre6_port_node)
index_t dpoi_index
the index of objects of that type
u32 per_cpu_sticky_buckets
Number of buckets in the per-cpu sticky hash table.
static uword lb4_gre6_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
vl_api_ip_port_and_mask_t dst_port
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
vlib_node_registration_t lb4_gre4_node
(constructor) VLIB_REGISTER_NODE (lb4_gre4_node)
u16 src_port
Network byte order for vip + port case, src_port = port; for node ip + node_port, src_port = node_por...
static uword lb4_l3dsr_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
@ LB6_NODEPORT_NEXT_IP6_NAT6
nat44_ei_hairpin_src_next_t next_index
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
uword * vip_index_by_nodeport
static char * lb_error_strings[]
lb_vip_t * vips
Pool of all Virtual IPs.
#define ADJ_INDEX_INVALID
Invalid ADJ index - used when no adj is known likewise blazoned capitals INVALID speak volumes where ...
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
struct _tcp_header tcp_header_t
vlib_main_t vlib_node_runtime_t * node
u8 * format_lb_trace(u8 *s, va_list *args)
vlib_node_registration_t lb4_l3dsr_node
(constructor) VLIB_REGISTER_NODE (lb4_l3dsr_node)
#define lb_hash_foreach_entry(h, bucket, i)
static uword lb4_gre6_port_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
ip46_address_t address
Destination address used to tunnel traffic towards that application server.
u32 ip4_fib_table_get_index_for_sw_if_index(u32 sw_if_index)
@ LB_NAT6_IN2OUT_NEXT_DROP
ip4_address_t ip4_src_address
Source address used for IPv4 encapsulated traffic.
static_always_inline void lb_hash_get(lb_hash_t *ht, u32 hash, u32 vip, u32 time_now, u32 *available_index, u32 *found_value)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
@ LB_NAT6_IN2OUT_NEXT_LOOKUP
int lb_nat66_mapping_match(lb_main_t *lbm, lb_snat6_key_t *match, u32 *index)
Match NAT66 static mapping.
lb_per_cpu_t * per_cpu
Some global data is per-cpu.
static uword lb6_nat6_port_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static uword lb_nat_in2out_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u32 is_nat4)
vlib_refcount_t as_refcount
Each AS has an associated reference counter.
@ LB_NAT4_IN2OUT_NEXT_LOOKUP
static void * ip6_next_header(ip6_header_t *i)
vlib_simple_counter_main_t vip_counters[LB_N_VIP_COUNTERS]
Per VIP counter.
vlib_node_registration_t lb_nat4_in2out_node
(constructor) VLIB_REGISTER_NODE (lb_nat4_in2out_node)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
static_always_inline void lb_hash_prefetch_bucket(lb_hash_t *ht, u32 hash)
#define CLIB_PREFETCH(addr, size, type)
static void vlib_increment_simple_counter(vlib_simple_counter_main_t *cm, u32 thread_index, u32 index, u64 increment)
Increment a simple counter.
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
u8 * format_nodeport_lb_trace(u8 *s, va_list *args)
vlib_node_registration_t lb6_nat6_port_node
(constructor) VLIB_REGISTER_NODE (lb6_nat6_port_node)
vlib_node_registration_t lb6_nodeport_node
(constructor) VLIB_REGISTER_NODE (lb6_nodeport_node)
VNET_FEATURE_INIT(lb_nat4_in2out_node_fn, static)
#define VLIB_NODE_FLAG_TRACE
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
u16 ip4_tcp_udp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip4_header_t *ip0)
#define static_always_inline
static_always_inline u32 lb_hash_hash(u64 k0, u64 k1, u64 k2, u64 k3, u64 k4)
format_function_t format_lb_as
static uword lb_nat6_in2out_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
u64 lb_node_get_other_ports4(ip4_header_t *ip40)
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
static_always_inline void lb_hash_free(lb_hash_t *h)
vlib_node_registration_t lb4_l3dsr_port_node
(constructor) VLIB_REGISTER_NODE (lb4_l3dsr_port_node)
sll srl srl sll sra u16x4 i
lb_vip_encap_args_t encap_args
ip6_address_t ip6_src_address
Source address used in IPv6 encapsulated traffic.
vlib_node_registration_t lb4_nat4_port_node
(constructor) VLIB_REGISTER_NODE (lb4_nat4_port_node)
u64 lb_node_get_other_ports6(ip6_header_t *ip60)
Load balancing service is provided per VIP+protocol+port.
struct _vlib_node_registration vlib_node_registration_t
vlib_node_registration_t lb6_gre4_node
(constructor) VLIB_REGISTER_NODE (lb6_gre4_node)
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, u8 per_port_vip)
static ip_csum_t ip_csum_sub_even(ip_csum_t c, ip_csum_t x)
#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.
static uword lb_nat4_in2out_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static uword lb6_gre4_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
format_function_t format_lb_vip
@ LB_NAT4_IN2OUT_NEXT_DROP
static_always_inline u32 lb_hash_available_value(lb_hash_t *h, u32 hash, u32 available_index)
#define hash_get_mem(h, key)
description fragment has unexpected format
static_always_inline lb_hash_t * lb_hash_alloc(u32 buckets, u32 timeout)
vlib_put_next_frame(vm, node, next_index, 0)
lb_hash_t * sticky_ht
Each CPU has its own sticky flow hash table.
static_always_inline void lb_node_get_hash(lb_main_t *lbm, vlib_buffer_t *p, u8 is_input_v4, u32 *hash, u32 *vip_idx, u8 per_port_vip)
static uword lb6_nodeport_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
int lb_nat44_mapping_match(lb_main_t *lbm, lb_snat4_key_t *match, u32 *index)
Match NAT44 static mapping.
dpo_id_t dpo
The next DPO in the graph to follow.
8 octet key, 8 octet key value pair
static uword lb6_gre6_port_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
clib_bihash_8_8_t mapping_by_as4
clib_bihash_24_8_t mapping_by_as6
vlib_node_registration_t lb6_gre6_node
(constructor) VLIB_REGISTER_NODE (lb6_gre6_node)
static uword lb4_l3dsr_port_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.
#define ip_csum_update(sum, old, new, type, field)
static uword lb4_gre4_port_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define VNET_FEATURES(...)
u32 lb_hash_time_now(vlib_main_t *vm)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static u16 ip4_header_checksum(ip4_header_t *i)
static u32 lb_ip_proto_to_nat_proto(u8 ip_proto)
lb_as_t * ass
Pool of ASs.
static_always_inline void lb_hash_put(lb_hash_t *h, u32 hash, u32 value, u32 vip, u32 available_index, u32 time_now)
vlib_node_registration_t lb6_gre4_port_node
(constructor) VLIB_REGISTER_NODE (lb6_gre4_port_node)
vlib_node_registration_t lb_nat6_in2out_node
(constructor) VLIB_REGISTER_NODE (lb_nat6_in2out_node)
static uword lb6_gre4_port_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
static uword lb4_nat4_port_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define lb_hash_nbuckets(h)
#define clib_warning(format, args...)
vlib_node_registration_t lb4_nodeport_node
(constructor) VLIB_REGISTER_NODE (lb4_nodeport_node)
lb_hash_t * lb_get_sticky_table(u32 thread_index)
vlib_node_registration_t lb4_gre6_port_node
(constructor) VLIB_REGISTER_NODE (lb4_gre6_port_node)
u32 flow_timeout
Flow timeout in seconds.
ip46_address_t src_ip
for vip + port case, src_ip = vip; for node ip + node_port, src_ip = node_ip
u32 new_flow_table_mask
New flows table length - 1 (length MUST be a power of 2)
static uword lb_nodeport_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, u8 is_input_v4)
static uword lb4_gre4_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
u8 * format_lb_nat_trace(u8 *s, va_list *args)
static ip_csum_t ip_csum_add_even(ip_csum_t c, ip_csum_t x)
#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).
lb_snat_mapping_t * snat_mappings
static u16 ip_csum_fold(ip_csum_t c)
static_always_inline void vlib_refcount_add(vlib_refcount_t *r, u32 thread_index, u32 counter_index, i32 v)
@ LB4_NODEPORT_NEXT_IP4_NAT4
static void * ip4_next_header(ip4_header_t *i)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
static uword lb6_gre6_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
VLIB buffer representation.
#define VLIB_REGISTER_NODE(x,...)
vlib_node_registration_t lb4_gre4_port_node
(constructor) VLIB_REGISTER_NODE (lb4_gre4_port_node)