aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/virtio/virtio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/devices/virtio/virtio.c')
-rw-r--r--src/vnet/devices/virtio/virtio.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/vnet/devices/virtio/virtio.c b/src/vnet/devices/virtio/virtio.c
index 3867cf03a46..782ede1a525 100644
--- a/src/vnet/devices/virtio/virtio.c
+++ b/src/vnet/devices/virtio/virtio.c
@@ -138,13 +138,13 @@ static_always_inline void
virtio_free_rx_buffers (vlib_main_t * vm, virtio_vring_t * vring)
{
u16 used = vring->desc_in_use;
- u16 next = vring->desc_next;
+ u16 last = vring->last_used_idx;
u16 mask = vring->size - 1;
while (used)
{
- vlib_buffer_free (vm, &vring->buffers[next], 1);
- next = (next + 1) & mask;
+ vlib_buffer_free (vm, &vring->buffers[last & mask], 1);
+ last++;
used--;
}
}