From: "Eugenio Pérez" <eperezma@redhat.com>
To: qemu-devel@nongnu.org
Cc: Jason Wang <jasowang@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>
Subject: [PATCH] vhost: Fix last queue index of devices with no cvq
Date: Fri, 29 Oct 2021 16:16:08 +0200 [thread overview]
Message-ID: <20211029141608.1728855-1-eperezma@redhat.com> (raw)
The -1 assumes that all devices with no cvq have an spare vq allocated
for them, but with no offer of VIRTIO_NET_F_CTRL_VQ. This may not be the
case, and the device may have a pair number of queues.
To fix this, just resort to the lower even number of queues.
Fixes: 049eb15b5fc9 ("vhost: record the last virtqueue index for the virtio device")
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
hw/net/vhost_net.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 0d888f29a6..edf56a597f 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -330,7 +330,7 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
NetClientState *peer;
if (!cvq) {
- last_index -= 1;
+ last_index &= ~1ULL;
}
if (!k->set_guest_notifiers) {
--
2.27.0
next reply other threads:[~2021-10-29 14:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-29 14:16 Eugenio Pérez [this message]
2021-10-31 21:47 ` [PATCH] vhost: Fix last queue index of devices with no cvq Michael S. Tsirkin
2021-11-01 9:03 ` Eugenio Perez Martin
2021-11-01 9:12 ` Michael S. Tsirkin
2021-11-01 3:33 ` Jason Wang
2021-11-01 8:58 ` Eugenio Perez Martin
2021-11-01 15:42 ` Eugenio Perez Martin
2021-11-01 20:48 ` Michael S. Tsirkin
2021-11-02 6:54 ` Eugenio Perez Martin
2021-11-02 4:08 ` Jason Wang
2021-11-02 6:58 ` Eugenio Perez Martin
2021-11-02 7:04 ` Jason Wang
2021-11-02 10:23 ` Eugenio Perez Martin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211029141608.1728855-1-eperezma@redhat.com \
--to=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).