[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 2/8] e1000: Add support for migrating the entire
From: |
Leonid Bloch |
Subject: |
[Qemu-devel] [PATCH v5 2/8] e1000: Add support for migrating the entire MAC registers' array |
Date: |
Mon, 9 Nov 2015 16:59:24 +0200 |
This patch enables the migration of the entire array of MAC registers
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 the e1000-specific
boolean parameter "extra_mac_registers", which is on by default. Setting
it to off will enable migration to older versions of QEMU.
Additionally, this parameter can be used to control the implementation of
extra MAC registers in the future. I.e. new MAC registers may be set to
behave differently, or not to be active at all, if "extra_mac_registers"
will be set to "off", e.g.:
qemu-system-x86_64 -device e1000,extra_mac_registers=off,... ...
As mentioned above, the default value is "on".
Signed-off-by: Leonid Bloch <address@hidden>
Signed-off-by: Dmitry Fleytman <address@hidden>
---
hw/net/e1000.c | 23 +++++++++++++++++++++++
include/hw/compat.h | 4 ++++
2 files changed, 27 insertions(+)
diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index da72776..0e00afa 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
}
};
@@ -1606,6 +1627,8 @@ static Property e1000_properties[] = {
compat_flags, E1000_FLAG_AUTONEG_BIT, true),
DEFINE_PROP_BIT("mitigation", E1000State,
compat_flags, E1000_FLAG_MIT_BIT, true),
+ DEFINE_PROP_BIT("extra_mac_registers", E1000State,
+ compat_flags, E1000_FLAG_MAC_BIT, true),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/include/hw/compat.h b/include/hw/compat.h
index 93e71af..c394593 100644
--- a/include/hw/compat.h
+++ b/include/hw/compat.h
@@ -6,6 +6,10 @@
.driver = "virtio-blk-device",\
.property = "scsi",\
.value = "true",\
+ },{\
+ .driver = "e1000",\
+ .property = "extra_mac_registers",\
+ .value = "off",\
},
#define HW_COMPAT_2_3 \
--
2.4.3
- [Qemu-devel] [PATCH v5 0/8] e1000: Various fixes and registers' implementation, Leonid Bloch, 2015/11/09
- [Qemu-devel] [PATCH v5 2/8] e1000: Add support for migrating the entire MAC registers' array,
Leonid Bloch <=
- [Qemu-devel] [PATCH v5 1/8] e1000: Cosmetic and alignment fixes, Leonid Bloch, 2015/11/09
- [Qemu-devel] [PATCH v5 4/8] e1000: Trivial implementation of various MAC registers, Leonid Bloch, 2015/11/09
- [Qemu-devel] [PATCH v5 3/8] e1000: Introduced an array to control the access to the MAC registers, Leonid Bloch, 2015/11/09
- [Qemu-devel] [PATCH v5 6/8] e1000: Fixing the received/transmitted octets' counters, Leonid Bloch, 2015/11/09
- [Qemu-devel] [PATCH v5 5/8] e1000: Fixing the received/transmitted packets' counters, Leonid Bloch, 2015/11/09
- [Qemu-devel] [PATCH v5 7/8] e1000: Fixing the packet address filtering procedure, Leonid Bloch, 2015/11/09
- [Qemu-devel] [PATCH v5 8/8] e1000: Implementing various counters, Leonid Bloch, 2015/11/09
- Re: [Qemu-devel] [PATCH v5 0/8] e1000: Various fixes and registers' implementation, Jason Wang, 2015/11/10