summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2014-05-20 14:01:43 +0800
committerMichael S. Tsirkin <mst@redhat.com>2014-06-19 16:41:54 +0300
commit508e1180d3e8371a902ba721d2c9e1ee04c33a15 (patch)
tree378ce34ac117bcc20b66b10d3d7bf4fe1a669e7c /include
parent110f463062d65487fdd0daaaa0df53a2ea9d6619 (diff)
downloadqemu-508e1180d3e8371a902ba721d2c9e1ee04c33a15.zip
migration: introduce self_announce_delay()
This patch introduces self_announce_delay() to calculate the delay for the next announce round. This could be used by other device e.g virtio-net who wants to do announcing by itself. Signed-off-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/migration/vmstate.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 6edce982b2..799d2d0f03 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -780,4 +780,12 @@ void vmstate_register_ram(struct MemoryRegion *memory, DeviceState *dev);
void vmstate_unregister_ram(struct MemoryRegion *memory, DeviceState *dev);
void vmstate_register_ram_global(struct MemoryRegion *memory);
+static inline
+int64_t self_announce_delay(int round)
+{
+ assert(round < SELF_ANNOUNCE_ROUNDS && round > 0);
+ /* delay 50ms, 150ms, 250ms, ... */
+ return 50 + (SELF_ANNOUNCE_ROUNDS - round - 1) * 100;
+}
+
#endif