nat: nat44-ed add session timing out indicator in api
[vpp.git] / src / plugins / nat / nat44-ed / nat44_ed_handoff.c
index 6715ce2..c5ceff4 100644 (file)
@@ -112,10 +112,10 @@ nat44_worker_handoff_fn_inline (vlib_main_t * vm,
          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)
@@ -157,17 +157,25 @@ nat44_worker_handoff_fn_inline (vlib_main_t * vm,
 
       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);
+         ti[0] = nat44_ed_get_in2out_worker_index (b[0], ip0, rx_fib_index0,
+                                                   is_output);
+         ti[1] = nat44_ed_get_in2out_worker_index (b[1], ip1, rx_fib_index1,
+                                                   is_output);
+         ti[2] = nat44_ed_get_in2out_worker_index (b[2], ip2, rx_fib_index2,
+                                                   is_output);
+         ti[3] = nat44_ed_get_in2out_worker_index (b[3], 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);
+         ti[0] = nat44_ed_get_out2in_worker_index (b[0], ip0, rx_fib_index0,
+                                                   is_output);
+         ti[1] = nat44_ed_get_out2in_worker_index (b[1], ip1, rx_fib_index1,
+                                                   is_output);
+         ti[2] = nat44_ed_get_out2in_worker_index (b[2], ip2, rx_fib_index2,
+                                                   is_output);
+         ti[3] = nat44_ed_get_out2in_worker_index (b[3], ip3, rx_fib_index3,
+                                                   is_output);
        }
 
       if (ti[0] == thread_index)
@@ -218,11 +226,13 @@ nat44_worker_handoff_fn_inline (vlib_main_t * vm,
 
       if (is_in2out)
        {
-         ti[0] = sm->worker_in2out_cb (ip0, rx_fib_index0, is_output);
+         ti[0] = nat44_ed_get_in2out_worker_index (b[0], ip0, rx_fib_index0,
+                                                   is_output);
        }
       else
        {
-         ti[0] = sm->worker_out2in_cb (b[0], ip0, rx_fib_index0, is_output);
+         ti[0] = nat44_ed_get_out2in_worker_index (b[0], ip0, rx_fib_index0,
+                                                   is_output);
        }
 
       if (ti[0] == thread_index)
@@ -260,8 +270,8 @@ nat44_worker_handoff_fn_inline (vlib_main_t * vm,
        }
     }
 
-  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)
     {
@@ -284,7 +294,6 @@ VLIB_NODE_FN (snat_in2out_worker_handoff_node) (vlib_main_t * vm,
   return nat44_worker_handoff_fn_inline (vm, node, frame, 0, 1);
 }
 
-/* *INDENT-OFF* */
 VLIB_REGISTER_NODE (snat_in2out_worker_handoff_node) = {
   .name = "nat44-in2out-worker-handoff",
   .vector_size = sizeof (u32),
@@ -294,7 +303,6 @@ VLIB_REGISTER_NODE (snat_in2out_worker_handoff_node) = {
   .n_errors = ARRAY_LEN(nat44_handoff_error_strings),
   .error_strings = nat44_handoff_error_strings,
 };
-/* *INDENT-ON* */
 
 VLIB_NODE_FN (snat_in2out_output_worker_handoff_node) (vlib_main_t * vm,
                                                       vlib_node_runtime_t *
@@ -304,7 +312,6 @@ VLIB_NODE_FN (snat_in2out_output_worker_handoff_node) (vlib_main_t * vm,
   return nat44_worker_handoff_fn_inline (vm, node, frame, 1, 1);
 }
 
-/* *INDENT-OFF* */
 VLIB_REGISTER_NODE (snat_in2out_output_worker_handoff_node) = {
   .name = "nat44-in2out-output-worker-handoff",
   .vector_size = sizeof (u32),
@@ -314,7 +321,6 @@ VLIB_REGISTER_NODE (snat_in2out_output_worker_handoff_node) = {
   .n_errors = ARRAY_LEN(nat44_handoff_error_strings),
   .error_strings = nat44_handoff_error_strings,
 };
-/* *INDENT-ON* */
 
 VLIB_NODE_FN (snat_out2in_worker_handoff_node) (vlib_main_t * vm,
                                                vlib_node_runtime_t * node,
@@ -323,7 +329,6 @@ VLIB_NODE_FN (snat_out2in_worker_handoff_node) (vlib_main_t * vm,
   return nat44_worker_handoff_fn_inline (vm, node, frame, 0, 0);
 }
 
-/* *INDENT-OFF* */
 VLIB_REGISTER_NODE (snat_out2in_worker_handoff_node) = {
   .name = "nat44-out2in-worker-handoff",
   .vector_size = sizeof (u32),
@@ -333,7 +338,6 @@ VLIB_REGISTER_NODE (snat_out2in_worker_handoff_node) = {
   .n_errors = ARRAY_LEN(nat44_handoff_error_strings),
   .error_strings = nat44_handoff_error_strings,
 };
-/* *INDENT-ON* */
 
 /*
  * fd.io coding-style-patch-verification: ON