From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36221) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLC3e-0004ky-Sk for qemu-devel@nongnu.org; Mon, 08 Oct 2012 08:03:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TLC3X-00075s-8g for qemu-devel@nongnu.org; Mon, 08 Oct 2012 08:03:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47240) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLC3X-00075k-0Q for qemu-devel@nongnu.org; Mon, 08 Oct 2012 08:03:31 -0400 From: Stefan Hajnoczi Date: Mon, 8 Oct 2012 14:03:01 +0200 Message-Id: <1349697783-19368-3-git-send-email-stefanha@redhat.com> In-Reply-To: <1349697783-19368-1-git-send-email-stefanha@redhat.com> References: <1349697783-19368-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PATCH 2/4] e1000: update nc.link_down in e1000_post_load() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Stefan Hajnoczi , Amos Kong , qemu-devel@nongnu.org From: Amos Kong This patch introduced e1000_post_load(), it will be called in the end of migration. nc.link_down could not be migrated, this patch updates link_down in e1000_post_load() to keep it coincident with real link status. Signed-off-by: Amos Kong Signed-off-by: Stefan Hajnoczi --- hw/e1000.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/e1000.c b/hw/e1000.c index ec3a7c4..63fee10 100644 --- a/hw/e1000.c +++ b/hw/e1000.c @@ -1079,11 +1079,23 @@ static bool is_version_1(void *opaque, int version_id) return version_id == 1; } +static int e1000_post_load(void *opaque, int version_id) +{ + E1000State *s = opaque; + + /* nc.link_down can't be migrated, so infer link_down according + * to link status bit in mac_reg[STATUS] */ + s->nic->nc.link_down = (s->mac_reg[STATUS] & E1000_STATUS_LU) == 0; + + return 0; +} + static const VMStateDescription vmstate_e1000 = { .name = "e1000", .version_id = 2, .minimum_version_id = 1, .minimum_version_id_old = 1, + .post_load = e1000_post_load, .fields = (VMStateField []) { VMSTATE_PCI_DEVICE(dev, E1000State), VMSTATE_UNUSED_TEST(is_version_1, 4), /* was instance id */ -- 1.7.11.4