Save VirtIONet's status field during early migration and compare it
again during stop-and-copy.
VirtIONet keeps its own status bits here, including VIRTIO_NET_S_LINK_UP
and VIRTIO_NET_S_ANNOUNCE.
Signed-off-by: Jonah Palmer <jonah.palmer@oracle.com>
---
hw/net/virtio-net.c | 6 ++++++
include/hw/virtio/virtio-net.h | 2 ++
2 files changed, 8 insertions(+)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 2dd130777e..88ce33b1d2 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -3872,6 +3872,7 @@ static int virtio_net_early_pre_save(void *opaque)
VirtIONetMigration *vnet_mig = n->migration;
vdev_mig->status_early = vdev->status;
+ vnet_mig->status_early = n->status;
/* VirtIODevice config buffer snapshot */
g_free(vdev_mig->config_early);
@@ -4304,6 +4305,11 @@ static bool virtio_net_has_delta(VirtIONet *n, VirtIODevice *vdev)
return true;
}
+ /* Has the VirtIONet's status changed? */
+ if (n->status != vnet_mig->status_early) {
+ return true;
+ }
+
/* Has the VirtIONet's MAC info changed? */
if (memcmp(n->mac, vnet_mig->mac_early, ETH_ALEN) != 0) {
return true;
diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h
index 1e1f1a3995..59345f1811 100644
--- a/include/hw/virtio/virtio-net.h
+++ b/include/hw/virtio/virtio-net.h
@@ -169,6 +169,7 @@ typedef struct VirtIONetQueue {
/**
* struct VirtIONetMigration - VirtIONet migration structure
+ * @status_early: VirtIONet status snapshot.
* @mac_early: MAC address early migration snapshot.
* @mtable_in_use_early: In-use MAC table entries.
* @mtable_uni_overflow_early: Unicast overflow MAC table entries.
@@ -176,6 +177,7 @@ typedef struct VirtIONetQueue {
* @mtable_macs_early: MAC table entries.
*/
typedef struct VirtIONetMigration {
+ uint16_t status_early;
uint8_t mac_early[ETH_ALEN];
uint32_t mtable_in_use_early;
uint8_t mtable_uni_overflow_early;
--
2.51.0