From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LMTbE-0002jI-Ej for qemu-devel@nongnu.org; Mon, 12 Jan 2009 15:41:28 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LMTbD-0002ii-9t for qemu-devel@nongnu.org; Mon, 12 Jan 2009 15:41:27 -0500 Received: from [199.232.76.173] (port=37152 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LMTbD-0002ia-5G for qemu-devel@nongnu.org; Mon, 12 Jan 2009 15:41:27 -0500 Received: from mx2.redhat.com ([66.187.237.31]:55033) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LMTbC-0002ZU-K7 for qemu-devel@nongnu.org; Mon, 12 Jan 2009 15:41:26 -0500 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n0CKfPAw013713 for ; Mon, 12 Jan 2009 15:41:25 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n0CKfPkn016050 for ; Mon, 12 Jan 2009 15:41:26 -0500 Received: from localhost.localdomain (vpn-12-235.rdu.redhat.com [10.11.12.235]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n0CKfMQ5003256 for ; Mon, 12 Jan 2009 15:41:23 -0500 Message-ID: <496BAB08.8080107@redhat.com> Date: Mon, 12 Jan 2009 22:41:44 +0200 From: Dor Laor MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 2/5][RFC] virtio-net: Add load/save for statusbits References: <1231349858.7109.81.camel@lappy> <58BD0469C48A7443A479A13D101685E301B37BC4@ala-mail09.corp.ad.wrs.com> In-Reply-To: <58BD0469C48A7443A479A13D101685E301B37BC4@ala-mail09.corp.ad.wrs.com> Content-Type: multipart/alternative; boundary="------------050107040006070709050305" Reply-To: dlaor@redhat.com, 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 This is a multi-part message in MIME format. --------------050107040006070709050305 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Krumme, Chris wrote: >> -----Original Message----- >> From: >> qemu-devel-bounces+chris.krumme=windriver.com@nongnu.org >> [mailto:qemu-devel-bounces+chris.krumme=windriver.com@nongnu.o >> rg] On Behalf Of Alex Williamson >> Sent: Wednesday, January 07, 2009 11:38 AM >> To: kvm; qemu-devel >> Cc: Mark McLoughlin >> Subject: [Qemu-devel] [PATCH 2/5][RFC] virtio-net: Add >> load/save for statusbits >> >> 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(-) >> >> 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); >> + >> > > Hello, > > I know this is a late reply, but just thought I would ask: > > You have the magic number 2 here, and change it to three in patch 5/5, > should this not be VIRTIO_VM_VERSION? Or a comment about where the > number comes from. > > It is the version of the stated saved for virtio net device. The driver does not know anything about it. The version number syncs between the source & destination qemu. The numbering started with '1' and we increase it each time we save a new field. > Thanks > Chris > > --------------050107040006070709050305 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Krumme, Chris wrote:
-----Original Message-----
From: 
qemu-devel-bounces+chris.krumme=windriver.com@nongnu.org 
[mailto:qemu-devel-bounces+chris.krumme=windriver.com@nongnu.o
rg] On Behalf Of Alex Williamson
Sent: Wednesday, January 07, 2009 11:38 AM
To: kvm; qemu-devel
Cc: Mark McLoughlin
Subject: [Qemu-devel] [PATCH 2/5][RFC] virtio-net: Add 
load/save for statusbits

virtio-net: Add load/save for status bits

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
---

 hw/virtio-net.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

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);
+
    

Hello,

I know this is a late reply, but just thought I would ask:

You have the magic number 2 here, and change it to three in patch 5/5,
should this not be VIRTIO_VM_VERSION?  Or a comment about where the
number comes from.

  
It is the version of the stated saved for virtio net device. The driver does not
know anything about it. The version number syncs between the source & destination
qemu. The numbering started with '1' and we increase it each time we save a new field.


Thanks
Chris

  

--------------050107040006070709050305--