- /*
- * avoid wrap-around logic in core loop
- * we requested VLIB_FRAME_SIZE packets and rxq->size >= VLIB_FRAME_SIZE
- * => we can process all packets in 2 iterations max
- */
- slot = rxq->head & (rxq->size - 1);
- n_tail = clib_min (n_rx_packets, rxq->size - slot);
- n_rx_bytes =
- rdma_device_input_bufs (vm, rd, &to_next[0], &rxq->bufs[slot], wc, n_tail,
- &bt);
- if (n_tail < n_rx_packets)
- n_rx_bytes +=
- rdma_device_input_bufs (vm, rd, &to_next[n_tail], &rxq->bufs[0],
- &wc[n_tail], n_rx_packets - n_tail, &bt);
+ vlib_buffer_copy_indices_from_ring (to_next, rxq->bufs, rxq->head & mask,
+ rxq->size, n_rx_packets);
+ n_rx_bytes = rdma_device_input_bufs (vm, rd, to_next, wc, n_rx_packets,
+ &bt);
+