39 "GENEVE decap from geneve_tunnel%d vni %d next %d error %d",
44 s =
format (s,
"GENEVE decap error - tunnel for vni %d does not exist",
78 u32 last_tunnel_index = ~0;
79 geneve4_tunnel_key_t last_key4;
80 geneve6_tunnel_key_t last_key6;
81 u32 pkts_decapsulated = 0;
83 u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
87 last_key4.as_u64 = ~0;
96 stats_sw_if_index =
node->runtime_data[0];
97 stats_n_packets = stats_n_bytes = 0;
113 u32 tunnel_index0, tunnel_index1;
115 geneve4_tunnel_key_t key4_0, key4_1;
116 geneve6_tunnel_key_t key6_0, key6_1;
118 u32 sw_if_index0, sw_if_index1, len0, len1;
201 error0 = GENEVE_ERROR_BAD_FLAGS;
202 next0 = GENEVE_INPUT_NEXT_DROP;
205 #if SUPPORT_OPTIONS_HEADER==1
208 error0 = GENEVE_ERROR_BAD_FLAGS;
209 next0 = GENEVE_INPUT_NEXT_DROP;
224 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
225 next0 = GENEVE_INPUT_NEXT_DROP;
228 last_key4.as_u64 = key4_0.as_u64;
229 tunnel_index0 = last_tunnel_index = p0[0];
232 tunnel_index0 = last_tunnel_index;
238 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
239 next0 = GENEVE_INPUT_NEXT_DROP;
260 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
261 next0 = GENEVE_INPUT_NEXT_DROP;
267 key6_0.remote.as_u64[0] = ip6_0->
src_address.as_u64[0];
268 key6_0.remote.as_u64[1] = ip6_0->
src_address.as_u64[1];
273 (memcmp (&key6_0, &last_key6,
sizeof (last_key6)) != 0))
278 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
279 next0 = GENEVE_INPUT_NEXT_DROP;
283 tunnel_index0 = last_tunnel_index = p0[0];
286 tunnel_index0 = last_tunnel_index;
292 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
293 next0 = GENEVE_INPUT_NEXT_DROP;
304 key6_0.remote.as_u64[0] = ip6_0->
dst_address.as_u64[0];
305 key6_0.remote.as_u64[1] = ip6_0->
dst_address.as_u64[1];
314 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
315 next0 = GENEVE_INPUT_NEXT_DROP;
330 sw_if_index0 = (mt0) ? mt0->
sw_if_index : sw_if_index0;
333 stats_n_packets += 1;
334 stats_n_bytes += len0;
340 stats_n_packets -= 1;
341 stats_n_bytes -= len0;
346 stats_n_packets, stats_n_bytes);
348 stats_n_bytes = len0;
349 stats_sw_if_index = sw_if_index0;
353 b0->
error = error0 ?
node->errors[error0] : 0;
368 error1 = GENEVE_ERROR_BAD_FLAGS;
369 next1 = GENEVE_INPUT_NEXT_DROP;
372 #if SUPPORT_OPTIONS_HEADER==1
375 error1 = GENEVE_ERROR_BAD_FLAGS;
376 next1 = GENEVE_INPUT_NEXT_DROP;
391 error1 = GENEVE_ERROR_NO_SUCH_TUNNEL;
392 next1 = GENEVE_INPUT_NEXT_DROP;
395 last_key4.as_u64 = key4_1.as_u64;
396 tunnel_index1 = last_tunnel_index = p1[0];
399 tunnel_index1 = last_tunnel_index;
405 error1 = GENEVE_ERROR_NO_SUCH_TUNNEL;
406 next1 = GENEVE_INPUT_NEXT_DROP;
427 error1 = GENEVE_ERROR_NO_SUCH_TUNNEL;
428 next1 = GENEVE_INPUT_NEXT_DROP;
434 key6_1.remote.as_u64[0] = ip6_1->
src_address.as_u64[0];
435 key6_1.remote.as_u64[1] = ip6_1->
src_address.as_u64[1];
440 (memcmp (&key6_1, &last_key6,
sizeof (last_key6)) != 0))
446 error1 = GENEVE_ERROR_NO_SUCH_TUNNEL;
447 next1 = GENEVE_INPUT_NEXT_DROP;
452 tunnel_index1 = last_tunnel_index = p1[0];
455 tunnel_index1 = last_tunnel_index;
461 error1 = GENEVE_ERROR_NO_SUCH_TUNNEL;
462 next1 = GENEVE_INPUT_NEXT_DROP;
473 key6_1.remote.as_u64[0] = ip6_1->
dst_address.as_u64[0];
474 key6_1.remote.as_u64[1] = ip6_1->
dst_address.as_u64[1];
483 error1 = GENEVE_ERROR_NO_SUCH_TUNNEL;
484 next1 = GENEVE_INPUT_NEXT_DROP;
499 sw_if_index1 = (mt1) ? mt1->sw_if_index : sw_if_index1;
502 stats_n_packets += 1;
503 stats_n_bytes += len1;
509 stats_n_packets -= 1;
510 stats_n_bytes -= len1;
515 stats_n_packets, stats_n_bytes);
517 stats_n_bytes = len1;
518 stats_sw_if_index = sw_if_index1;
522 b1->
error = error1 ?
node->errors[error1] : 0;
535 to_next, n_left_to_next,
536 bi0, bi1, next0, next1);
550 geneve4_tunnel_key_t key4_0;
551 geneve6_tunnel_key_t key6_0;
553 u32 sw_if_index0, len0;
606 error0 = GENEVE_ERROR_BAD_FLAGS;
607 next0 = GENEVE_INPUT_NEXT_DROP;
610 #if SUPPORT_OPTIONS_HEADER==1
613 error0 = GENEVE_ERROR_BAD_FLAGS;
614 next0 = GENEVE_INPUT_NEXT_DROP;
629 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
630 next0 = GENEVE_INPUT_NEXT_DROP;
633 last_key4.as_u64 = key4_0.as_u64;
634 tunnel_index0 = last_tunnel_index = p0[0];
637 tunnel_index0 = last_tunnel_index;
643 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
644 next0 = GENEVE_INPUT_NEXT_DROP;
665 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
666 next0 = GENEVE_INPUT_NEXT_DROP;
672 key6_0.remote.as_u64[0] = ip6_0->
src_address.as_u64[0];
673 key6_0.remote.as_u64[1] = ip6_0->
src_address.as_u64[1];
678 (memcmp (&key6_0, &last_key6,
sizeof (last_key6)) != 0))
683 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
684 next0 = GENEVE_INPUT_NEXT_DROP;
688 tunnel_index0 = last_tunnel_index = p0[0];
691 tunnel_index0 = last_tunnel_index;
697 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
698 next0 = GENEVE_INPUT_NEXT_DROP;
709 key6_0.remote.as_u64[0] = ip6_0->
dst_address.as_u64[0];
710 key6_0.remote.as_u64[1] = ip6_0->
dst_address.as_u64[1];
719 error0 = GENEVE_ERROR_NO_SUCH_TUNNEL;
720 next0 = GENEVE_INPUT_NEXT_DROP;
735 sw_if_index0 = (mt0) ? mt0->
sw_if_index : sw_if_index0;
738 stats_n_packets += 1;
739 stats_n_bytes += len0;
745 stats_n_packets -= 1;
746 stats_n_bytes -= len0;
751 stats_n_packets, stats_n_bytes);
753 stats_n_bytes = len0;
754 stats_sw_if_index = sw_if_index0;
758 b0->
error = error0 ?
node->errors[error0] : 0;
770 to_next, n_left_to_next,
780 GENEVE_ERROR_DECAPSULATED, pkts_decapsulated);
787 thread_index, stats_sw_if_index, stats_n_packets, stats_n_bytes);
788 node->runtime_data[0] = stats_sw_if_index;
809 #define geneve_error(n,s) s,
817 .name =
"geneve4-input",
819 .vector_size =
sizeof (
u32),
824 #define _(s,n) [GENEVE_INPUT_NEXT_##s] = n,
835 .name =
"geneve6-input",
837 .vector_size =
sizeof (
u32),
842 #define _(s,n) [GENEVE_INPUT_NEXT_##s] = n,
868 vtep4_key_t last_vtep4;
870 vtep6_key_t last_vtep6;
898 u32 bi0, ip_len0, udp_len0, flags0, next0;
899 u32 bi1, ip_len1, udp_len1, flags1, next1;
900 i32 len_diff0, len_diff1;
901 u8 error0, good_udp0, proto0;
902 u8 error1, good_udp1, proto1;
913 bi0 = to_next[0] =
from[0];
914 bi1 = to_next[1] =
from[1];
952 if (proto0 != IP_PROTOCOL_UDP)
960 if (udp0->
dst_port != clib_host_to_net_u16 (UDP_DST_PORT_geneve))
966 #ifdef CLIB_HAVE_VEC512
967 if (!vtep4_check_vector (&vxm->
vtep_table, b0, ip40, &last_vtep4,
981 good_udp0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
988 ip_len0 = clib_net_to_host_u16 (ip40->
length);
991 udp_len0 = clib_net_to_host_u16 (udp0->
length);
992 len_diff0 = ip_len0 - udp_len0;
997 if ((flags0 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
1004 (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
1010 error0 = good_udp0 ? 0 : IP4_ERROR_UDP_CHECKSUM;
1011 error0 = (len_diff0 >= 0) ? error0 : IP4_ERROR_UDP_LENGTH;
1015 error0 = good_udp0 ? 0 : IP6_ERROR_UDP_CHECKSUM;
1016 error0 = (len_diff0 >= 0) ? error0 : IP6_ERROR_UDP_LENGTH;
1021 b0->
error = error0 ? error_node->
errors[error0] : 0;
1035 if (proto1 != IP_PROTOCOL_UDP)
1043 if (udp1->
dst_port != clib_host_to_net_u16 (UDP_DST_PORT_geneve))
1049 #ifdef CLIB_HAVE_VEC512
1050 if (!vtep4_check_vector (&vxm->
vtep_table, b1, ip41, &last_vtep4,
1064 good_udp1 = (flags1 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
1071 ip_len1 = clib_net_to_host_u16 (ip41->
length);
1074 udp_len1 = clib_net_to_host_u16 (udp1->
length);
1075 len_diff1 = ip_len1 - udp_len1;
1080 if ((flags1 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
1087 (flags1 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
1093 error1 = good_udp1 ? 0 : IP4_ERROR_UDP_CHECKSUM;
1094 error1 = (len_diff1 >= 0) ? error1 : IP4_ERROR_UDP_LENGTH;
1098 error1 = good_udp1 ? 0 : IP6_ERROR_UDP_CHECKSUM;
1099 error1 = (len_diff1 >= 0) ? error1 : IP6_ERROR_UDP_LENGTH;
1104 b1->
error = error1 ? error_node->
errors[error1] : 0;
1118 to_next, n_left_to_next,
1119 bi0, bi1, next0, next1);
1128 u32 bi0, ip_len0, udp_len0, flags0, next0;
1130 u8 error0, good_udp0, proto0;
1132 bi0 = to_next[0] =
from[0];
1136 n_left_to_next -= 1;
1155 if (proto0 != IP_PROTOCOL_UDP)
1163 if (udp0->
dst_port != clib_host_to_net_u16 (UDP_DST_PORT_geneve))
1169 #ifdef CLIB_HAVE_VEC512
1170 if (!vtep4_check_vector (&vxm->
vtep_table, b0, ip40, &last_vtep4,
1184 good_udp0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
1191 ip_len0 = clib_net_to_host_u16 (ip40->
length);
1194 udp_len0 = clib_net_to_host_u16 (udp0->
length);
1195 len_diff0 = ip_len0 - udp_len0;
1200 if ((flags0 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
1207 (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
1213 error0 = good_udp0 ? 0 : IP4_ERROR_UDP_CHECKSUM;
1214 error0 = (len_diff0 >= 0) ? error0 : IP4_ERROR_UDP_LENGTH;
1218 error0 = good_udp0 ? 0 : IP6_ERROR_UDP_CHECKSUM;
1219 error0 = (len_diff0 >= 0) ? error0 : IP6_ERROR_UDP_LENGTH;
1224 b0->
error = error0 ? error_node->
errors[error0] : 0;
1238 to_next, n_left_to_next,
1245 return frame->n_vectors;
1258 .name =
"ip4-geneve-bypass",
1259 .vector_size =
sizeof (
u32),
1280 .name =
"ip6-geneve-bypass",
1281 .vector_size =
sizeof (
u32),