From e2e9fe5c5f62475577cf8931a8f75135ad292e6a Mon Sep 17 00:00:00 2001 From: Mohsin Kazmi Date: Thu, 17 Dec 2020 15:54:03 +0100 Subject: tap: fix the buffering index for gro Type: fix Fixes: 587f9130424fd451e4ba823240d02f655fb197d1 Change-Id: Ia1739fad6a36fa658aece157d7adea8bbaa751d2 Signed-off-by: Mohsin Kazmi --- src/vnet/devices/virtio/device.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/vnet') diff --git a/src/vnet/devices/virtio/device.c b/src/vnet/devices/virtio/device.c index 5e38d631c77..5796b1d2150 100644 --- a/src/vnet/devices/virtio/device.c +++ b/src/vnet/devices/virtio/device.c @@ -993,6 +993,7 @@ VNET_DEVICE_CLASS_TX_FN (virtio_device_class) (vlib_main_t * vm, u32 *buffers = vlib_frame_vector_args (frame); u32 to[GRO_TO_VECTOR_SIZE (n_left)]; int packed = vif->is_packed; + u16 n_vectors = frame->n_vectors; clib_spinlock_lock_if_init (&vring->lockp); @@ -1004,7 +1005,8 @@ VNET_DEVICE_CLASS_TX_FN (virtio_device_class) (vlib_main_t * vm, if (vif->packet_coalesce) { - n_left = vnet_gro_inline (vm, vring->flow_table, buffers, n_left, to); + n_vectors = n_left = + vnet_gro_inline (vm, vring->flow_table, buffers, n_left, to); buffers = to; } @@ -1017,17 +1019,17 @@ retry: if (vif->type == VIRTIO_IF_TYPE_TAP) n_left = virtio_interface_tx_inline (vm, node, vif, vring, VIRTIO_IF_TYPE_TAP, - &buffers[frame->n_vectors - n_left], + &buffers[n_vectors - n_left], n_left, packed); else if (vif->type == VIRTIO_IF_TYPE_PCI) n_left = virtio_interface_tx_inline (vm, node, vif, vring, VIRTIO_IF_TYPE_PCI, - &buffers[frame->n_vectors - n_left], + &buffers[n_vectors - n_left], n_left, packed); else if (vif->type == VIRTIO_IF_TYPE_TUN) n_left = virtio_interface_tx_inline (vm, node, vif, vring, VIRTIO_IF_TYPE_TUN, - &buffers[frame->n_vectors - n_left], + &buffers[n_vectors - n_left], n_left, packed); else ASSERT (0); @@ -1039,14 +1041,14 @@ retry: { u16 n_buffered = virtio_vring_buffering_store_packets (vring->buffering, &buffers - [frame->n_vectors + [n_vectors - n_left], n_left); n_left -= n_buffered; } if (n_left) virtio_interface_drop_inline (vm, node->node_index, - &buffers[frame->n_vectors - n_left], n_left, + &buffers[n_vectors - n_left], n_left, VIRTIO_TX_ERROR_NO_FREE_SLOTS); clib_spinlock_unlock_if_init (&vring->lockp); -- cgit 1.2.3-korg