diff mbox series

[RFC,07/13] vfio/migration: move the statistics of bytes_transferred to generic VFIO migration layer

Message ID 20220524061848.1615706-8-lei.rao@intel.com (mailing list archive)
State New, archived
Headers show
Series Add a plugin to support out-of-band live migration for VFIO pass-through device | expand

Commit Message

Rao, Lei May 24, 2022, 6:18 a.m. UTC
The statistics of bytes transferred conceptually belong to The VFIO live
migration framework, and should not belong to any specific implementation
such In-Band approach, so move it out from vfio_migration_region_save_buffer(),
which makes it easier to add other implementations.

Signed-off-by: Lei Rao <lei.rao@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
---
 hw/vfio/migration.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index 4736af90e7..c114fab3a2 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -257,7 +257,6 @@  static int vfio_migration_save_buffer_local(QEMUFile *f, VFIODevice *vbasedev,
         *size = data_size;
     }
 
-    bytes_transferred += data_size;
     return ret;
 }
 
@@ -540,6 +539,7 @@  static int vfio_save_iterate(QEMUFile *f, void *opaque)
                          vbasedev->name, strerror(errno));
             return ret;
         }
+        bytes_transferred += data_size;
     }
 
     qemu_put_be64(f, VFIO_MIG_FLAG_END_OF_STATE);
@@ -592,6 +592,7 @@  static int vfio_save_complete_precopy(QEMUFile *f, void *opaque)
                 error_report("%s: Failed to save buffer", vbasedev->name);
                 return ret;
             }
+            bytes_transferred += data_size;
         }
 
         if (data_size == 0) {