aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip/ip4_forward.c
diff options
context:
space:
mode:
authorPiotrX Kleski <piotrx.kleski@intel.com>2020-12-09 14:32:26 +0100
committerDamjan Marion <dmarion@me.com>2020-12-11 23:29:59 +0000
commitb801cd1b31e44e9e90f4619db0cad4ab661019e5 (patch)
tree6fa8fc4a54fef7493cbffdc023540fb633dd8206 /src/vnet/ip/ip4_forward.c
parent32526a42c59f076e356c3690306b8bcaa80d999d (diff)
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
Diffstat (limited to 'src/vnet/ip/ip4_forward.c')
-rw-r--r--src/vnet/ip/ip4_forward.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c
index fdc92ca16f8..77ea4c5524e 100644
--- a/src/vnet/ip/ip4_forward.c
+++ b/src/vnet/ip/ip4_forward.c
@@ -2109,8 +2109,11 @@ ip4_rewrite_inline_with_gso (vlib_main_t * vm,
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];