From patchwork Mon Oct 19 18:43:02 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 36406 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E421AB7B72 for ; Tue, 20 Oct 2009 06:12:21 +1100 (EST) Received: from localhost ([127.0.0.1]:35243 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MzxeU-0006Uq-Qw for incoming@patchwork.ozlabs.org; Mon, 19 Oct 2009 15:12:18 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MzxDG-0006Es-Lm for qemu-devel@nongnu.org; Mon, 19 Oct 2009 14:44:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MzxD9-0006AU-6y for qemu-devel@nongnu.org; Mon, 19 Oct 2009 14:44:07 -0400 Received: from [199.232.76.173] (port=49051 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MzxD8-0006AH-PZ for qemu-devel@nongnu.org; Mon, 19 Oct 2009 14:44:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50221) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MzxD8-0006LS-5H for qemu-devel@nongnu.org; Mon, 19 Oct 2009 14:44:02 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9JIi12Q025236 for ; Mon, 19 Oct 2009 14:44:01 -0400 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9JIhcCA012656; Mon, 19 Oct 2009 14:44:00 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Mon, 19 Oct 2009 20:43:02 +0200 Message-Id: <5791fa1fc694b80a159ff14d710df74b5261ec1d.1255976538.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH 17/25] rtl8139: port TallyCounters to vmstate X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Juan Quintela --- hw/rtl8139.c | 50 ++++++++++++++++++++++++-------------------------- 1 files changed, 24 insertions(+), 26 deletions(-) diff --git a/hw/rtl8139.c b/hw/rtl8139.c index 10daeb2..7efa119 100644 --- a/hw/rtl8139.c +++ b/hw/rtl8139.c @@ -1327,39 +1327,37 @@ static void RTL8139TallyCounters_physical_memory_write(target_phys_addr_t tc_add } /* Loads values of tally counters from VM state file */ + +static const VMStateDescription vmstate_tally_counters = { + .name = "tally_counters", + .version_id = 1, + .minimum_version_id = 1, + .minimum_version_id_old = 1, + .fields = (VMStateField []) { + VMSTATE_UINT64(TxOk, RTL8139TallyCounters), + VMSTATE_UINT64(RxOk, RTL8139TallyCounters), + VMSTATE_UINT64(TxERR, RTL8139TallyCounters), + VMSTATE_UINT32(RxERR, RTL8139TallyCounters), + VMSTATE_UINT16(MissPkt, RTL8139TallyCounters), + VMSTATE_UINT16(FAE, RTL8139TallyCounters), + VMSTATE_UINT32(Tx1Col, RTL8139TallyCounters), + VMSTATE_UINT32(TxMCol, RTL8139TallyCounters), + VMSTATE_UINT64(RxOkPhy, RTL8139TallyCounters), + VMSTATE_UINT64(RxOkBrd, RTL8139TallyCounters), + VMSTATE_UINT16(TxAbt, RTL8139TallyCounters), + VMSTATE_UINT16(TxUndrn, RTL8139TallyCounters), + VMSTATE_END_OF_LIST() + } +}; static void RTL8139TallyCounters_load(QEMUFile* f, RTL8139TallyCounters *tally_counters) { - qemu_get_be64s(f, &tally_counters->TxOk); - qemu_get_be64s(f, &tally_counters->RxOk); - qemu_get_be64s(f, &tally_counters->TxERR); - qemu_get_be32s(f, &tally_counters->RxERR); - qemu_get_be16s(f, &tally_counters->MissPkt); - qemu_get_be16s(f, &tally_counters->FAE); - qemu_get_be32s(f, &tally_counters->Tx1Col); - qemu_get_be32s(f, &tally_counters->TxMCol); - qemu_get_be64s(f, &tally_counters->RxOkPhy); - qemu_get_be64s(f, &tally_counters->RxOkBrd); - qemu_get_be32s(f, &tally_counters->RxOkMul); - qemu_get_be16s(f, &tally_counters->TxAbt); - qemu_get_be16s(f, &tally_counters->TxUndrn); + vmstate_load_state(f, &vmstate_tally_counters, tally_counters, vmstate_tally_counters.version_id); } /* Saves values of tally counters to VM state file */ static void RTL8139TallyCounters_save(QEMUFile* f, RTL8139TallyCounters *tally_counters) { - qemu_put_be64s(f, &tally_counters->TxOk); - qemu_put_be64s(f, &tally_counters->RxOk); - qemu_put_be64s(f, &tally_counters->TxERR); - qemu_put_be32s(f, &tally_counters->RxERR); - qemu_put_be16s(f, &tally_counters->MissPkt); - qemu_put_be16s(f, &tally_counters->FAE); - qemu_put_be32s(f, &tally_counters->Tx1Col); - qemu_put_be32s(f, &tally_counters->TxMCol); - qemu_put_be64s(f, &tally_counters->RxOkPhy); - qemu_put_be64s(f, &tally_counters->RxOkBrd); - qemu_put_be32s(f, &tally_counters->RxOkMul); - qemu_put_be16s(f, &tally_counters->TxAbt); - qemu_put_be16s(f, &tally_counters->TxUndrn); + vmstate_save_state(f, &vmstate_tally_counters, tally_counters); } static void rtl8139_ChipCmd_write(RTL8139State *s, uint32_t val)