ip: ip4 rewrite prefetch optimization
Type: improvement
ip4_rewrite_inline_with_gso() did vlib_prefetch_buffer_header() for all nodes.
However it is not necessary for ip-rewrite, it is only needed by ip-midchain.
This patch makes ip4-rewrite prefetches less buffers to save cycles.
Signed-off-by: PiotrX Kleski <piotrx.kleski@intel.com>
Change-Id: Ib82dcb0eda4a2d1d7b8d664f2224d49b72aef50f
diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c
index fdc92ca..77ea4c5 100644
--- a/src/vnet/ip/ip4_forward.c
+++ b/src/vnet/ip/ip4_forward.c
@@ -2109,8 +2109,11 @@
u32 tx_sw_if_index0, tx_sw_if_index1;
u8 *p;
- vlib_prefetch_buffer_header (b[6], LOAD);
- vlib_prefetch_buffer_header (b[7], LOAD);
+ if (is_midchain)
+ {
+ vlib_prefetch_buffer_header (b[6], LOAD);
+ vlib_prefetch_buffer_header (b[7], LOAD);
+ }
adj_index0 = vnet_buffer (b[0])->ip.adj_index[VLIB_TX];
adj_index1 = vnet_buffer (b[1])->ip.adj_index[VLIB_TX];