aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/virtio/device.c
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2020-12-17 15:54:03 +0100
committerAndrew Yourtchenko <ayourtch@gmail.com>2021-01-05 16:03:04 +0000
commite2e9fe5c5f62475577cf8931a8f75135ad292e6a (patch)
tree15b5432f182ab02eec13bb28c060fdf8f38d84ee /src/vnet/devices/virtio/device.c
parenta210798c407035f09c10c018ebdaf12312161730 (diff)
tap: fix the buffering index for gro
Type: fix Fixes: 587f9130424fd451e4ba823240d02f655fb197d1 Change-Id: Ia1739fad6a36fa658aece157d7adea8bbaa751d2 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vnet/devices/virtio/device.c')
-rw-r--r--src/vnet/devices/virtio/device.c14
1 files changed, 8 insertions, 6 deletions
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);