|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
27 #define foreach_vxlan_encap_error \
28 _(ENCAPSULATED, "good packets encapsulated")
31 #define _(sym,string) string,
38 #define _(sym,str) VXLAN_ENCAP_ERROR_##sym,
56 #ifndef CLIB_MARCH_VARIANT
64 s =
format (s,
"VXLAN encap to vxlan_tunnel%d vni %d",
81 u32 pkts_encapsulated = 0;
83 u32 sw_if_index0 = 0, sw_if_index1 = 0;
84 u32 next0 = 0, next1 = 0;
98 u8 const underlay_hdr_len = is_ip4 ?
99 sizeof (ip4_vxlan_header_t) :
sizeof (ip6_vxlan_header_t);
101 u32 const csum_flags =
102 is_ip4 ? VNET_BUFFER_F_IS_IP4 | VNET_BUFFER_F_L3_HDR_OFFSET_VALID |
103 VNET_BUFFER_F_L4_HDR_OFFSET_VALID :
104 VNET_BUFFER_F_IS_IP6 | VNET_BUFFER_F_L3_HDR_OFFSET_VALID |
105 VNET_BUFFER_F_L4_HDR_OFFSET_VALID;
106 u32 const outer_packet_csum_offload_flags =
107 is_ip4 ? VNET_BUFFER_OFFLOAD_F_IP_CKSUM | VNET_BUFFER_OFFLOAD_F_UDP_CKSUM :
108 VNET_BUFFER_OFFLOAD_F_UDP_CKSUM;
109 u32 const inner_packet_removed_flags =
110 VNET_BUFFER_F_IS_IP4 | VNET_BUFFER_F_IS_IP6 |
111 VNET_BUFFER_F_L2_HDR_OFFSET_VALID | VNET_BUFFER_F_L3_HDR_OFFSET_VALID |
112 VNET_BUFFER_F_L4_HDR_OFFSET_VALID;
135 u32 bi0 = to_next[0] =
from[0];
136 u32 bi1 = to_next[1] =
from[1];
147 if (csum_offload && (or_flags & VNET_BUFFER_F_OFFLOAD))
150 if ((b0->
flags & VNET_BUFFER_F_GSO) == 0)
154 VNET_BUFFER_F_IS_IP4,
156 VNET_BUFFER_F_IS_IP6);
157 b0->
flags &= ~inner_packet_removed_flags;
159 if ((b1->
flags & VNET_BUFFER_F_GSO) == 0)
163 VNET_BUFFER_F_IS_IP4,
165 VNET_BUFFER_F_IS_IP6);
166 b1->
flags &= ~inner_packet_removed_flags;
190 sw_if_index1 = sw_if_index0;
193 dpoi_idx1 = dpoi_idx0;
203 dpoi_idx1 = t1->next_dpo.dpoi_index;
210 ASSERT (t0->rewrite_header.data_bytes == underlay_hdr_len);
211 ASSERT (t1->rewrite_header.data_bytes == underlay_hdr_len);
221 u16 payload_l0 = clib_host_to_net_u16 (len0 - l3_len);
222 u16 payload_l1 = clib_host_to_net_u16 (len1 - l3_len);
234 ip4_vxlan_header_t *hdr0 = underlay0;
235 ip4_vxlan_header_t *hdr1 = underlay1;
240 ip4_0->
length = clib_host_to_net_u16 (len0);
241 ip4_1->
length = clib_host_to_net_u16 (len1);
246 ip4_0->
tos = ip4_0_tos;
251 ip4_1->
tos = ip4_1_tos;
261 ip6_vxlan_header_t *hdr0 = underlay0;
262 ip6_vxlan_header_t *hdr1 = underlay1;
277 udp0->
length = payload_l0;
279 udp1->
length = payload_l1;
284 b0->
flags |= csum_flags;
288 outer_packet_csum_offload_flags);
289 b1->
flags |= csum_flags;
293 outer_packet_csum_offload_flags);
323 (
vm, b0, ip6_0, &bogus);
328 (
vm, b1, ip6_1, &bogus);
338 if (sw_if_index0 == sw_if_index1)
341 sw_if_index0, 2, len0 + len1);
346 sw_if_index0, 1, len0);
348 sw_if_index1, 1, len1);
350 pkts_encapsulated += 2;
369 to_next, n_left_to_next,
370 bi0, bi1, next0, next1);
375 u32 bi0 = to_next[0] =
from[0];
384 if (csum_offload && (b0->
flags & VNET_BUFFER_F_OFFLOAD))
387 if ((b0->
flags & VNET_BUFFER_F_GSO) == 0)
391 VNET_BUFFER_F_IS_IP4,
393 VNET_BUFFER_F_IS_IP6);
394 b0->
flags &= ~inner_packet_removed_flags;
413 ASSERT (t0->rewrite_header.data_bytes == underlay_hdr_len);
421 u16 payload_l0 = clib_host_to_net_u16 (len0 - l3_len);
430 ip4_vxlan_header_t *hdr = underlay0;
434 ip4_0->
length = clib_host_to_net_u16 (len0);
439 ip4_0->
tos = ip4_0_tos;
447 ip6_vxlan_header_t *hdr = underlay0;
458 udp0->
length = payload_l0;
463 b0->
flags |= csum_flags;
467 outer_packet_csum_offload_flags);
488 (
vm, b0, ip6_0, &bogus);
498 sw_if_index0, 1, len0);
509 to_next, n_left_to_next,
518 VXLAN_ENCAP_ERROR_ENCAPSULATED,
545 .name =
"vxlan4-encap",
546 .vector_size =
sizeof (
u32),
558 .name =
"vxlan6-encap",
559 .vector_size =
sizeof (
u32),
u16 dpoi_next_node
The next VLIB node to follow.
vnet_interface_main_t * im
index_t dpoi_index
the index of objects of that type
vlib_buffer_t * bufs[VLIB_FRAME_SIZE]
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
u16 ip6_tcp_udp_icmp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip6_header_t *ip0, int *bogus_lengthp)
@ VNET_INTERFACE_COUNTER_TX
nat44_ei_hairpin_src_next_t next_index
vlib_get_buffers(vm, from, b, n_left_from)
@ VLIB_NODE_TYPE_INTERNAL
vlib_main_t vlib_node_runtime_t * node
static_always_inline void vnet_buffer_offload_flags_set(vlib_buffer_t *b, vnet_buffer_oflags_t oflags)
u8 * format_vxlan_encap_trace(u8 *s, va_list *args)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
vlib_main_t vlib_node_runtime_t vlib_frame_t * from_frame
static_always_inline void vnet_calc_checksums_inline(vlib_main_t *vm, vlib_buffer_t *b, int is_ip4, int is_ip6)
static uword vxlan_encap_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, u8 is_ip4, u8 csum_offload)
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
#define CLIB_PREFETCH(addr, size, type)
u8 qos_bits_t
Type, er, safety for us water based entities.
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
#define VLIB_NODE_FN(node)
static_always_inline uword vlib_get_thread_index(void)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
#define STATIC_ASSERT_SIZEOF(d, s)
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
#define CLIB_CACHE_LINE_BYTES
struct _vlib_node_registration vlib_node_registration_t
vlib_combined_counter_main_t * combined_sw_if_counters
vlib_node_registration_t vxlan6_encap_node
(constructor) VLIB_REGISTER_NODE (vxlan6_encap_node)
#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.
description fragment has unexpected format
A collection of combined counters.
vlib_put_next_frame(vm, node, next_index, 0)
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
#define vnet_rewrite_two_headers(rw0, rw1, p0, p1, most_likely_size)
#define ip_csum_update(sum, old, new, type, field)
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static char * vxlan_encap_error_strings[]
#define vnet_rewrite_one_header(rw0, p0, most_likely_size)
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
Finish enqueueing two buffers forward in the graph.
vlib_node_registration_t vxlan4_encap_node
(constructor) VLIB_REGISTER_NODE (vxlan4_encap_node)
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
#define foreach_vxlan_encap_error
vl_api_interface_index_t sw_if_index
#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 u16 ip_csum_fold(ip_csum_t c)
vl_api_fib_path_type_t type
vnet_interface_main_t interface_main
vlib_increment_combined_counter(ccm, ti, sw_if_index, n_buffers, n_bytes)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
VLIB buffer representation.
#define VLIB_REGISTER_NODE(x,...)