X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fdevices%2Fvirtio%2Fnode.c;h=339c48c93f56592692b47b3047f0ac96e265c319;hb=067cd6229a47ea3ba8b59a2a04090e80afb5bd2c;hp=5ca06366cad5f6e4234ffc1f3ceac31017bd78a6;hpb=73e7f427e8865b0af71740c5ecfa55c7ee78dbd1;p=vpp.git diff --git a/src/vnet/devices/virtio/node.c b/src/vnet/devices/virtio/node.c index 5ca06366cad..339c48c93f5 100644 --- a/src/vnet/devices/virtio/node.c +++ b/src/vnet/devices/virtio/node.c @@ -83,10 +83,9 @@ static_always_inline void virtio_refill_vring (vlib_main_t * vm, virtio_vring_t * vring) { const int hdr_sz = sizeof (struct virtio_net_hdr_v1); - u16 used, next, avail, n_slots, n_alloc; + u16 used, next, avail, n_slots; u16 sz = vring->size; u16 mask = sz - 1; - int i; used = vring->desc_in_use; @@ -96,14 +95,8 @@ virtio_refill_vring (vlib_main_t * vm, virtio_vring_t * vring) n_slots = sz - used; next = vring->desc_next; avail = vring->avail->idx; - n_alloc = vlib_buffer_alloc (vm, &vring->buffers[next], n_slots); - - if (PREDICT_FALSE (n_alloc < n_slots)) - n_slots = n_alloc; - - i = next + n_slots - sz; - if (PREDICT_FALSE (i > 0)) - clib_memcpy (vring->buffers, &vring->buffers[sz], i * sizeof (u32)); + n_slots = vlib_buffer_alloc_to_ring (vm, vring->buffers, next, vring->size, + n_slots); while (n_slots) { @@ -135,7 +128,7 @@ virtio_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame, virtio_if_t * vif, u16 qid) { vnet_main_t *vnm = vnet_get_main (); - u32 thread_index = vlib_get_thread_index (); + u32 thread_index = vm->thread_index; uword n_trace = vlib_get_trace_count (vm, node); virtio_vring_t *vring = vec_elt_at_index (vif->vrings, 0); u32 next_index = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT;