[2/2] Add check_rxov into VMState.

Submitted by Dmitry Fleytman on Oct. 17, 2012, 6:31 p.m.

Details

Message ID 1350498707-6749-3-git-send-email-dmitry@daynix.com
State New
Headers show

Commit Message

Dmitry Fleytman Oct. 17, 2012, 6:31 p.m.
E1000State::check_rxov field must be preserved on live migration.

Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
---
 hw/e1000.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Stefan Hajnoczi Oct. 18, 2012, 7:24 a.m.
On Wed, Oct 17, 2012 at 08:31:47PM +0200, Dmitry Fleytman wrote:
> @@ -1100,6 +1100,11 @@ static bool is_version_1(void *opaque, int version_id)
>      return version_id == 1;
>  }
>  
> +static bool is_version_3(void *opaque, int version_id)
> +{
> +    return version_id == 1;
> +}

version_id == 3?
Dmitry Fleytman Oct. 18, 2012, 8:06 a.m.
Oops, you are right :)

On Thu, Oct 18, 2012 at 9:24 AM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
> On Wed, Oct 17, 2012 at 08:31:47PM +0200, Dmitry Fleytman wrote:
>> @@ -1100,6 +1100,11 @@ static bool is_version_1(void *opaque, int version_id)
>>      return version_id == 1;
>>  }
>>
>> +static bool is_version_3(void *opaque, int version_id)
>> +{
>> +    return version_id == 1;
>> +}
>
> version_id == 3?
Avi Kivity Oct. 18, 2012, 2:56 p.m.
On 10/17/2012 08:31 PM, Dmitry Fleytman wrote:
> E1000State::check_rxov field must be preserved on live migration.

It looks like its value is usually 1.  Is this true?

If so, we can use subsections to only migrate it if it is zero.  This
allows migration to keep working from a new version to an older version.

Patch hide | download patch | download mbox

diff --git a/hw/e1000.c b/hw/e1000.c
index 606bf3a..26ad03c 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -92,7 +92,7 @@  typedef struct E1000State_st {
 
     uint32_t rxbuf_size;
     uint32_t rxbuf_min_shift;
-    int check_rxov;
+    uint32_t check_rxov;
     struct e1000_tx {
         unsigned char header[256];
         unsigned char vlan_header[4];
@@ -1100,6 +1100,11 @@  static bool is_version_1(void *opaque, int version_id)
     return version_id == 1;
 }
 
+static bool is_version_3(void *opaque, int version_id)
+{
+    return version_id == 1;
+}
+
 static int e1000_post_load(void *opaque, int version_id)
 {
     E1000State *s = opaque;
@@ -1113,7 +1118,7 @@  static int e1000_post_load(void *opaque, int version_id)
 
 static const VMStateDescription vmstate_e1000 = {
     .name = "e1000",
-    .version_id = 2,
+    .version_id = 3,
     .minimum_version_id = 1,
     .minimum_version_id_old = 1,
     .post_load = e1000_post_load,
@@ -1123,6 +1128,7 @@  static const VMStateDescription vmstate_e1000 = {
         VMSTATE_UNUSED(4), /* Was mmio_base.  */
         VMSTATE_UINT32(rxbuf_size, E1000State),
         VMSTATE_UINT32(rxbuf_min_shift, E1000State),
+        VMSTATE_UINT32_TEST(check_rxov, E1000State, is_version_3),
         VMSTATE_UINT32(eecd_state.val_in, E1000State),
         VMSTATE_UINT16(eecd_state.bitnum_in, E1000State),
         VMSTATE_UINT16(eecd_state.bitnum_out, E1000State),