summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorAndrew Yourtchenko <ayourtch@gmail.com>2018-03-07 17:35:59 +0100
committerDamjan Marion <dmarion.lists@gmail.com>2018-03-11 19:29:27 +0000
commit2ca200501e3e58a8f7d2497ff9ba5a39f2f47014 (patch)
tree6fcf43ff0f53a62f0c4b6e76167ce10d51b74ad6 /src/vnet
parenteeef247aef46684f2537644b9ef1ade2e313437e (diff)
vnet: l2-classify: prefetch (n+2, n+3) rather than (n+1, n+2) inside dual loop code
The dual loop within the L2 classifier processes the (n, n+1) packets, the prefetching was trying to prefetch (n+1, n+2) - thus half of the prefetches were not used - because the next iteration needs (n+2, n+3). Change-Id: I827d20845dbdd0dcdcf463ee25661a7921428992 Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/l2/l2_input_classify.c10
-rw-r--r--src/vnet/l2/l2_output_classify.c10
2 files changed, 10 insertions, 10 deletions
diff --git a/src/vnet/l2/l2_input_classify.c b/src/vnet/l2/l2_input_classify.c
index ee8042a064e..fcf4783bc1e 100644
--- a/src/vnet/l2/l2_input_classify.c
+++ b/src/vnet/l2/l2_input_classify.c
@@ -167,7 +167,7 @@ l2_input_classify_node_fn (vlib_main_t * vm,
/* First pass: compute hash */
- while (n_left_from > 2)
+ while (n_left_from >= 4)
{
vlib_buffer_t *b0, *b1;
u32 bi0, bi1;
@@ -182,15 +182,15 @@ l2_input_classify_node_fn (vlib_main_t * vm,
/* prefetch next iteration */
{
- vlib_buffer_t *p1, *p2;
+ vlib_buffer_t *p2, *p3;
- p1 = vlib_get_buffer (vm, from[1]);
p2 = vlib_get_buffer (vm, from[2]);
+ p3 = vlib_get_buffer (vm, from[3]);
- vlib_prefetch_buffer_header (p1, STORE);
- CLIB_PREFETCH (p1->data, CLIB_CACHE_LINE_BYTES, STORE);
vlib_prefetch_buffer_header (p2, STORE);
CLIB_PREFETCH (p2->data, CLIB_CACHE_LINE_BYTES, STORE);
+ vlib_prefetch_buffer_header (p3, STORE);
+ CLIB_PREFETCH (p3->data, CLIB_CACHE_LINE_BYTES, STORE);
}
bi0 = from[0];
diff --git a/src/vnet/l2/l2_output_classify.c b/src/vnet/l2/l2_output_classify.c
index a49abec2781..338fe849660 100644
--- a/src/vnet/l2/l2_output_classify.c
+++ b/src/vnet/l2/l2_output_classify.c
@@ -160,7 +160,7 @@ l2_output_classify_node_fn (vlib_main_t * vm,
/* First pass: compute hash */
- while (n_left_from > 2)
+ while (n_left_from >= 4)
{
vlib_buffer_t *b0, *b1;
u32 bi0, bi1;
@@ -175,15 +175,15 @@ l2_output_classify_node_fn (vlib_main_t * vm,
/* prefetch next iteration */
{
- vlib_buffer_t *p1, *p2;
+ vlib_buffer_t *p2, *p3;
- p1 = vlib_get_buffer (vm, from[1]);
p2 = vlib_get_buffer (vm, from[2]);
+ p3 = vlib_get_buffer (vm, from[3]);
- vlib_prefetch_buffer_header (p1, STORE);
- CLIB_PREFETCH (p1->data, CLIB_CACHE_LINE_BYTES, STORE);
vlib_prefetch_buffer_header (p2, STORE);
CLIB_PREFETCH (p2->data, CLIB_CACHE_LINE_BYTES, STORE);
+ vlib_prefetch_buffer_header (p3, STORE);
+ CLIB_PREFETCH (p3->data, CLIB_CACHE_LINE_BYTES, STORE);
}
bi0 = from[0];