} nat44_handoff_trace_t;
#define foreach_nat44_handoff_error \
-_(CONGESTION_DROP, "congestion drop")
+_(CONGESTION_DROP, "congestion drop") \
+_(SAME_WORKER, "same worker") \
+_(DO_HANDOFF, "do handoff")
typedef enum
{
};
-vlib_node_registration_t snat_in2out_worker_handoff_node;
-vlib_node_registration_t snat_in2out_output_worker_handoff_node;
-vlib_node_registration_t snat_out2in_worker_handoff_node;
-
static u8 *
format_nat44_handoff_trace (u8 * s, va_list * args)
{
u16 thread_indices[VLIB_FRAME_SIZE], *ti;
u32 fq_index;
snat_get_worker_function_t *get_worker;
+ u32 thread_index = vm->thread_index;
+ u32 do_handoff = 0, same_worker = 0;
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
ip0 = vlib_buffer_get_current (b[0]);
ti[0] = get_worker (ip0, rx_fib_index0);
+ if (ti[0] != thread_index)
+ do_handoff++;
+ else
+ same_worker++;
+
if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE)
&& (b[0]->flags & VLIB_BUFFER_IS_TRACED)))
{
vlib_node_increment_counter (vm, node->node_index,
NAT44_HANDOFF_ERROR_CONGESTION_DROP,
frame->n_vectors - n_enq);
+ vlib_node_increment_counter (vm, node->node_index,
+ NAT44_HANDOFF_ERROR_SAME_WORKER, same_worker);
+ vlib_node_increment_counter (vm, node->node_index,
+ NAT44_HANDOFF_ERROR_DO_HANDOFF, do_handoff);
return frame->n_vectors;
}
-static uword
-snat_in2out_worker_handoff_fn (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+VLIB_NODE_FN (snat_in2out_worker_handoff_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return nat44_worker_handoff_fn_inline (vm, node, frame, 0, 1);
}
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (snat_in2out_worker_handoff_node) = {
- .function = snat_in2out_worker_handoff_fn,
.name = "nat44-in2out-worker-handoff",
.vector_size = sizeof (u32),
.format_trace = format_nat44_handoff_trace,
};
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (snat_in2out_worker_handoff_node,
- snat_in2out_worker_handoff_fn);
-
-static uword
-snat_in2out_output_worker_handoff_fn (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+VLIB_NODE_FN (snat_in2out_output_worker_handoff_node) (vlib_main_t * vm,
+ vlib_node_runtime_t *
+ node,
+ vlib_frame_t * frame)
{
return nat44_worker_handoff_fn_inline (vm, node, frame, 1, 1);
}
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (snat_in2out_output_worker_handoff_node) = {
- .function = snat_in2out_output_worker_handoff_fn,
.name = "nat44-in2out-output-worker-handoff",
.vector_size = sizeof (u32),
.format_trace = format_nat44_handoff_trace,
};
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (snat_in2out_output_worker_handoff_node,
- snat_in2out_output_worker_handoff_fn);
-
-static uword
-snat_out2in_worker_handoff_fn (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+VLIB_NODE_FN (snat_out2in_worker_handoff_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return nat44_worker_handoff_fn_inline (vm, node, frame, 0, 0);
}
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (snat_out2in_worker_handoff_node) = {
- .function = snat_out2in_worker_handoff_fn,
.name = "nat44-out2in-worker-handoff",
.vector_size = sizeof (u32),
.format_trace = format_nat44_handoff_trace,
};
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (snat_out2in_worker_handoff_node,
- snat_out2in_worker_handoff_fn);
-
/*
* fd.io coding-style-patch-verification: ON
*