qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vhost: Fix last queue index of devices with no cvq
@ 2021-10-29 14:16 Eugenio Pérez
  2021-10-31 21:47 ` Michael S. Tsirkin
  2021-11-01  3:33 ` Jason Wang
  0 siblings, 2 replies; 13+ messages in thread
From: Eugenio Pérez @ 2021-10-29 14:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jason Wang, Michael S. Tsirkin

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



^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-11-02 10:26 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-29 14:16 [PATCH] vhost: Fix last queue index of devices with no cvq Eugenio Pérez
2021-10-31 21:47 ` 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

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).