summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/virtio/device.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2020-10-31 22:47:01 +0100
committerMatthew Smith <mgsmith@netgate.com>2020-11-05 16:33:48 +0000
commit587f9130424fd451e4ba823240d02f655fb197d1 (patch)
tree408f36e2a4604f160e1dade5445662287d0ea25e /src/vnet/devices/virtio/device.c
parent6178bdafa6a318d50cc8ad82f07c6c798c7024ef (diff)
virtio: move retry logic to outer function
Improves compile time.... Type: improvement Change-Id: I310a2e55e5e488a953d65fd065f7795a43d2e9a7 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/devices/virtio/device.c')
-rw-r--r--src/vnet/devices/virtio/device.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/vnet/devices/virtio/device.c b/src/vnet/devices/virtio/device.c
index fe943a9b6d7..29b38a2ed22 100644
--- a/src/vnet/devices/virtio/device.c
+++ b/src/vnet/devices/virtio/device.c
@@ -552,11 +552,6 @@ virtio_interface_tx_gso_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
u16 sz = vring->size;
u16 mask = sz - 1;
u16 n_vectors = n_left;
- u16 retry_count = 2;
-
-retry:
- /* free consumed buffers */
- virtio_free_used_device_desc (vm, vring, node->node_index);
used = vring->desc_in_use;
next = vring->desc_next;
@@ -645,9 +640,6 @@ retry:
virtio_kick (vm, vring, vif);
}
- if (n_left && retry_count--)
- goto retry;
-
return n_left;
}
@@ -701,6 +693,12 @@ VNET_DEVICE_CLASS_TX_FN (virtio_device_class) (vlib_main_t * vm,
buffers = to;
}
+ u16 retry_count = 2;
+
+retry:
+ /* free consumed buffers */
+ virtio_free_used_device_desc (vm, vring, node->node_index);
+
if (vif->type == VIRTIO_IF_TYPE_TAP)
n_left = virtio_interface_tx_inline (vm, node, vif, vring,
VIRTIO_IF_TYPE_TAP, buffers, n_left);
@@ -713,6 +711,9 @@ VNET_DEVICE_CLASS_TX_FN (virtio_device_class) (vlib_main_t * vm,
else
ASSERT (0);
+ if (n_left && retry_count--)
+ goto retry;
+
if (vif->packet_buffering && n_left)
{
u16 n_buffered =