aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/virtio
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/devices/virtio')
-rw-r--r--src/vnet/devices/virtio/device.c4
-rw-r--r--src/vnet/devices/virtio/virtio.h2
2 files changed, 6 insertions, 0 deletions
diff --git a/src/vnet/devices/virtio/device.c b/src/vnet/devices/virtio/device.c
index ae8a116efee..c7efe6519cd 100644
--- a/src/vnet/devices/virtio/device.c
+++ b/src/vnet/devices/virtio/device.c
@@ -182,6 +182,8 @@ virtio_interface_tx_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
u16 mask = sz - 1;
u32 *buffers = vlib_frame_args (frame);
+ clib_spinlock_lock_if_init (&vif->lockp);
+
/* free consumed buffers */
virtio_free_used_desc (vm, vring);
@@ -221,6 +223,8 @@ virtio_interface_tx_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_buffer_free (vm, buffers, n_left);
}
+ clib_spinlock_unlock_if_init (&vif->lockp);
+
return frame->n_vectors - n_left;
}
diff --git a/src/vnet/devices/virtio/virtio.h b/src/vnet/devices/virtio/virtio.h
index 7ffb2ea3dce..5fc521672d9 100644
--- a/src/vnet/devices/virtio/virtio.h
+++ b/src/vnet/devices/virtio/virtio.h
@@ -91,6 +91,8 @@ typedef struct
typedef struct
{
u32 flags;
+ clib_spinlock_t lockp;
+
u32 id;
u32 dev_instance;
u32 hw_if_index;