|
|
586cba |
From 9e737aba614e94da4458f02d4ff97e95ffffd19f Mon Sep 17 00:00:00 2001
|
|
|
24c150 |
From: Si-Wei Liu <si-wei.liu@oracle.com>
|
|
|
24c150 |
Date: Fri, 6 May 2022 19:28:12 -0700
|
|
|
586cba |
Subject: [PATCH 08/16] virtio-net: setup vhost_dev and notifiers for cvq only
|
|
|
24c150 |
when feature is negotiated
|
|
|
24c150 |
MIME-Version: 1.0
|
|
|
24c150 |
Content-Type: text/plain; charset=UTF-8
|
|
|
24c150 |
Content-Transfer-Encoding: 8bit
|
|
|
24c150 |
|
|
|
586cba |
RH-Author: Jason Wang <jasowang@redhat.com>
|
|
|
586cba |
RH-MergeRequest: 98: Multiqueue fixes for vhost-vDPA
|
|
|
586cba |
RH-Commit: [1/7] a5c5a2862b2e4d15ef7c09da3e4234fdef37cc66 (jasowang/qemu-kvm-cs)
|
|
|
586cba |
RH-Bugzilla: 2070804
|
|
|
24c150 |
RH-Acked-by: Eugenio PĂ©rez <eperezma@redhat.com>
|
|
|
586cba |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
586cba |
RH-Acked-by: Cindy Lu <lulu@redhat.com>
|
|
|
24c150 |
|
|
|
24c150 |
When the control virtqueue feature is absent or not negotiated,
|
|
|
24c150 |
vhost_net_start() still tries to set up vhost_dev and install
|
|
|
24c150 |
vhost notifiers for the control virtqueue, which results in
|
|
|
24c150 |
erroneous ioctl calls with incorrect queue index sending down
|
|
|
24c150 |
to driver. Do that only when needed.
|
|
|
24c150 |
|
|
|
24c150 |
Fixes: 22288fe ("virtio-net: vhost control virtqueue support")
|
|
|
24c150 |
Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
|
|
|
24c150 |
Acked-by: Jason Wang <jasowang@redhat.com>
|
|
|
24c150 |
Message-Id: <1651890498-24478-2-git-send-email-si-wei.liu@oracle.com>
|
|
|
24c150 |
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
24c150 |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
24c150 |
(cherry picked from commit aa8581945a13712ff3eed0ad3ba7a9664fc1604b)
|
|
|
586cba |
Signed-off-by: Jason Wang <jasowang@redhat.com>
|
|
|
24c150 |
---
|
|
|
24c150 |
hw/net/virtio-net.c | 3 ++-
|
|
|
24c150 |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
24c150 |
|
|
|
24c150 |
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
|
|
|
586cba |
index 1067e72b39..ffb3475201 100644
|
|
|
24c150 |
--- a/hw/net/virtio-net.c
|
|
|
24c150 |
+++ b/hw/net/virtio-net.c
|
|
|
586cba |
@@ -245,7 +245,8 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status)
|
|
|
24c150 |
VirtIODevice *vdev = VIRTIO_DEVICE(n);
|
|
|
24c150 |
NetClientState *nc = qemu_get_queue(n->nic);
|
|
|
24c150 |
int queue_pairs = n->multiqueue ? n->max_queue_pairs : 1;
|
|
|
24c150 |
- int cvq = n->max_ncs - n->max_queue_pairs;
|
|
|
24c150 |
+ int cvq = virtio_vdev_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ) ?
|
|
|
24c150 |
+ n->max_ncs - n->max_queue_pairs : 0;
|
|
|
24c150 |
|
|
|
24c150 |
if (!get_vhost_net(nc->peer)) {
|
|
|
24c150 |
return;
|
|
|
24c150 |
--
|
|
|
24c150 |
2.31.1
|
|
|
24c150 |
|