aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/virtio/vhost_user_output.c
diff options
context:
space:
mode:
authorSteven Luong <sluong@cisco.com>2020-12-10 20:44:22 -0800
committerDamjan Marion <dmarion@me.com>2020-12-25 11:45:09 +0000
commit2c1084a69bccac812bf2d763b113d1e5b7f08686 (patch)
tree5581bd1ac229153b373777e34d36fa5738f48de7 /src/vnet/devices/virtio/vhost_user_output.c
parent05bc31be20849e5994eb798d9eed0ad506a57d18 (diff)
virtio: Extend vhost multi-queues support beyond 8 queue pairs
Current vhost multi-queues support has a hard limit of 8 queue pairs due to static vring array. This limit was raised in qemu. VPP should support more than 8 queue pairs also. Change static vring allocation to dynamic. When the interface is created, we allocate 8 queue pairs to begin with. We also keep track of how many queue pairs that the interface actually uses. We reply VHOST_USER_GET_QUEUE_NUM with 128 as our maximum number of support queue pair. When qemu starts initializing queue pair greater than 8, we expand the vrings as needed on demand. Type: improvement Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I4a02d987d52d1bbe601b00e71f650fe6ebfcc0d7
Diffstat (limited to 'src/vnet/devices/virtio/vhost_user_output.c')
-rw-r--r--src/vnet/devices/virtio/vhost_user_output.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/vnet/devices/virtio/vhost_user_output.c b/src/vnet/devices/virtio/vhost_user_output.c
index 85ac0a3c295..80eefa6d9ed 100644
--- a/src/vnet/devices/virtio/vhost_user_output.c
+++ b/src/vnet/devices/virtio/vhost_user_output.c
@@ -119,23 +119,12 @@ vhost_user_name_renumber (vnet_hw_interface_t * hi, u32 new_dev_instance)
}
/**
- * @brief Try once to lock the vring
- * @return 0 on success, non-zero on failure.
- */
-static_always_inline int
-vhost_user_vring_try_lock (vhost_user_intf_t * vui, u32 qid)
-{
- return clib_atomic_test_and_set (vui->vring_locks[qid]);
-}
-
-/**
* @brief Spin until the vring is successfully locked
*/
static_always_inline void
vhost_user_vring_lock (vhost_user_intf_t * vui, u32 qid)
{
- while (vhost_user_vring_try_lock (vui, qid))
- ;
+ clib_spinlock_lock_if_init (&vui->vrings[qid].vring_lock);
}
/**
@@ -144,7 +133,7 @@ vhost_user_vring_lock (vhost_user_intf_t * vui, u32 qid)
static_always_inline void
vhost_user_vring_unlock (vhost_user_intf_t * vui, u32 qid)
{
- clib_atomic_release (vui->vring_locks[qid]);
+ clib_spinlock_unlock_if_init (&vui->vrings[qid].vring_lock);
}
static_always_inline void