From patchwork Wed Jan 7 17:37:38 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Williamson X-Patchwork-Id: 1211 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n07HXc5m024618 for ; Wed, 7 Jan 2009 09:33:39 -0800 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752919AbZAGRhM (ORCPT ); Wed, 7 Jan 2009 12:37:12 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753908AbZAGRhM (ORCPT ); Wed, 7 Jan 2009 12:37:12 -0500 Received: from g1t0028.austin.hp.com ([15.216.28.35]:32727 "EHLO g1t0028.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752919AbZAGRhL (ORCPT ); Wed, 7 Jan 2009 12:37:11 -0500 Received: from g1t0038.austin.hp.com (g1t0038.austin.hp.com [16.236.32.44]) by g1t0028.austin.hp.com (Postfix) with ESMTP id 9A0F11C019; Wed, 7 Jan 2009 17:37:10 +0000 (UTC) Received: from ldl.fc.hp.com (ldl.fc.hp.com [15.11.146.30]) by g1t0038.austin.hp.com (Postfix) with ESMTP id 3F64C30069; Wed, 7 Jan 2009 17:37:10 +0000 (UTC) Received: from localhost (ldl.fc.hp.com [127.0.0.1]) by ldl.fc.hp.com (Postfix) with ESMTP id C1A0239C010; Wed, 7 Jan 2009 10:37:09 -0700 (MST) X-Virus-Scanned: Debian amavisd-new at ldl.fc.hp.com Received: from ldl.fc.hp.com ([127.0.0.1]) by localhost (ldl.fc.hp.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Eo6VXQHywaWl; Wed, 7 Jan 2009 10:37:08 -0700 (MST) Received: from [10.91.73.10] (lart.fc.hp.com [15.11.146.31]) by ldl.fc.hp.com (Postfix) with ESMTP id 304B839C001; Wed, 7 Jan 2009 10:37:08 -0700 (MST) Subject: [PATCH 2/5][RFC] virtio-net: Add load/save for status bits From: Alex Williamson To: kvm , qemu-devel Cc: Mark McLoughlin Organization: OSLO R&D Date: Wed, 07 Jan 2009 10:37:38 -0700 Message-Id: <1231349858.7109.81.camel@lappy> Mime-Version: 1.0 X-Mailer: Evolution 2.24.2 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org virtio-net: Add load/save for status bits Signed-off-by: Alex Williamson --- hw/virtio-net.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/hw/virtio-net.c b/hw/virtio-net.c index bfb7510..77e3077 100644 --- a/hw/virtio-net.c +++ b/hw/virtio-net.c @@ -16,6 +16,8 @@ #include "qemu-timer.h" #include "virtio-net.h" +#define VIRTIO_VM_VERSION 2 + typedef struct VirtIONet { VirtIODevice vdev; @@ -307,13 +309,14 @@ static void virtio_net_save(QEMUFile *f, void *opaque) qemu_put_buffer(f, n->mac, 6); qemu_put_be32(f, n->tx_timer_active); + qemu_put_be16(f, n->status); } static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) { VirtIONet *n = opaque; - if (version_id != 1) + if (version_id < 1 || version_id > VIRTIO_VM_VERSION) return -EINVAL; virtio_load(&n->vdev, f); @@ -321,6 +324,9 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) qemu_get_buffer(f, n->mac, 6); n->tx_timer_active = qemu_get_be32(f); + if (version_id >= 2) + n->status = qemu_get_be16(f); + if (n->tx_timer_active) { qemu_mod_timer(n->tx_timer, qemu_get_clock(vm_clock) + TX_TIMER_INTERVAL); @@ -363,7 +369,7 @@ PCIDevice *virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn) n->tx_timer_active = 0; n->mergeable_rx_bufs = 0; - register_savevm("virtio-net", virtio_net_id++, 1, + register_savevm("virtio-net", virtio_net_id++, VIRTIO_VM_VERSION, virtio_net_save, virtio_net_load, n); return (PCIDevice *)n;