Save the state of virtio-net's guest offloads and multiqueue configuration at early migration time to compare with later during the stop-and-copy phase.
Signed-off-by: Jonah Palmer <[email protected]> --- hw/net/virtio-net.c | 20 ++++++++++++++++++++ include/hw/virtio/virtio-net.h | 6 ++++++ 2 files changed, 26 insertions(+) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index b3f71d8f84..2c0b42debb 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -3936,6 +3936,13 @@ static int virtio_net_early_pre_save(void *opaque) } memcpy(vnet_mig->vlans_early, n->vlans, vlans_size); + /* Guest offloads snapshot */ + vnet_mig->guest_offloads_early = n->curr_guest_offloads; + + /* Multiqueue state snapshot */ + vnet_mig->mq_early = n->multiqueue; + vnet_mig->queue_pairs_early = n->curr_queue_pairs; + return 0; } @@ -4369,6 +4376,19 @@ static bool virtio_net_has_delta(VirtIONet *n, VirtIODevice *vdev) return true; } + /* Has the VirtIONet's guest offloads changed? */ + if (n->curr_guest_offloads != vnet_mig->guest_offloads_early) { + return true; + } + + /* Has the VirtIONet's multiqueue state changed? */ + if (n->multiqueue != vnet_mig->mq_early) { + return true; + } + if (n->curr_queue_pairs != vnet_mig->queue_pairs_early) { + return true; + } + /* * Always return true for now until we're able to detect all possible * changes to a VirtIONet device. diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h index 5df2dd0513..5d6179fa19 100644 --- a/include/hw/virtio/virtio-net.h +++ b/include/hw/virtio/virtio-net.h @@ -177,6 +177,9 @@ typedef struct VirtIONetQueue { * @mtable_macs_early: MAC table entries. * @rx_flags_early: Bit-packed RX filters (promisc, allmulti, alluni, etc.). * @vlans_early: VLAN filter table snapshot. + * @guest_offloads_early: Guest offloads snapshot. + * @mq_early: Multiqueue state snapshot. + * @queue_pairs_early: Queue pairs snapshot. */ typedef struct VirtIONetMigration { uint16_t status_early; @@ -187,6 +190,9 @@ typedef struct VirtIONetMigration { uint8_t *mtable_macs_early; uint8_t rx_flags_early; uint8_t *vlans_early; + uint64_t guest_offloads_early; + int mq_early; + uint16_t queue_pairs_early; } VirtIONetMigration; struct VirtIONet { -- 2.51.0
