|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
23 #define foreach_geneve_encap_error \
24 _(ENCAPSULATED, "good packets encapsulated")
27 #define _(sym,string) string,
34 #define _(sym,str) GENEVE_ENCAP_ERROR_##sym,
46 #define foreach_fixed_header4_offset \
49 #define foreach_fixed_header6_offset \
50 _(0) _(1) _(2) _(3) _(4) _(5) _(6)
61 u32 pkts_encapsulated = 0;
62 u16 old_l0 = 0, old_l1 = 0;
64 u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
65 u32 sw_if_index0 = ~0, sw_if_index1 = ~0;
66 u32 next0 = 0, next1 = 0;
76 stats_sw_if_index =
node->runtime_data[0];
77 stats_n_packets = stats_n_bytes = 0;
88 u32 flow_hash0, flow_hash1;
93 u64 *copy_src0, *copy_dst0;
94 u64 *copy_src1, *copy_dst1;
95 u32 *copy_src_last0, *copy_dst_last0;
96 u32 *copy_src_last1, *copy_dst_last1;
158 u8 ip4_geneve_base_header_len =
161 u8 ip4_geneve_header_total_len0 = ip4_geneve_base_header_len;
162 u8 ip4_geneve_header_total_len1 = ip4_geneve_base_header_len;
163 #if SUPPORT_OPTIONS_HEADER==1
164 ip4_geneve_header_total_len0 += t0->options_len;
165 ip4_geneve_header_total_len1 += t1->options_len;
168 ASSERT (
vec_len (t1->rewrite) == ip4_geneve_header_total_len1);
174 copy_dst0 = (
u64 *) ip4_0;
176 copy_dst1 = (
u64 *) ip4_1;
177 copy_src1 = (
u64 *) t1->rewrite;
179 #define _(offs) copy_dst0[offs] = copy_src0[offs];
182 #define _(offs) copy_dst1[offs] = copy_src1[offs];
186 copy_dst_last0 = (
u32 *) (©_dst0[4]);
187 copy_src_last0 = (
u32 *) (©_src0[4]);
188 copy_dst_last0[0] = copy_src_last0[0];
189 copy_dst_last1 = (
u32 *) (©_dst1[4]);
190 copy_src_last1 = (
u32 *) (©_src1[4]);
191 copy_dst_last1[0] = copy_src_last1[0];
227 u8 ip6_geneve_base_header_len =
230 u8 ip6_geneve_header_total_len0 = ip6_geneve_base_header_len;
231 u8 ip6_geneve_header_total_len1 = ip6_geneve_base_header_len;
232 #if SUPPORT_OPTIONS_HEADER==1
233 ip6_geneve_header_total_len0 += t0->options_len;
234 ip6_geneve_header_total_len1 += t1->options_len;
237 ASSERT (
vec_len (t1->rewrite) == ip6_geneve_header_total_len1);
243 copy_dst0 = (
u64 *) ip6_0;
245 copy_dst1 = (
u64 *) ip6_1;
246 copy_src1 = (
u64 *) t1->rewrite;
248 #define _(offs) copy_dst0[offs] = copy_src0[offs];
251 #define _(offs) copy_dst1[offs] = copy_src1[offs];
287 pkts_encapsulated += 2;
290 stats_n_packets += 2;
291 stats_n_bytes += len0 + len1;
302 (sw_if_index1 != stats_sw_if_index)))
304 stats_n_packets -= 2;
305 stats_n_bytes -= len0 + len1;
306 if (sw_if_index0 == sw_if_index1)
312 stats_sw_if_index, stats_n_packets, stats_n_bytes);
313 stats_sw_if_index = sw_if_index0;
315 stats_n_bytes = len0 + len1;
346 to_next, n_left_to_next,
347 bi0, bi1, next0, next1);
358 u64 *copy_src0, *copy_dst0;
359 u32 *copy_src_last0, *copy_dst_last0;
391 u8 ip4_geneve_base_header_len =
394 u8 ip4_geneve_header_total_len0 = ip4_geneve_base_header_len;
395 #if SUPPORT_OPTIONS_HEADER==1
396 ip4_geneve_header_total_len0 += t0->options_len;
403 copy_dst0 = (
u64 *) ip4_0;
406 #define _(offs) copy_dst0[offs] = copy_src0[offs];
410 copy_dst_last0 = (
u32 *) (©_dst0[4]);
411 copy_src_last0 = (
u32 *) (©_src0[4]);
412 copy_dst_last0[0] = copy_src_last0[0];
436 u8 ip6_geneve_base_header_len =
439 u8 ip6_geneve_header_total_len0 = ip6_geneve_base_header_len;
440 #if SUPPORT_OPTIONS_HEADER==1
441 ip6_geneve_header_total_len0 += t0->options_len;
447 copy_dst0 = (
u64 *) ip6_0;
450 #define _(offs) copy_dst0[offs] = copy_src0[offs];
475 stats_n_packets += 1;
476 stats_n_bytes += len0;
487 stats_n_packets -= 1;
488 stats_n_bytes -= len0;
493 stats_n_packets, stats_n_bytes);
495 stats_n_bytes = len0;
496 stats_sw_if_index = sw_if_index0;
509 to_next, n_left_to_next,
518 GENEVE_ENCAP_ERROR_ENCAPSULATED,
526 thread_index, stats_sw_if_index, stats_n_packets, stats_n_bytes);
527 node->runtime_data[0] = stats_sw_if_index;
549 .name =
"geneve4-encap",
550 .vector_size =
sizeof (
u32),
562 .name =
"geneve6-encap",
563 .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
#define foreach_fixed_header4_offset
vlib_main_t vlib_node_runtime_t * node
vlib_node_registration_t geneve6_encap_node
(constructor) VLIB_REGISTER_NODE (geneve6_encap_node)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
geneve_main_t geneve_main
static uword geneve_encap_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame, u32 is_ip4)
vlib_main_t vlib_node_runtime_t vlib_frame_t * from_frame
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)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define VLIB_NODE_FN(node)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
u8 * format_geneve_encap_trace(u8 *s, va_list *args)
static char * geneve_encap_error_strings[]
#define ALWAYS_ASSERT(truth)
#define foreach_fixed_header6_offset
#define CLIB_CACHE_LINE_BYTES
struct _vlib_node_registration vlib_node_registration_t
vlib_combined_counter_main_t * combined_sw_if_counters
#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.
geneve_tunnel_t * tunnels
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 foreach_geneve_encap_error
#define GENEVE_BASE_HEADER_LENGTH
#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.
#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.
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)
vlib_node_registration_t geneve4_encap_node
(constructor) VLIB_REGISTER_NODE (geneve4_encap_node)
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)
VLIB buffer representation.
#define VLIB_REGISTER_NODE(x,...)
vl_api_wireguard_peer_flags_t flags