114 u32 last_tunnel_index = ~0;
115 vxlan4_gpe_tunnel_key_t last_key4;
116 vxlan6_gpe_tunnel_key_t last_key6;
117 u32 pkts_decapsulated = 0;
119 u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
122 clib_memset (&last_key4, 0xff,
sizeof (last_key4));
124 clib_memset (&last_key6, 0xff,
sizeof (last_key6));
130 stats_sw_if_index =
node->runtime_data[0];
131 stats_n_packets = stats_n_bytes = 0;
144 ip4_vxlan_gpe_header_t *iuvn4_0, *iuvn4_1;
145 ip6_vxlan_gpe_header_t *iuvn6_0, *iuvn6_1;
147 u32 tunnel_index0, tunnel_index1;
149 vxlan4_gpe_tunnel_key_t key4_0, key4_1;
150 vxlan6_gpe_tunnel_key_t key6_0, key6_1;
152 u32 sw_if_index0, sw_if_index1, len0, len1;
225 VXLAN_GPE_INPUT_NEXT_DROP;
229 VXLAN_GPE_INPUT_NEXT_DROP;
231 key4_0.local = iuvn4_0->ip4.dst_address.as_u32;
232 key4_1.local = iuvn4_1->ip4.dst_address.as_u32;
234 key4_0.remote = iuvn4_0->ip4.src_address.as_u32;
235 key4_1.remote = iuvn4_1->ip4.src_address.as_u32;
237 key4_0.vni = iuvn4_0->vxlan.vni_res;
238 key4_1.vni = iuvn4_1->vxlan.vni_res;
245 next0 = (iuvn6_0->vxlan.protocol <
node->n_next_nodes) ?
246 iuvn6_0->vxlan.protocol : VXLAN_GPE_INPUT_NEXT_DROP;
247 next1 = (iuvn6_1->vxlan.protocol <
node->n_next_nodes) ?
248 iuvn6_1->vxlan.protocol : VXLAN_GPE_INPUT_NEXT_DROP;
250 key6_0.local.as_u64[0] = iuvn6_0->ip6.dst_address.as_u64[0];
251 key6_0.local.as_u64[1] = iuvn6_0->ip6.dst_address.as_u64[1];
252 key6_1.local.as_u64[0] = iuvn6_1->ip6.dst_address.as_u64[0];
253 key6_1.local.as_u64[1] = iuvn6_1->ip6.dst_address.as_u64[1];
255 key6_0.remote.as_u64[0] = iuvn6_0->ip6.src_address.as_u64[0];
256 key6_0.remote.as_u64[1] = iuvn6_0->ip6.src_address.as_u64[1];
257 key6_1.remote.as_u64[0] = iuvn6_1->ip6.src_address.as_u64[0];
258 key6_1.remote.as_u64[1] = iuvn6_1->ip6.src_address.as_u64[1];
260 key6_0.vni = iuvn6_0->vxlan.vni_res;
261 key6_1.vni = iuvn6_1->vxlan.vni_res;
269 || (key4_0.as_u64[1] !=
270 last_key4.as_u64[1])))
276 error0 = VXLAN_GPE_ERROR_NO_SUCH_TUNNEL;
280 last_key4.as_u64[0] = key4_0.as_u64[0];
281 last_key4.as_u64[1] = key4_0.as_u64[1];
282 tunnel_index0 = last_tunnel_index = p0[0];
285 tunnel_index0 = last_tunnel_index;
292 VXLAN_GPE_INPUT_NEXT_DROP;
296 VXLAN_GPE_INPUT_NEXT_DROP;
298 key6_0.local.as_u64[0] = iuvn6_0->ip6.dst_address.as_u64[0];
299 key6_0.local.as_u64[1] = iuvn6_0->ip6.dst_address.as_u64[1];
300 key6_1.local.as_u64[0] = iuvn6_1->ip6.dst_address.as_u64[0];
301 key6_1.local.as_u64[1] = iuvn6_1->ip6.dst_address.as_u64[1];
303 key6_0.remote.as_u64[0] = iuvn6_0->ip6.src_address.as_u64[0];
304 key6_0.remote.as_u64[1] = iuvn6_0->ip6.src_address.as_u64[1];
305 key6_1.remote.as_u64[0] = iuvn6_1->ip6.src_address.as_u64[0];
306 key6_1.remote.as_u64[1] = iuvn6_1->ip6.src_address.as_u64[1];
308 key6_0.vni = iuvn6_0->vxlan.vni_res;
309 key6_1.vni = iuvn6_1->vxlan.vni_res;
313 (memcmp (&key6_0, &last_key6,
sizeof (last_key6)) != 0))
319 error0 = VXLAN_GPE_ERROR_NO_SUCH_TUNNEL;
323 memcpy (&last_key6, &key6_0,
sizeof (key6_0));
324 tunnel_index0 = last_tunnel_index = p0[0];
327 tunnel_index0 = last_tunnel_index;
348 stats_n_packets += 1;
349 stats_n_bytes += len0;
353 stats_n_packets -= 1;
354 stats_n_bytes -= len0;
363 stats_n_bytes = len0;
364 stats_sw_if_index = sw_if_index0;
367 trace0:b0->
error = error0 ?
node->errors[error0] : 0;
383 || (key4_1.as_u64[1] !=
384 last_key4.as_u64[1])))
390 error1 = VXLAN_GPE_ERROR_NO_SUCH_TUNNEL;
394 last_key4.as_u64[0] = key4_1.as_u64[0];
395 last_key4.as_u64[1] = key4_1.as_u64[1];
396 tunnel_index1 = last_tunnel_index = p1[0];
399 tunnel_index1 = last_tunnel_index;
405 (memcmp (&key6_1, &last_key6,
sizeof (last_key6)) != 0))
411 error1 = VXLAN_GPE_ERROR_NO_SUCH_TUNNEL;
415 memcpy (&last_key6, &key6_1,
sizeof (key6_1));
416 tunnel_index1 = last_tunnel_index = p1[0];
419 tunnel_index1 = last_tunnel_index;
439 stats_n_packets += 1;
440 stats_n_bytes += len1;
446 stats_n_packets -= 1;
447 stats_n_bytes -= len1;
456 stats_n_bytes = len1;
457 stats_sw_if_index = sw_if_index1;
461 trace1:b1->
error = error1 ?
node->errors[error1] : 0;
473 n_left_to_next, bi0, bi1, next0,
482 ip4_vxlan_gpe_header_t *iuvn4_0;
483 ip6_vxlan_gpe_header_t *iuvn6_0;
487 vxlan4_gpe_tunnel_key_t key4_0;
488 vxlan6_gpe_tunnel_key_t key6_0;
490 u32 sw_if_index0, len0;
534 VXLAN_GPE_INPUT_NEXT_DROP;
536 key4_0.local = iuvn4_0->ip4.dst_address.as_u32;
537 key4_0.remote = iuvn4_0->ip4.src_address.as_u32;
538 key4_0.vni = iuvn4_0->vxlan.vni_res;
543 || (key4_0.as_u64[1] !=
544 last_key4.as_u64[1])))
550 error0 = VXLAN_GPE_ERROR_NO_SUCH_TUNNEL;
554 last_key4.as_u64[0] = key4_0.as_u64[0];
555 last_key4.as_u64[1] = key4_0.as_u64[1];
556 tunnel_index0 = last_tunnel_index = p0[0];
559 tunnel_index0 = last_tunnel_index;
566 VXLAN_GPE_INPUT_NEXT_DROP;
568 key6_0.local.as_u64[0] = iuvn6_0->ip6.dst_address.as_u64[0];
569 key6_0.local.as_u64[1] = iuvn6_0->ip6.dst_address.as_u64[1];
570 key6_0.remote.as_u64[0] = iuvn6_0->ip6.src_address.as_u64[0];
571 key6_0.remote.as_u64[1] = iuvn6_0->ip6.src_address.as_u64[1];
572 key6_0.vni = iuvn6_0->vxlan.vni_res;
576 (memcmp (&key6_0, &last_key6,
sizeof (last_key6)) != 0))
582 error0 = VXLAN_GPE_ERROR_NO_SUCH_TUNNEL;
586 memcpy (&last_key6, &key6_0,
sizeof (key6_0));
587 tunnel_index0 = last_tunnel_index = p0[0];
590 tunnel_index0 = last_tunnel_index;
611 stats_n_packets += 1;
612 stats_n_bytes += len0;
618 stats_n_packets -= 1;
619 stats_n_bytes -= len0;
628 stats_n_bytes = len0;
629 stats_sw_if_index = sw_if_index0;
632 trace00:b0->
error = error0 ?
node->errors[error0] : 0;
643 n_left_to_next, bi0, next0);
652 VXLAN_GPE_ERROR_DECAPSULATED,
661 stats_n_packets, stats_n_bytes);
662 node->runtime_data[0] = stats_sw_if_index;
685 #ifndef CLIB_MARCH_VARIANT
725 #define vxlan_gpe_error(n,s) s,
727 #undef vxlan_gpe_error
733 .name =
"vxlan4-gpe-input",
735 .vector_size =
sizeof (
u32),
742 #define _(s,n) [VXLAN_GPE_INPUT_NEXT_##s] = n,
755 .name =
"vxlan6-gpe-input",
757 .vector_size =
sizeof (
u32),
764 #define _(s,n) [VXLAN_GPE_INPUT_NEXT_##s] = n,
791 vtep4_key_t last_vtep4;
793 vtep6_key_t last_vtep6;
821 u32 bi0, ip_len0, udp_len0, flags0, next0;
822 u32 bi1, ip_len1, udp_len1, flags1, next1;
823 i32 len_diff0, len_diff1;
824 u8 error0, good_udp0, proto0;
825 u8 error1, good_udp1, proto1;
836 bi0 = to_next[0] =
from[0];
837 bi1 = to_next[1] =
from[1];
873 if (proto0 != IP_PROTOCOL_UDP)
881 if (udp0->
dst_port != clib_host_to_net_u16 (UDP_DST_PORT_VXLAN_GPE))
887 #ifdef CLIB_HAVE_VEC512
888 if (!vtep4_check_vector (&ngm->
vtep_table, b0, ip40, &last_vtep4,
902 good_udp0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
909 ip_len0 = clib_net_to_host_u16 (ip40->
length);
912 udp_len0 = clib_net_to_host_u16 (udp0->
length);
913 len_diff0 = ip_len0 - udp_len0;
918 if ((flags0 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
925 (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
931 error0 = good_udp0 ? 0 : IP4_ERROR_UDP_CHECKSUM;
932 error0 = (len_diff0 >= 0) ? error0 : IP4_ERROR_UDP_LENGTH;
936 error0 = good_udp0 ? 0 : IP6_ERROR_UDP_CHECKSUM;
937 error0 = (len_diff0 >= 0) ? error0 : IP6_ERROR_UDP_LENGTH;
942 b0->
error = error0 ? error_node->
errors[error0] : 0;
956 if (proto1 != IP_PROTOCOL_UDP)
964 if (udp1->
dst_port != clib_host_to_net_u16 (UDP_DST_PORT_VXLAN_GPE))
970 #ifdef CLIB_HAVE_VEC512
971 if (!vtep4_check_vector (&ngm->
vtep_table, b1, ip41, &last_vtep4,
985 good_udp1 = (flags1 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
992 ip_len1 = clib_net_to_host_u16 (ip41->
length);
995 udp_len1 = clib_net_to_host_u16 (udp1->
length);
996 len_diff1 = ip_len1 - udp_len1;
1001 if ((flags1 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
1008 (flags1 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
1014 error1 = good_udp1 ? 0 : IP4_ERROR_UDP_CHECKSUM;
1015 error1 = (len_diff1 >= 0) ? error1 : IP4_ERROR_UDP_LENGTH;
1019 error1 = good_udp1 ? 0 : IP6_ERROR_UDP_CHECKSUM;
1020 error1 = (len_diff1 >= 0) ? error1 : IP6_ERROR_UDP_LENGTH;
1025 b1->
error = error1 ? error_node->
errors[error1] : 0;
1039 to_next, n_left_to_next,
1040 bi0, bi1, next0, next1);
1049 u32 bi0, ip_len0, udp_len0, flags0, next0;
1051 u8 error0, good_udp0, proto0;
1053 bi0 = to_next[0] =
from[0];
1057 n_left_to_next -= 1;
1074 if (proto0 != IP_PROTOCOL_UDP)
1082 if (udp0->
dst_port != clib_host_to_net_u16 (UDP_DST_PORT_VXLAN_GPE))
1089 #ifdef CLIB_HAVE_VEC512
1090 if (!vtep4_check_vector (&ngm->
vtep_table, b0, ip40, &last_vtep4,
1104 good_udp0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
1111 ip_len0 = clib_net_to_host_u16 (ip40->
length);
1114 udp_len0 = clib_net_to_host_u16 (udp0->
length);
1115 len_diff0 = ip_len0 - udp_len0;
1120 if ((flags0 & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED) == 0)
1127 (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
1133 error0 = good_udp0 ? 0 : IP4_ERROR_UDP_CHECKSUM;
1134 error0 = (len_diff0 >= 0) ? error0 : IP4_ERROR_UDP_LENGTH;
1138 error0 = good_udp0 ? 0 : IP6_ERROR_UDP_CHECKSUM;
1139 error0 = (len_diff0 >= 0) ? error0 : IP6_ERROR_UDP_LENGTH;
1144 b0->
error = error0 ? error_node->
errors[error0] : 0;
1158 to_next, n_left_to_next,
1165 return frame->n_vectors;
1177 .name =
"ip4-vxlan-gpe-bypass",
1178 .vector_size =
sizeof (
u32),
1191 #ifndef CLIB_MARCH_VARIANT
1211 .name =
"ip6-vxlan-gpe-bypass",
1212 .vector_size =
sizeof (
u32),
1225 #ifndef CLIB_MARCH_VARIANT