From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LVCpN-0000qK-Ip for qemu-devel@nongnu.org; Thu, 05 Feb 2009 17:36:09 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LVCpL-0000n4-L4 for qemu-devel@nongnu.org; Thu, 05 Feb 2009 17:36:09 -0500 Received: from [199.232.76.173] (port=44144 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LVCpL-0000mW-8W for qemu-devel@nongnu.org; Thu, 05 Feb 2009 17:36:07 -0500 Received: from savannah.gnu.org ([199.232.41.3]:56493 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LVCpL-0005pI-0l for qemu-devel@nongnu.org; Thu, 05 Feb 2009 17:36:07 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1LVCpJ-0000R0-C2 for qemu-devel@nongnu.org; Thu, 05 Feb 2009 22:36:05 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1LVCpI-0000Qv-Vj for qemu-devel@nongnu.org; Thu, 05 Feb 2009 22:36:05 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Thu, 05 Feb 2009 22:36:05 +0000 Subject: [Qemu-devel] [6533] qemu:virtio-net: Save status and add some save infrastructure ( Alex Williamson) Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 6533 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6533 Author: aliguori Date: 2009-02-05 22:36:04 +0000 (Thu, 05 Feb 2009) Log Message: ----------- qemu:virtio-net: Save status and add some save infrastructure (Alex Williamson) The status register should probably be saved since its guest visible. Also add a little bit if infrastructure for handling various save revisions. Signed-off-by: Alex Williamson Signed-off-by: Anthony Liguori Modified Paths: -------------- trunk/hw/virtio-net.c Modified: trunk/hw/virtio-net.c =================================================================== --- trunk/hw/virtio-net.c 2009-02-05 22:33:36 UTC (rev 6532) +++ trunk/hw/virtio-net.c 2009-02-05 22:36:04 UTC (rev 6533) @@ -16,6 +16,8 @@ #include "qemu-timer.h" #include "virtio-net.h" +#define VIRTIO_NET_VM_VERSION 3 + typedef struct VirtIONet { VirtIODevice vdev; @@ -292,13 +294,14 @@ qemu_put_buffer(f, n->mac, 6); qemu_put_be32(f, n->tx_timer_active); qemu_put_be32(f, n->mergeable_rx_bufs); + qemu_put_be16(f, n->status); } static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) { VirtIONet *n = opaque; - if (version_id != 2) + if (version_id < 2 || version_id > VIRTIO_NET_VM_VERSION) return -EINVAL; virtio_load(&n->vdev, f); @@ -307,6 +310,9 @@ n->tx_timer_active = qemu_get_be32(f); n->mergeable_rx_bufs = qemu_get_be32(f); + if (version_id >= 3) + 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); @@ -348,6 +354,6 @@ n->tx_timer_active = 0; n->mergeable_rx_bufs = 0; - register_savevm("virtio-net", virtio_net_id++, 2, + register_savevm("virtio-net", virtio_net_id++, VIRTIO_NET_VM_VERSION, virtio_net_save, virtio_net_load, n); }