[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/9] vring: introduce vring_restore() to restore fro
From: |
Liu Ping Fan |
Subject: |
[Qemu-devel] [PATCH 2/9] vring: introduce vring_restore() to restore from img |
Date: |
Thu, 21 Feb 2013 20:54:46 +0800 |
From: Liu Ping Fan <address@hidden>
Re-initialize the members of vring correctly is required when
restored from img.
Signed-off-by: Liu Ping Fan <address@hidden>
---
hw/dataplane/vring.c | 6 ++++++
hw/dataplane/vring.h | 1 +
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/hw/dataplane/vring.c b/hw/dataplane/vring.c
index 865bd4d..0a540b4 100644
--- a/hw/dataplane/vring.c
+++ b/hw/dataplane/vring.c
@@ -48,6 +48,12 @@ bool vring_setup(Vring *vring, VirtIODevice *vdev, int n)
return true;
}
+void vring_restore(Vring *vring, uint16_t last_avail_idx)
+{
+ vring->last_avail_idx = last_avail_idx;
+ vring->last_used_idx = vring->vr.used->idx;
+}
+
void vring_teardown(Vring *vring)
{
hostmem_finalize(&vring->hostmem);
diff --git a/hw/dataplane/vring.h b/hw/dataplane/vring.h
index 0d00500..9938bf9 100644
--- a/hw/dataplane/vring.h
+++ b/hw/dataplane/vring.h
@@ -49,6 +49,7 @@ static inline void vring_set_broken(Vring *vring)
vring->broken = true;
}
+void vring_restore(Vring *vring, uint16_t last_avail_idx);
bool vring_setup(Vring *vring, VirtIODevice *vdev, int n);
void vring_teardown(Vring *vring);
void vring_disable_notification(VirtIODevice *vdev, Vring *vring);
--
1.7.4.4