summaryrefslogtreecommitdiffstats
path: root/src/plugins/memif/device.c
diff options
context:
space:
mode:
authorfangtong <fangtong2007@163.com>2021-06-05 21:45:36 +0800
committerDamjan Marion <dmarion@me.com>2021-06-10 15:13:39 +0000
commitdc9215903809f74bd27cef332a18858711f928a0 (patch)
tree2bb7f01ca7613c5be825cae83c586f599e49ffbe /src/plugins/memif/device.c
parent07d04f7b03077d1b6e93d9a430fedd31bd858023 (diff)
memif: fix the spinlock and unlock issue.
when the configuration of tx queues is larger than the worker-threads, the clib_spinlock_lock_if_init will not be executed, and then this function will executed the clib_spinlock_unlock_if_init, so this may caused the issue. Type: fix Signed-off-by: fangtong <fangtong2007@163.com> Change-Id: I3ce244cd5e1f410e9f14bd060b929238f069b9fa
Diffstat (limited to 'src/plugins/memif/device.c')
-rw-r--r--src/plugins/memif/device.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/memif/device.c b/src/plugins/memif/device.c
index fcbdc0d89ae..8e902feac08 100644
--- a/src/plugins/memif/device.c
+++ b/src/plugins/memif/device.c
@@ -388,11 +388,12 @@ VNET_DEVICE_CLASS_TX_FN (memif_device_class) (vlib_main_t * vm,
{
ASSERT (tx_queues > 0);
mq = vec_elt_at_index (mif->tx_queues, thread_index % tx_queues);
- clib_spinlock_lock_if_init (&mif->lockp);
}
else
mq = vec_elt_at_index (mif->tx_queues, thread_index);
+ clib_spinlock_lock_if_init (&mif->lockp);
+
from = vlib_frame_vector_args (frame);
n_left = frame->n_vectors;
if (mif->flags & MEMIF_IF_FLAG_ZERO_COPY)