[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v2 5/5] virtio-net: handle force_modern for vhost
From: |
Halil Pasic |
Subject: |
[RFC PATCH v2 5/5] virtio-net: handle force_modern for vhost |
Date: |
Fri, 12 Nov 2021 15:57:49 +0100 |
Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
---
Inspired by virtio_net_set_features() which I don't quite understand.
Why do we have to do vhost_net_ack_features() for each possible queue?
---
hw/net/virtio-net.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index f205331dcf..43ed9ef3ba 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -766,6 +766,25 @@ static uint64_t virtio_net_bad_features(VirtIODevice *vdev)
return features;
}
+static void virtio_net_force_modern(VirtIODevice *vdev)
+{
+ VirtIONet *n = VIRTIO_NET(vdev);
+ int i;
+
+ /*
+ * Why do we have to loop over all queues? Are not features a
+ * per-device thing?
+ */
+ for (i = 0; i < n->max_queues; i++) {
+ NetClientState *nc = qemu_get_subqueue(n->nic, i);
+
+ if (!get_vhost_net(nc->peer)) {
+ continue;
+ }
+ vhost_dev_force_modern(&get_vhost_net(nc->peer)->dev);
+ }
+}
+
static void virtio_net_apply_guest_offloads(VirtIONet *n)
{
qemu_set_offload(qemu_get_queue(n->nic)->peer,
@@ -3668,6 +3687,7 @@ static void virtio_net_class_init(ObjectClass *klass,
void *data)
vdc->get_features = virtio_net_get_features;
vdc->set_features = virtio_net_set_features;
vdc->bad_features = virtio_net_bad_features;
+ vdc->force_modern = virtio_net_force_modern;
vdc->reset = virtio_net_reset;
vdc->set_status = virtio_net_set_status;
vdc->guest_notifier_mask = virtio_net_guest_notifier_mask;
--
2.25.1
[RFC PATCH v2 2/5] virtio-ccw: use virtio_force_modern(), Halil Pasic, 2021/11/12
[RFC PATCH v2 4/5] vhost: push features to backend on force_modern, Halil Pasic, 2021/11/12
Re: [RFC PATCH v2 0/5] virtio: early detect 'modern' virtio, Halil Pasic, 2021/11/23