#include <vnet/fib/ip4_fib.h>
#include <vppinfra/error.h>
#include <nat/nat.h>
+#include <nat/nat_inlines.h>
typedef struct
{
vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b = bufs;
snat_main_t *sm = &snat_main;
- snat_get_worker_function_t *get_worker;
u32 fq_index, thread_index = vm->thread_index;
from = vlib_frame_vector_args (frame);
if (is_in2out)
{
fq_index = is_output ? sm->fq_in2out_output_index : sm->fq_in2out_index;
- get_worker = sm->worker_in2out_cb;
}
else
{
fq_index = sm->fq_out2in_index;
- get_worker = sm->worker_out2in_cb;
}
while (n_left_from >= 4)
rx_fib_index2 = ip4_fib_table_get_index_for_sw_if_index (sw_if_index2);
rx_fib_index3 = ip4_fib_table_get_index_for_sw_if_index (sw_if_index3);
- ti[0] = get_worker (ip0, rx_fib_index0, is_output);
- ti[1] = get_worker (ip1, rx_fib_index1, is_output);
- ti[2] = get_worker (ip2, rx_fib_index2, is_output);
- ti[3] = get_worker (ip3, rx_fib_index3, is_output);
+ if (is_in2out)
+ {
+ ti[0] = sm->worker_in2out_cb (ip0, rx_fib_index0, is_output);
+ ti[1] = sm->worker_in2out_cb (ip1, rx_fib_index1, is_output);
+ ti[2] = sm->worker_in2out_cb (ip2, rx_fib_index2, is_output);
+ ti[3] = sm->worker_in2out_cb (ip3, rx_fib_index3, is_output);
+ }
+ else
+ {
+ ti[0] = sm->worker_out2in_cb (b[0], ip0, rx_fib_index0, is_output);
+ ti[1] = sm->worker_out2in_cb (b[1], ip1, rx_fib_index1, is_output);
+ ti[2] = sm->worker_out2in_cb (b[2], ip2, rx_fib_index2, is_output);
+ ti[3] = sm->worker_out2in_cb (b[3], ip3, rx_fib_index3, is_output);
+ }
if (ti[0] == thread_index)
same_worker++;
sw_if_index0 = vnet_buffer (b[0])->sw_if_index[VLIB_RX];
rx_fib_index0 = ip4_fib_table_get_index_for_sw_if_index (sw_if_index0);
- ti[0] = get_worker (ip0, rx_fib_index0, is_output);
+ if (is_in2out)
+ {
+ ti[0] = sm->worker_in2out_cb (ip0, rx_fib_index0, is_output);
+ }
+ else
+ {
+ ti[0] = sm->worker_out2in_cb (b[0], ip0, rx_fib_index0, is_output);
+ }
if (ti[0] == thread_index)
same_worker++;
VLIB_REGISTER_NODE (snat_in2out_worker_handoff_node) = {
.name = "nat44-in2out-worker-handoff",
.vector_size = sizeof (u32),
+ .sibling_of = "nat-default",
.format_trace = format_nat44_handoff_trace,
.type = VLIB_NODE_TYPE_INTERNAL,
.n_errors = ARRAY_LEN(nat44_handoff_error_strings),
.error_strings = nat44_handoff_error_strings,
- .n_next_nodes = 1,
- .next_nodes = {
- [0] = "error-drop",
- },
};
/* *INDENT-ON* */
VLIB_REGISTER_NODE (snat_in2out_output_worker_handoff_node) = {
.name = "nat44-in2out-output-worker-handoff",
.vector_size = sizeof (u32),
+ .sibling_of = "nat-default",
.format_trace = format_nat44_handoff_trace,
.type = VLIB_NODE_TYPE_INTERNAL,
.n_errors = ARRAY_LEN(nat44_handoff_error_strings),
.error_strings = nat44_handoff_error_strings,
- .n_next_nodes = 1,
- .next_nodes = {
- [0] = "error-drop",
- },
};
/* *INDENT-ON* */
VLIB_REGISTER_NODE (snat_out2in_worker_handoff_node) = {
.name = "nat44-out2in-worker-handoff",
.vector_size = sizeof (u32),
+ .sibling_of = "nat-default",
.format_trace = format_nat44_handoff_trace,
.type = VLIB_NODE_TYPE_INTERNAL,
.n_errors = ARRAY_LEN(nat44_handoff_error_strings),
.error_strings = nat44_handoff_error_strings,
- .n_next_nodes = 1,
- .next_nodes = {
- [0] = "error-drop",
- },
};
/* *INDENT-ON* */