mirror of
https://github.com/mii443/qemu.git
synced 2025-12-04 19:48:31 +00:00
vhost-user: do not send RESET_OWNER on device reset
The VHOST_USER_RESET_OWNER message is deprecated in the spec:
This is no longer used. Used to be sent to request disabling all
rings, but some back-ends interpreted it to also discard connection
state (this interpretation would lead to bugs). It is recommended
that back-ends either ignore this message, or use it to disable all
rings.
The only caller of vhost_user_reset_device() is vhost_user_scsi_reset().
It checks that F_RESET_DEVICE was negotiated before calling it:
static void vhost_user_scsi_reset(VirtIODevice *vdev)
{
VHostSCSICommon *vsc = VHOST_SCSI_COMMON(vdev);
struct vhost_dev *dev = &vsc->dev;
/*
* Historically, reset was not implemented so only reset devices
* that are expecting it.
*/
if (!virtio_has_feature(dev->protocol_features,
VHOST_USER_PROTOCOL_F_RESET_DEVICE)) {
return;
}
if (dev->vhost_ops->vhost_reset_device) {
dev->vhost_ops->vhost_reset_device(dev);
}
}
Therefore VHOST_USER_RESET_OWNER is actually never sent by
vhost_user_reset_device(). Remove the dead code. This effectively moves
the vhost-user protocol specific code from vhost-user-scsi.c into
vhost-user.c where it belongs.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20231004014532.1228637-2-stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
This commit is contained in:
committed by
Michael S. Tsirkin
parent
b15c18c519
commit
22d2464f7e
@@ -67,15 +67,6 @@ static void vhost_user_scsi_reset(VirtIODevice *vdev)
|
|||||||
VHostSCSICommon *vsc = VHOST_SCSI_COMMON(vdev);
|
VHostSCSICommon *vsc = VHOST_SCSI_COMMON(vdev);
|
||||||
struct vhost_dev *dev = &vsc->dev;
|
struct vhost_dev *dev = &vsc->dev;
|
||||||
|
|
||||||
/*
|
|
||||||
* Historically, reset was not implemented so only reset devices
|
|
||||||
* that are expecting it.
|
|
||||||
*/
|
|
||||||
if (!virtio_has_feature(dev->protocol_features,
|
|
||||||
VHOST_USER_PROTOCOL_F_RESET_DEVICE)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dev->vhost_ops->vhost_reset_device) {
|
if (dev->vhost_ops->vhost_reset_device) {
|
||||||
dev->vhost_ops->vhost_reset_device(dev);
|
dev->vhost_ops->vhost_reset_device(dev);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1482,12 +1482,17 @@ static int vhost_user_reset_device(struct vhost_dev *dev)
|
|||||||
{
|
{
|
||||||
VhostUserMsg msg = {
|
VhostUserMsg msg = {
|
||||||
.hdr.flags = VHOST_USER_VERSION,
|
.hdr.flags = VHOST_USER_VERSION,
|
||||||
|
.hdr.request = VHOST_USER_RESET_DEVICE,
|
||||||
};
|
};
|
||||||
|
|
||||||
msg.hdr.request = virtio_has_feature(dev->protocol_features,
|
/*
|
||||||
VHOST_USER_PROTOCOL_F_RESET_DEVICE)
|
* Historically, reset was not implemented so only reset devices
|
||||||
? VHOST_USER_RESET_DEVICE
|
* that are expecting it.
|
||||||
: VHOST_USER_RESET_OWNER;
|
*/
|
||||||
|
if (!virtio_has_feature(dev->protocol_features,
|
||||||
|
VHOST_USER_PROTOCOL_F_RESET_DEVICE)) {
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
return vhost_user_write(dev, &msg, NULL, 0);
|
return vhost_user_write(dev, &msg, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user