[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-9.1.3 10/58] virtio-net: Add queues before loading them
From: |
Michael Tokarev |
Subject: |
[Stable-9.1.3 10/58] virtio-net: Add queues before loading them |
Date: |
Mon, 27 Jan 2025 23:24:56 +0300 |
Call virtio_net_set_multiqueue() to add queues before loading their
states. Otherwise the loaded queues will not have handlers and elements
in them will not be processed.
Cc: qemu-stable@nongnu.org
Fixes: 8c49756825da ("virtio-net: Add only one queue pair when realizing")
Reported-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
(cherry picked from commit 9379ea9db3c0064fa2787db0794a23a30f7b2d2d)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index cf27d5cbe5..c1fe457359 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -3035,6 +3035,15 @@ static void virtio_net_set_multiqueue(VirtIONet *n, int
multiqueue)
virtio_net_set_queue_pairs(n);
}
+static int virtio_net_pre_load_queues(VirtIODevice *vdev)
+{
+ virtio_net_set_multiqueue(VIRTIO_NET(vdev),
+ virtio_has_feature(vdev->guest_features,
VIRTIO_NET_F_RSS) ||
+ virtio_has_feature(vdev->guest_features,
VIRTIO_NET_F_MQ));
+
+ return 0;
+}
+
static int virtio_net_post_load_device(void *opaque, int version_id)
{
VirtIONet *n = opaque;
@@ -4013,6 +4022,7 @@ static void virtio_net_class_init(ObjectClass *klass,
void *data)
vdc->guest_notifier_mask = virtio_net_guest_notifier_mask;
vdc->guest_notifier_pending = virtio_net_guest_notifier_pending;
vdc->legacy_features |= (0x1 << VIRTIO_NET_F_GSO);
+ vdc->pre_load_queues = virtio_net_pre_load_queues;
vdc->post_load = virtio_net_post_load_virtio;
vdc->vmsd = &vmstate_virtio_net_device;
vdc->primary_unplug_pending = primary_unplug_pending;
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 9e10cbc058..10f24a58dd 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -3251,6 +3251,13 @@ virtio_load(VirtIODevice *vdev, QEMUFile *f, int
version_id)
config_len--;
}
+ if (vdc->pre_load_queues) {
+ ret = vdc->pre_load_queues(vdev);
+ if (ret) {
+ return ret;
+ }
+ }
+
num = qemu_get_be32(f);
if (num > VIRTIO_QUEUE_MAX) {
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index 0fcbc5c0c6..953dfca27c 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -210,6 +210,8 @@ struct VirtioDeviceClass {
void (*guest_notifier_mask)(VirtIODevice *vdev, int n, bool mask);
int (*start_ioeventfd)(VirtIODevice *vdev);
void (*stop_ioeventfd)(VirtIODevice *vdev);
+ /* Called before loading queues. Useful to add queues before loading. */
+ int (*pre_load_queues)(VirtIODevice *vdev);
/* Saving and loading of a device; trying to deprecate save/load
* use vmsd for new devices.
*/
--
2.39.5
- [Stable-9.1.3 00/58] Patch Round-up for stable 9.1.3, freeze on 2025-02-06, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 02/58] bitops.h: Define bit operations on 'uint32_t' arrays, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 03/58] hw/intc/loongarch_extioi: Use set_bit32() and clear_bit32() for s->isr, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 04/58] linux-user: Fix strace output for s390x mmap(), Michael Tokarev, 2025/01/28
- [Stable-9.1.3 01/58] hw/intc/openpic: Avoid taking address of out-of-bounds array index, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 09/58] migration: Allow pipes to keep working for fd migrations, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 05/58] virtio-net: Fix size check in dhclient workaround, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 06/58] qdev: Fix set_pci_devfn() to visit option only once, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 07/58] ssh: Do not switch session to non-blocking mode, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 08/58] plugins: add missing export for qemu_plugin_num_vcpus, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 10/58] virtio-net: Add queues before loading them,
Michael Tokarev <=
- [Stable-9.1.3 11/58] ppc/spapr: fix drc index mismatch for partially enabled vcpus, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 12/58] scsi: megasas: Internal cdbs have 16-byte length, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 13/58] tests/9p: fix Rreaddir response name, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 14/58] tests/9p: add missing Rgetattr response name, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 16/58] 9pfs: remove obsolete comment in v9fs_getattr(), Michael Tokarev, 2025/01/28
- [Stable-9.1.3 15/58] tests/9p: add 'use-after-unlink' test, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 17/58] 9pfs: fix 'Tgetattr' after unlink, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 18/58] tests/9p: also check 'Tgetattr' in 'use-after-unlink' test, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 20/58] target/ppc: Fix THREAD_SIBLING_FOREACH for multi-socket, Michael Tokarev, 2025/01/28
- [Stable-9.1.3 21/58] hw/nvme: fix msix_uninit with exclusive bar, Michael Tokarev, 2025/01/28