aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/virtio/device.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-12-20 10:44:47 +0100
committerDamjan Marion <dmarion@me.com>2019-01-08 17:03:56 +0000
commite40231b1ecf4b49faaa9ce7b615a7d867104825b (patch)
treef7f7b4fed09740dadee4d270ffb68155a06195a1 /src/vnet/devices/virtio/device.c
parent294afe297c74c7c9413c6bd4856e92c9bc439e7c (diff)
virtio: fix kick race issue
Change-Id: I25b2a28513821bc5eab9ac6890a3964d412b0399 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.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/vnet/devices/virtio/device.c b/src/vnet/devices/virtio/device.c
index 2b2c853f3ba..7c66a60cf99 100644
--- a/src/vnet/devices/virtio/device.c
+++ b/src/vnet/devices/virtio/device.c
@@ -169,7 +169,6 @@ add_buffer_to_slot (vlib_main_t * vm, virtio_vring_t * vring, u32 bi,
return n_added;
}
-
static_always_inline uword
virtio_interface_tx_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_frame_t * frame, virtio_if_t * vif)
@@ -184,6 +183,10 @@ virtio_interface_tx_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
clib_spinlock_lock_if_init (&vif->lockp);
+ if ((vring->used->flags & VIRTIO_RING_FLAG_MASK_INT) == 0 &&
+ vring->last_kick_avail_idx != vring->avail->idx)
+ virtio_kick (vring);
+
/* free consumed buffers */
virtio_free_used_desc (vm, vring);
@@ -209,10 +212,7 @@ virtio_interface_tx_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
vring->desc_next = next;
vring->desc_in_use = used;
if ((vring->used->flags & VIRTIO_RING_FLAG_MASK_INT) == 0)
- {
- u64 x = 1;
- CLIB_UNUSED (int r) = write (vring->kick_fd, &x, sizeof (x));
- }
+ virtio_kick (vring);
}