qemu/net
Hawkins Jiawei f45fd95ec9 vdpa: Return -EIO if device ack is VIRTIO_NET_ERR in _load_mq()
According to VirtIO standard, "The class, command and
command-specific-data are set by the driver,
and the device sets the ack byte.
There is little it can do except issue a diagnostic
if ack is not VIRTIO_NET_OK."

Therefore, QEMU should stop sending the queued SVQ commands and
cancel the device startup if the device's ack is not VIRTIO_NET_OK.

Yet the problem is that, vhost_vdpa_net_load_mq() returns 1 based on
`*s->status != VIRTIO_NET_OK` when the device's ack is VIRTIO_NET_ERR.
As a result, net->nc->info->load() also returns 1, this makes
vhost_net_start_one() incorrectly assume the device state is
successfully loaded by vhost_vdpa_net_load() and return 0, instead of
goto `fail` label to cancel the device startup, as vhost_net_start_one()
only cancels the device startup when net->nc->info->load() returns a
negative value.

This patch fixes this problem by returning -EIO when the device's
ack is not VIRTIO_NET_OK.

Fixes: f64c7cda69 ("vdpa: Add vhost_vdpa_net_load_mq")
Signed-off-by: Hawkins Jiawei <yin31149@gmail.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Acked-by: Eugenio Pérez <eperezma@redhat.com>
Message-Id: <ec515ebb0b4f56368751b9e318e245a5d994fa72.1688438055.git.yin31149@gmail.com>
Tested-by: Lei Yang <leiyang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2023-07-10 18:59:32 -04:00
..
can
announce.c
checksum.c
clients.h
colo-compare.c
colo-compare.h
colo.c
colo.h
dgram.c
dump.c
eth.c
filter-buffer.c
filter-mirror.c
filter-replay.c
filter-rewriter.c
filter.c
hub.c
hub.h
l2tpv3.c
meson.build
net-hmp-cmds.c
net.c
netmap.c
queue.c
slirp.c
socket.c net: socket: remove net_init_socket() 2023-07-07 16:35:12 +08:00
stream.c
tap-bsd.c
tap-linux.c
tap-linux.h
tap-solaris.c
tap-stub.c
tap-win32.c
tap.c
tap_int.h
trace-events
trace.h
util.c
util.h
vde.c
vhost-user-stub.c
vhost-user.c
vhost-vdpa-stub.c
vhost-vdpa.c vdpa: Return -EIO if device ack is VIRTIO_NET_ERR in _load_mq() 2023-07-10 18:59:32 -04:00
vmnet-bridged.m
vmnet-common.m
vmnet-host.c
vmnet-shared.c
vmnet_int.h