nat: add prefetching to in2out_ed/out2in_ed
[vpp.git] / src / plugins / nat / out2in_ed.c
index 8286e66..05fc75f 100644 (file)
@@ -705,6 +705,20 @@ nat44_ed_out2in_fast_path_node_fn_inline (vlib_main_t * vm,
       ip_csum_t sum0;
 
       b0 = *b;
+      b++;
+
+      /* Prefetch next iteration. */
+      if (PREDICT_TRUE (n_left_from >= 2))
+       {
+         vlib_buffer_t *p2;
+
+         p2 = *b;
+
+         vlib_prefetch_buffer_header (p2, LOAD);
+
+         CLIB_PREFETCH (p2->data, CLIB_CACHE_LINE_BYTES, LOAD);
+       }
+
       next[0] = vnet_buffer2 (b0)->nat.arc_next;
 
       vnet_buffer (b0)->snat.flags = 0;
@@ -927,7 +941,6 @@ nat44_ed_out2in_fast_path_node_fn_inline (vlib_main_t * vm,
 
       n_left_from--;
       next++;
-      b++;
     }
 
   vlib_buffer_enqueue_to_next (vm, node, from, (u16 *) nexts,