summaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorLeonid Bloch <leonid.bloch@ravellosystems.com>2015-11-11 15:52:40 +0200
committerJason Wang <jasowang@redhat.com>2015-11-12 15:26:52 +0800
commit9e11773417d98fd2ec961568ec2875063b95569b (patch)
treedfa4befa1b447ac8f32f166fba304b83a142d119 /hw
parent20f3e86362758b5085aa17baa7bc109c858acf67 (diff)
downloadhqemu-9e11773417d98fd2ec961568ec2875063b95569b.zip
hqemu-9e11773417d98fd2ec961568ec2875063b95569b.tar.gz
e1000: Add support for migrating the entire MAC registers' array
This patch makes the migration of the entire array of MAC registers possible during live migration. The entire array is just 128 KB long, so practically no penalty should be felt when transmitting it, additionally to the previously transmitted individual registers. The advantage here is eliminating the need to introduce new vmstate subsections in the future, when additional MAC registers will be implemented. Backward compatibility is preserved by introducing a e1000-specific boolean parameter (in a later patch), which will be on by default. Setting it to off would enable migration to older versions of QEMU. Additionally, this parameter will be used to control the access to the extra MAC registers in the future. Signed-off-by: Leonid Bloch <leonid.bloch@ravellosystems.com> Signed-off-by: Dmitry Fleytman <dmitry.fleytman@ravellosystems.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/net/e1000.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index da72776..7088027 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -135,8 +135,10 @@ typedef struct E1000State_st {
/* Compatibility flags for migration to/from qemu 1.3.0 and older */
#define E1000_FLAG_AUTONEG_BIT 0
#define E1000_FLAG_MIT_BIT 1
+#define E1000_FLAG_MAC_BIT 2
#define E1000_FLAG_AUTONEG (1 << E1000_FLAG_AUTONEG_BIT)
#define E1000_FLAG_MIT (1 << E1000_FLAG_MIT_BIT)
+#define E1000_FLAG_MAC (1 << E1000_FLAG_MAC_BIT)
uint32_t compat_flags;
} E1000State;
@@ -1380,6 +1382,13 @@ static bool e1000_mit_state_needed(void *opaque)
return s->compat_flags & E1000_FLAG_MIT;
}
+static bool e1000_full_mac_needed(void *opaque)
+{
+ E1000State *s = opaque;
+
+ return s->compat_flags & E1000_FLAG_MAC;
+}
+
static const VMStateDescription vmstate_e1000_mit_state = {
.name = "e1000/mit_state",
.version_id = 1,
@@ -1395,6 +1404,17 @@ static const VMStateDescription vmstate_e1000_mit_state = {
}
};
+static const VMStateDescription vmstate_e1000_full_mac_state = {
+ .name = "e1000/full_mac_state",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .needed = e1000_full_mac_needed,
+ .fields = (VMStateField[]) {
+ VMSTATE_UINT32_ARRAY(mac_reg, E1000State, 0x8000),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
static const VMStateDescription vmstate_e1000 = {
.name = "e1000",
.version_id = 2,
@@ -1474,6 +1494,7 @@ static const VMStateDescription vmstate_e1000 = {
},
.subsections = (const VMStateDescription*[]) {
&vmstate_e1000_mit_state,
+ &vmstate_e1000_full_mac_state,
NULL
}
};
OpenPOWER on IntegriCloud