- vlib_get_next_frame(vm, node, next, to_next, n_left_to_next);
-
- while (n_left_to_next) { // Fill at most one vector
- vlib_buffer_t *b_first, *b, *prev;
- u32 bi_first, bi;
- word n_bytes_in_packet;
- int j, n_bytes_left;
-
- if (PREDICT_FALSE(vec_len(tm->threads[thread_index].rx_buffers) <
- tm->mtu_buffers)) {
- uword len = vec_len(tm->threads[thread_index].rx_buffers);
- _vec_len(tm->threads[thread_index].rx_buffers) +=
- vlib_buffer_alloc_from_free_list(vm, &tm->threads[thread_index].rx_buffers[len],
- VLIB_FRAME_SIZE - len, VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX);
- if (PREDICT_FALSE(vec_len(tm->threads[thread_index].rx_buffers) <
- tm->mtu_buffers)) {
- vlib_node_increment_counter(vm, tapcli_rx_node.index,
- TAPCLI_ERROR_BUFFER_ALLOC,
- tm->mtu_buffers -
- vec_len(tm->threads[thread_index].rx_buffers));
- break;
- }
- }
-
- uword i_rx = vec_len (tm->threads[thread_index].rx_buffers) - 1;
-
- /* Allocate RX buffers from end of rx_buffers.
- Turn them into iovecs to pass to readv. */
- vec_validate (tm->threads[thread_index].iovecs, tm->mtu_buffers - 1);
- for (j = 0; j < tm->mtu_buffers; j++) {
- b = vlib_get_buffer (vm, tm->threads[thread_index].rx_buffers[i_rx - j]);
- tm->threads[thread_index].iovecs[j].iov_base = b->data;
- tm->threads[thread_index].iovecs[j].iov_len = buffer_size;
- }