From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54276) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THPxQ-0005IA-8O for qemu-devel@nongnu.org; Thu, 27 Sep 2012 22:05:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1THPxO-00046p-VL for qemu-devel@nongnu.org; Thu, 27 Sep 2012 22:05:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32949) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THPxO-00046I-NA for qemu-devel@nongnu.org; Thu, 27 Sep 2012 22:05:34 -0400 From: Amos Kong Date: Fri, 28 Sep 2012 10:06:01 +0800 Message-Id: <1348797962-18447-3-git-send-email-akong@redhat.com> In-Reply-To: <1348797962-18447-1-git-send-email-akong@redhat.com> References: <1348797962-18447-1-git-send-email-akong@redhat.com> Subject: [Qemu-devel] [PATCH v5 2/3] e1000: update nc.link_down in e1000_post_load() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, mst@redhat.com, stefanha@gmail.com, jasowang@redhat.com, pbonzini@redhat.com, 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 --- hw/e1000.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) 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.1