summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/virtio/virtio.h
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/virtio.h
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/virtio.h')
-rw-r--r--src/vnet/devices/virtio/virtio.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/vnet/devices/virtio/virtio.h b/src/vnet/devices/virtio/virtio.h
index e401f2ddcd7..841441bd0c6 100644
--- a/src/vnet/devices/virtio/virtio.h
+++ b/src/vnet/devices/virtio/virtio.h
@@ -87,6 +87,7 @@ typedef struct
u32 call_file_index;
u32 *buffers;
u16 last_used_idx;
+ u16 last_kick_avail_idx;
} virtio_vring_t;
typedef struct
@@ -137,6 +138,16 @@ extern void virtio_free_used_desc (vlib_main_t * vm, virtio_vring_t * vring);
format_function_t format_virtio_device_name;
+static_always_inline void
+virtio_kick (virtio_vring_t * vring)
+{
+ u64 x = 1;
+ int __clib_unused r;
+
+ r = write (vring->kick_fd, &x, sizeof (x));
+ vring->last_kick_avail_idx = vring->avail->idx;
+}
+
#endif /* _VNET_DEVICES_VIRTIO_VIRTIO_H_ */
/*