aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/tap/tap.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-02-16 16:13:32 +0100
committerDamjan Marion <dmarion.lists@gmail.com>2018-02-19 16:40:01 +0000
commit829ee5399504478901be245914333fdf704131c2 (patch)
treeab90fccc9477294b53d511fcddd1e96cc645a06c /src/vnet/devices/tap/tap.c
parentb5a86eed8bd889f5c8986e5fa569a50b997ccd77 (diff)
virtio: add missing tx lock when running multithreaded
Change-Id: I373f429c53c6f66ad38322addcfaccddb7761392 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/devices/tap/tap.c')
-rw-r--r--src/vnet/devices/tap/tap.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c
index e6a7ba518a6..de6107a589b 100644
--- a/src/vnet/devices/tap/tap.c
+++ b/src/vnet/devices/tap/tap.c
@@ -80,6 +80,7 @@ void
tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args)
{
vnet_main_t *vnm = vnet_get_main ();
+ vlib_thread_main_t *thm = vlib_get_thread_main ();
virtio_main_t *vim = &virtio_main;
tap_main_t *tm = &tap_main;
vnet_sw_interface_t *sw;
@@ -397,6 +398,8 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args)
vif->flags |= VIRTIO_IF_FLAG_ADMIN_UP;
vnet_hw_interface_set_flags (vnm, vif->hw_if_index,
VNET_HW_INTERFACE_FLAG_LINK_UP);
+ if (thm->n_vlib_mains > 1)
+ clib_spinlock_init (&vif->lockp);
goto done;
error:
@@ -453,6 +456,7 @@ tap_delete_if (vlib_main_t * vm, u32 sw_if_index)
vec_free (vif->vrings);
hash_unset (tm->dev_instance_by_interface_id, vif->id);
+ clib_spinlock_free (&vif->lockp);
memset (vif, 0, sizeof (*vif));
pool_put (mm->interfaces, vif);