#define foreach_nat64_in2out_error \
_(UNSUPPORTED_PROTOCOL, "unsupported protocol") \
-_(IN2OUT_PACKETS, "good in2out packets processed") \
_(NO_TRANSLATION, "no translation") \
-_(UNKNOWN, "unknown") \
-_(DROP_FRAGMENT, "drop fragment") \
-_(TCP_PACKETS, "TCP packets") \
-_(UDP_PACKETS, "UDP packets") \
-_(ICMP_PACKETS, "ICMP packets") \
-_(OTHER_PACKETS, "other protocol packets") \
-_(FRAGMENTS, "fragments") \
-_(CACHED_FRAGMENTS, "cached fragments") \
-_(PROCESSED_FRAGMENTS, "processed fragments")
+_(UNKNOWN, "unknown")
typedef enum
{
u32 n_left_from, *from, *to_next;
nat64_in2out_next_t next_index;
- u32 pkts_processed = 0;
- u32 stats_node_index;
u32 thread_index = vm->thread_index;
nat64_main_t *nm = &nat64_main;
- u32 tcp_packets = 0, udp_packets = 0, icmp_packets = 0, other_packets =
- 0, fragments = 0;
-
- stats_node_index =
- is_slow_path ? nm->in2out_slowpath_node_index : nm->in2out_node_index;
-
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
next_index = node->cached_next_index;
b0 = vlib_get_buffer (vm, bi0);
ip60 = vlib_buffer_get_current (b0);
+ sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_RX];
+
ctx0.b = b0;
ctx0.vm = vm;
ctx0.thread_index = thread_index;
goto trace0;
}
- sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_RX];
-
if (nat64_not_translate (sw_if_index0, ip60->dst_address))
{
next0 = NAT64_IN2OUT_NEXT_IP6_LOOKUP;
{
if (PREDICT_TRUE (proto0 == NAT_PROTOCOL_OTHER))
{
- other_packets++;
+ vlib_increment_simple_counter (&nm->counters.in2out.other,
+ thread_index, sw_if_index0,
+ 1);
if (is_hairpinning (&ip60->dst_address))
{
next0 = NAT64_IN2OUT_NEXT_IP6_LOOKUP;
if (proto0 == NAT_PROTOCOL_ICMP)
{
- icmp_packets++;
+ vlib_increment_simple_counter (&nm->counters.in2out.icmp,
+ thread_index, sw_if_index0, 1);
if (is_hairpinning (&ip60->dst_address))
{
next0 = NAT64_IN2OUT_NEXT_IP6_LOOKUP;
else if (proto0 == NAT_PROTOCOL_TCP || proto0 == NAT_PROTOCOL_UDP)
{
if (proto0 == NAT_PROTOCOL_TCP)
- tcp_packets++;
+ vlib_increment_simple_counter (&nm->counters.in2out.tcp,
+ thread_index, sw_if_index0, 1);
else
- udp_packets++;
+ vlib_increment_simple_counter (&nm->counters.in2out.udp,
+ thread_index, sw_if_index0, 1);
if (is_hairpinning (&ip60->dst_address))
{
t->is_slow_path = is_slow_path;
}
- pkts_processed += next0 == NAT64_IN2OUT_NEXT_IP4_LOOKUP;
+ if (next0 == NAT64_IN2OUT_NEXT_DROP)
+ {
+ vlib_increment_simple_counter (&nm->counters.in2out.drops,
+ thread_index, sw_if_index0, 1);
+ }
+
/* verify speculative enqueue, maybe switch current next frame */
vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,
}
vlib_put_next_frame (vm, node, next_index, n_left_to_next);
}
- vlib_node_increment_counter (vm, stats_node_index,
- NAT64_IN2OUT_ERROR_IN2OUT_PACKETS,
- pkts_processed);
- vlib_node_increment_counter (vm, stats_node_index,
- NAT64_IN2OUT_ERROR_TCP_PACKETS, tcp_packets);
- vlib_node_increment_counter (vm, stats_node_index,
- NAT64_IN2OUT_ERROR_UDP_PACKETS, udp_packets);
- vlib_node_increment_counter (vm, stats_node_index,
- NAT64_IN2OUT_ERROR_ICMP_PACKETS, icmp_packets);
- vlib_node_increment_counter (vm, stats_node_index,
- NAT64_IN2OUT_ERROR_OTHER_PACKETS,
- other_packets);
- vlib_node_increment_counter (vm, stats_node_index,
- NAT64_IN2OUT_ERROR_FRAGMENTS, fragments);
return frame->n_vectors;
}