qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 2/5][RFC] virtio-net: Add load/save for status bits
@ 2009-01-07 17:37 Alex Williamson
  2009-01-07 18:12 ` [Qemu-devel] " Anthony Liguori
  2009-01-12 18:35 ` [Qemu-devel] [PATCH 2/5][RFC] virtio-net: Add load/save for statusbits Krumme, Chris
  0 siblings, 2 replies; 4+ messages in thread
From: Alex Williamson @ 2009-01-07 17:37 UTC (permalink / raw)
  To: kvm, qemu-devel; +Cc: Mark McLoughlin

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] Re: [PATCH 2/5][RFC] virtio-net: Add load/save for status bits
  2009-01-07 17:37 [Qemu-devel] [PATCH 2/5][RFC] virtio-net: Add load/save for status bits Alex Williamson
@ 2009-01-07 18:12 ` Anthony Liguori
  2009-01-12 18:35 ` [Qemu-devel] [PATCH 2/5][RFC] virtio-net: Add load/save for statusbits Krumme, Chris
  1 sibling, 0 replies; 4+ messages in thread
From: Anthony Liguori @ 2009-01-07 18:12 UTC (permalink / raw)
  To: Alex Williamson; +Cc: Mark McLoughlin, qemu-devel, kvm

Alex Williamson wrote:
> 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
> +
>   

virtio-net is now at 2 already because of the mergable buffers fix but 
this is definitely needed for Mark's set_link changes.

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [Qemu-devel] [PATCH 2/5][RFC] virtio-net: Add load/save for statusbits
  2009-01-07 17:37 [Qemu-devel] [PATCH 2/5][RFC] virtio-net: Add load/save for status bits Alex Williamson
  2009-01-07 18:12 ` [Qemu-devel] " Anthony Liguori
@ 2009-01-12 18:35 ` Krumme, Chris
  2009-01-12 20:41   ` Dor Laor
  1 sibling, 1 reply; 4+ messages in thread
From: Krumme, Chris @ 2009-01-12 18:35 UTC (permalink / raw)
  To: qemu-devel


> -----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.

Thanks
Chris

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH 2/5][RFC] virtio-net: Add load/save for statusbits
  2009-01-12 18:35 ` [Qemu-devel] [PATCH 2/5][RFC] virtio-net: Add load/save for statusbits Krumme, Chris
@ 2009-01-12 20:41   ` Dor Laor
  0 siblings, 0 replies; 4+ messages in thread
From: Dor Laor @ 2009-01-12 20:41 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 2226 bytes --]

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
>
>   


[-- Attachment #2: Type: text/html, Size: 2960 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-01-12 20:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-07 17:37 [Qemu-devel] [PATCH 2/5][RFC] virtio-net: Add load/save for status bits Alex Williamson
2009-01-07 18:12 ` [Qemu-devel] " Anthony Liguori
2009-01-12 18:35 ` [Qemu-devel] [PATCH 2/5][RFC] virtio-net: Add load/save for statusbits Krumme, Chris
2009-01-12 20:41   ` Dor Laor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).