Skip to content

vdpa: Return -EIO if device ack is VIRTIO_NET_ERR

Hawkins Jiawei qemu-devel 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 6 repliesIn review
  2. v21 patch 1 replySuperseded
  3. v1 RFC1 patch 4 repliesSuperseded

Changes in v3 from the cover letter

- split the fixes suggested by Eugenio
- return -EIO suggested by Michael

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3vdpa: Return -EIO if device ack is VIRTIO_NET_ERR in _load_mac()net/vhost-vdpa.c+3 -20 replies
2/3vdpa: Return -EIO if device ack is VIRTIO_NET_ERR in _load_mq()net/vhost-vdpa.c+4 -10 replies
3/3vdpa: Return -EIO if device ack is VIRTIO_NET_ERR in _load_offloads()net/vhost-vdpa.c+4 -10 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchJason WangEugenio PérezLei Yang
SeriesT-b
1/3A-b A-b
2/3A-b A-b
3/3A-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v3 thread

Cover letter [PATCH v3 0/3] vdpa: Return -EIO if device ack is VIRTIO_NET_ERR

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_x() 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 patchset fixes this problem by returning -EIO when the device's ack is not VIRTIO_NET_OK.

Changelog
=========
v3:
- split the fixes suggested by Eugenio
- return -EIO suggested by Michael

v2: https://lore.kernel.org/all/69010e9ebb5e3729aef595ed92840f43e48e53e5.1687875592.git.yin31149@gmail.com/
- fix the same bug in vhost_vdpa_net_load_offloads()

v1: https://lore.kernel.org/all/[email protected]/

Hawkins Jiawei (3):
vdpa: Return -EIO if device ack is VIRTIO_NET_ERR in _load_mac()
vdpa: Return -EIO if device ack is VIRTIO_NET_ERR in _load_mq()
vdpa: Return -EIO if device ack is VIRTIO_NET_ERR in _load_offloads()

 net/vhost-vdpa.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
Signature · 1 line
2.25.1