summaryrefslogtreecommitdiffstats
path: root/src/plugins/avf/input.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/avf/input.c')
-rw-r--r--src/plugins/avf/input.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/plugins/avf/input.c b/src/plugins/avf/input.c
index 8072e94346b..b784bf731c1 100644
--- a/src/plugins/avf/input.c
+++ b/src/plugins/avf/input.c
@@ -146,7 +146,7 @@ avf_rx_attach_tail (vlib_main_t * vm, vlib_buffer_t * bt, vlib_buffer_t * b,
b->next_buffer = t->buffers[i];
b->flags |= VLIB_BUFFER_NEXT_PRESENT;
b = vlib_get_buffer (vm, b->next_buffer);
- clib_memcpy_fast (b, bt, sizeof (vlib_buffer_t));
+ vlib_buffer_copy_template (b, bt);
tlnifb += b->current_length = qw1 >> AVF_RXD_LEN_SHIFT;
i++;
}
@@ -161,12 +161,15 @@ avf_process_rx_burst (vlib_main_t * vm, vlib_node_runtime_t * node,
avf_per_thread_data_t * ptd, u32 n_left,
int maybe_multiseg)
{
- vlib_buffer_t *bt = &ptd->buffer_template;
+ vlib_buffer_t bt;
vlib_buffer_t **b = ptd->bufs;
u64 *qw1 = ptd->qw1s;
avf_rx_tail_t *tail = ptd->tails;
uword n_rx_bytes = 0;
+ /* copy template into local variable - will save per packet load */
+ vlib_buffer_copy_template (&bt, &ptd->buffer_template);
+
while (n_left >= 4)
{
if (n_left >= 12)
@@ -177,7 +180,10 @@ avf_process_rx_burst (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_prefetch_buffer_header (b[11], LOAD);
}
- clib_memcpy64_x4 (b[0], b[1], b[2], b[3], bt);
+ vlib_buffer_copy_template (b[0], &bt);
+ vlib_buffer_copy_template (b[1], &bt);
+ vlib_buffer_copy_template (b[2], &bt);
+ vlib_buffer_copy_template (b[3], &bt);
n_rx_bytes += b[0]->current_length = qw1[0] >> AVF_RXD_LEN_SHIFT;
n_rx_bytes += b[1]->current_length = qw1[1] >> AVF_RXD_LEN_SHIFT;
@@ -186,10 +192,10 @@ avf_process_rx_burst (vlib_main_t * vm, vlib_node_runtime_t * node,
if (maybe_multiseg)
{
- n_rx_bytes += avf_rx_attach_tail (vm, bt, b[0], qw1[0], tail + 0);
- n_rx_bytes += avf_rx_attach_tail (vm, bt, b[1], qw1[1], tail + 1);
- n_rx_bytes += avf_rx_attach_tail (vm, bt, b[2], qw1[2], tail + 2);
- n_rx_bytes += avf_rx_attach_tail (vm, bt, b[3], qw1[3], tail + 3);
+ n_rx_bytes += avf_rx_attach_tail (vm, &bt, b[0], qw1[0], tail + 0);
+ n_rx_bytes += avf_rx_attach_tail (vm, &bt, b[1], qw1[1], tail + 1);
+ n_rx_bytes += avf_rx_attach_tail (vm, &bt, b[2], qw1[2], tail + 2);
+ n_rx_bytes += avf_rx_attach_tail (vm, &bt, b[3], qw1[3], tail + 3);
}
VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b[0]);
@@ -205,12 +211,12 @@ avf_process_rx_burst (vlib_main_t * vm, vlib_node_runtime_t * node,
}
while (n_left)
{
- clib_memcpy_fast (b[0], bt, sizeof (vlib_buffer_t));
+ vlib_buffer_copy_template (b[0], &bt);
n_rx_bytes += b[0]->current_length = qw1[0] >> AVF_RXD_LEN_SHIFT;
if (maybe_multiseg)
- n_rx_bytes += avf_rx_attach_tail (vm, bt, b[0], qw1[0], tail + 0);
+ n_rx_bytes += avf_rx_attach_tail (vm, &bt, b[0], qw1[0], tail + 0);
VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b[0]);