slot = (rxq->next - n_refill - 1) & mask;
n_refill &= ~7; /* round to 8 */
- n_alloc = vlib_buffer_alloc_to_ring (vm, rxq->bufs, slot, size, n_refill);
+ n_alloc =
+ vlib_buffer_alloc_to_ring_from_pool (vm, rxq->bufs, slot, size, n_refill,
+ rxq->buffer_pool_index);
if (PREDICT_FALSE (n_alloc != n_refill))
{
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++;
}
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)
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;
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]);
}
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]);
if (PREDICT_FALSE (ad->per_interface_next_index != ~0))
next_index = ad->per_interface_next_index;
+
+ if (PREDICT_FALSE (vnet_device_input_have_features (ad->sw_if_index)))
+ vnet_feature_start_device_input_x1 (ad->sw_if_index, &next_index, bt);
+
vlib_get_new_next_frame (vm, node, next_index, to_next, n_left_to_next);
/* fetch up to AVF_RX_VECTOR_SZ from the rx ring, unflatten them and
or_q1x4 |= q1x4;
u64x4_store_unaligned (q1x4, ptd->qw1s + n_rx_packets);
- clib_memcpy_fast (bi, rxq->bufs + next, 4 * sizeof (u32));
+ vlib_buffer_copy_indices (bi, rxq->bufs + next, 4);
/* next */
next = (next + 4) & mask;
vnet_buffer (bt)->sw_if_index[VLIB_RX] = ad->sw_if_index;
vnet_buffer (bt)->sw_if_index[VLIB_TX] = ~0;
+ bt->buffer_pool_index = rxq->buffer_pool_index;
+ bt->ref_count = 1;
if (n_tail_desc)
n_rx_bytes = avf_process_rx_burst (vm, node, ptd, n_rx_packets, 1);
vlib_trace_buffer (vm, node, next_index, b, /* follow_chain */ 0);
tr = vlib_add_trace (vm, node, b, sizeof (*tr));
tr->next_index = next_index;
+ tr->qid = qid;
tr->hw_if_index = ad->hw_if_index;
tr->qw1s[0] = ptd->qw1s[i];
for (j = 1; j < AVF_RX_MAX_DESC_IN_CHAIN; j++)
vlib_frame_t *f;
ethernet_input_frame_t *ef;
nf = vlib_node_runtime_get_next_frame (vm, node, next_index);
- f = vlib_get_frame (vm, nf->frame_index);
+ f = vlib_get_frame (vm, nf->frame);
f->flags = ETH_INPUT_FRAME_F_SINGLE_SW_IF_IDX;
ef = vlib_frame_scalar_args (f);
if ((or_qw1 & AVF_RXD_ERROR_IPE) == 0)
f->flags |= ETH_INPUT_FRAME_F_IP4_CKSUM_OK;
+ vlib_frame_no_append (f);
}
n_left_to_next -= n_rx_packets;
.state = VLIB_NODE_STATE_DISABLED,
.n_errors = AVF_INPUT_N_ERROR,
.error_strings = avf_input_error_strings,
+ .flags = VLIB_NODE_FLAG_TRACE_SUPPORTED,
};
/* *INDENT-ON* */