Commit e8003b3a authored by Xiaoguang Wang's avatar Xiaoguang Wang Committed by Tomasz Zawadzki
Browse files

lib/virtio: set vring state to be 1 explicitly when enabling queue



We're developing a new spdk bdev engine bdev_virtio_fs, which is
similar to bdev_virtio_blk. This new engine will connect virtiofsd[1]
with vhost-user protocol, we'll submit patches later.

Currently virtiofsd reports an error when spdk and virtiofsd do protocol
negotiations:
    Waiting for daemon failed: HandleRequest(InvalidParam)

The root cause is that when handling VHOST_USER_SET_VRING_ENABLE message,
virtiofsd only take 0 or 1 as valid value, other values will be considered
as invalid. In qemu's docs/interop/vhost-user.rst, there's such
comments:
    If VHOST_USER_F_PROTOCOL_FEATURES has been negotiated, the
    ring is initialized in a disabled state and is enabled by
    VHOST_USER_SET_VRING_ENABLE with parameter 1.

also in qemu's codes, when enabling vring, it'll set vhost_vring_state's
num to 1, so currently qemu can work with virtiofsd correctly.

To fix this incompatibility issue, set vring state to be 1 explicitly
in spdk codes.

Change-Id: Ic603110bda69f7898cc22e31b8759fdb1a0bc20e
Signed-off-by: default avatarXiaoguang Wang <lege.wang@jaguarmicro.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/20453


Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent e85f1f11
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -902,7 +902,7 @@ virtio_user_setup_queue(struct virtio_dev *vdev, struct virtqueue *vq)
	vq->vq_ring_virt_mem = queue_mem;

	state.index = vq->vq_queue_index;
	state.num = vq->vq_nentries;
	state.num = 1;

	if (virtio_dev_has_feature(vdev, VHOST_USER_F_PROTOCOL_FEATURES)) {
		rc = vhost_user_sock(dev, VHOST_USER_SET_VRING_ENABLE, &state);