[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v5 02/26] vhost: Fix last queue index of devices with no cvq
From: |
Eugenio Pérez |
Subject: |
[RFC PATCH v5 02/26] vhost: Fix last queue index of devices with no cvq |
Date: |
Fri, 29 Oct 2021 20:35:01 +0200 |
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
- [RFC PATCH v5 00/26] vDPA shadow virtqueue, Eugenio Pérez, 2021/10/29
- [RFC PATCH v5 01/26] util: Make some iova_tree parameters const, Eugenio Pérez, 2021/10/29
- [RFC PATCH v5 02/26] vhost: Fix last queue index of devices with no cvq,
Eugenio Pérez <=
- [RFC PATCH v5 03/26] virtio: Add VIRTIO_F_QUEUE_STATE, Eugenio Pérez, 2021/10/29
- [RFC PATCH v5 04/26] virtio-net: Honor VIRTIO_CONFIG_S_DEVICE_STOPPED, Eugenio Pérez, 2021/10/29
- [RFC PATCH v5 05/26] vhost: Add x-vhost-set-shadow-vq qmp, Eugenio Pérez, 2021/10/29
- [RFC PATCH v5 06/26] vhost: Add VhostShadowVirtqueue, Eugenio Pérez, 2021/10/29
- [RFC PATCH v5 07/26] vdpa: Save kick_fd in vhost-vdpa, Eugenio Pérez, 2021/10/29
- [RFC PATCH v5 08/26] vdpa: Add vhost_svq_get_dev_kick_notifier, Eugenio Pérez, 2021/10/29
- [RFC PATCH v5 09/26] vdpa: Add vhost_svq_set_svq_kick_fd, Eugenio Pérez, 2021/10/29
- [RFC PATCH v5 10/26] vhost: Add Shadow VirtQueue kick forwarding capabilities, Eugenio Pérez, 2021/10/29
- [RFC PATCH v5 11/26] vhost: Handle host notifiers in SVQ, Eugenio Pérez, 2021/10/29
- [RFC PATCH v5 12/26] vhost: Route guest->host notification through shadow virtqueue, Eugenio Pérez, 2021/10/29