nat: nat44-ei configuration improvements
[vpp.git] / src / plugins / nat / nat44-ei / nat44_ei_handoff.c
index 6b8db37..5c16d87 100644 (file)
@@ -83,8 +83,6 @@ nat44_ei_worker_handoff_fn_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
 
   vlib_get_buffers (vm, from, b, n_left_from);
 
-  // TODO: move to nm
-  // TODO: remove callbacks and use inlines that should be moved here
   if (is_in2out)
     {
       fq_index = is_output ? nm->fq_in2out_output_index : nm->fq_in2out_index;
@@ -108,10 +106,10 @@ nat44_ei_worker_handoff_fn_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
          vlib_prefetch_buffer_header (b[5], LOAD);
          vlib_prefetch_buffer_header (b[6], LOAD);
          vlib_prefetch_buffer_header (b[7], LOAD);
-         CLIB_PREFETCH (&b[4]->data, CLIB_CACHE_LINE_BYTES, LOAD);
-         CLIB_PREFETCH (&b[5]->data, CLIB_CACHE_LINE_BYTES, LOAD);
-         CLIB_PREFETCH (&b[6]->data, CLIB_CACHE_LINE_BYTES, LOAD);
-         CLIB_PREFETCH (&b[7]->data, CLIB_CACHE_LINE_BYTES, LOAD);
+         clib_prefetch_load (&b[4]->data);
+         clib_prefetch_load (&b[5]->data);
+         clib_prefetch_load (&b[6]->data);
+         clib_prefetch_load (&b[7]->data);
        }
 
       if (is_output)
@@ -153,17 +151,25 @@ nat44_ei_worker_handoff_fn_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
 
       if (is_in2out)
        {
-         ti[0] = nm->worker_in2out_cb (ip0, rx_fib_index0, is_output);
-         ti[1] = nm->worker_in2out_cb (ip1, rx_fib_index1, is_output);
-         ti[2] = nm->worker_in2out_cb (ip2, rx_fib_index2, is_output);
-         ti[3] = nm->worker_in2out_cb (ip3, rx_fib_index3, is_output);
+         ti[0] =
+           nat44_ei_get_in2out_worker_index (ip0, rx_fib_index0, is_output);
+         ti[1] =
+           nat44_ei_get_in2out_worker_index (ip1, rx_fib_index1, is_output);
+         ti[2] =
+           nat44_ei_get_in2out_worker_index (ip2, rx_fib_index2, is_output);
+         ti[3] =
+           nat44_ei_get_in2out_worker_index (ip3, rx_fib_index3, is_output);
        }
       else
        {
-         ti[0] = nm->worker_out2in_cb (b[0], ip0, rx_fib_index0, is_output);
-         ti[1] = nm->worker_out2in_cb (b[1], ip1, rx_fib_index1, is_output);
-         ti[2] = nm->worker_out2in_cb (b[2], ip2, rx_fib_index2, is_output);
-         ti[3] = nm->worker_out2in_cb (b[3], ip3, rx_fib_index3, is_output);
+         ti[0] = nat44_ei_get_out2in_worker_index (b[0], ip0, rx_fib_index0,
+                                                   is_output);
+         ti[1] = nat44_ei_get_out2in_worker_index (b[1], ip1, rx_fib_index1,
+                                                   is_output);
+         ti[2] = nat44_ei_get_out2in_worker_index (b[2], ip2, rx_fib_index2,
+                                                   is_output);
+         ti[3] = nat44_ei_get_out2in_worker_index (b[3], ip3, rx_fib_index3,
+                                                   is_output);
        }
 
       if (ti[0] == thread_index)
@@ -213,11 +219,13 @@ nat44_ei_worker_handoff_fn_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
 
       if (is_in2out)
        {
-         ti[0] = nm->worker_in2out_cb (ip0, rx_fib_index0, is_output);
+         ti[0] =
+           nat44_ei_get_in2out_worker_index (ip0, rx_fib_index0, is_output);
        }
       else
        {
-         ti[0] = nm->worker_out2in_cb (b[0], ip0, rx_fib_index0, is_output);
+         ti[0] = nat44_ei_get_out2in_worker_index (b[0], ip0, rx_fib_index0,
+                                                   is_output);
        }
 
       if (ti[0] == thread_index)
@@ -255,8 +263,8 @@ nat44_ei_worker_handoff_fn_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
        }
     }
 
-  n_enq = vlib_buffer_enqueue_to_thread (vm, fq_index, from, thread_indices,
-                                        frame->n_vectors, 1);
+  n_enq = vlib_buffer_enqueue_to_thread (vm, node, fq_index, from,
+                                        thread_indices, frame->n_vectors, 1);
 
   if (n_enq < frame->n_vectors)
     {