diff mbox

[1/2] virtio-net: pass host features to virtio_net_init

Message ID 1359846384-3771-2-git-send-email-aliguori@us.ibm.com
State New
Headers show

Commit Message

Anthony Liguori Feb. 2, 2013, 11:06 p.m. UTC
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 hw/s390x/s390-virtio-bus.c | 3 ++-
 hw/s390x/virtio-ccw.c      | 3 ++-
 hw/virtio-pci.c            | 3 ++-
 hw/virtio.h                | 3 ++-
 4 files changed, 8 insertions(+), 4 deletions(-)

Comments

Andreas Färber Feb. 3, 2013, 12:12 a.m. UTC | #1
Am 03.02.2013 00:06, schrieb Anthony Liguori:
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
> ---
>  hw/s390x/s390-virtio-bus.c | 3 ++-
>  hw/s390x/virtio-ccw.c      | 3 ++-
>  hw/virtio-pci.c            | 3 ++-
>  hw/virtio.h                | 3 ++-
>  4 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c
> index d467781..089ed92 100644
> --- a/hw/s390x/s390-virtio-bus.c
> +++ b/hw/s390x/s390-virtio-bus.c
> @@ -153,7 +153,8 @@ static int s390_virtio_net_init(VirtIOS390Device *dev)
>  {
>      VirtIODevice *vdev;
>  
> -    vdev = virtio_net_init((DeviceState *)dev, &dev->nic, &dev->net);
> +    vdev = virtio_net_init((DeviceState *)dev, &dev->nic, &dev->net,
> +                           dev->host_features);
>      if (!vdev) {
>          return -1;
>      }
> diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
> index 231f81e..d92e427 100644
> --- a/hw/s390x/virtio-ccw.c
> +++ b/hw/s390x/virtio-ccw.c
> @@ -555,7 +555,8 @@ static int virtio_ccw_net_init(VirtioCcwDevice *dev)
>  {
>      VirtIODevice *vdev;
>  
> -    vdev = virtio_net_init((DeviceState *)dev, &dev->nic, &dev->net);
> +    vdev = virtio_net_init((DeviceState *)dev, &dev->nic, &dev->net,
> +                           dev->host_features[0]);
>      if (!vdev) {
>          return -1;
>      }
> diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
> index 9abbcdf..a869f53 100644
> --- a/hw/virtio-pci.c
> +++ b/hw/virtio-pci.c
> @@ -997,7 +997,8 @@ static int virtio_net_init_pci(PCIDevice *pci_dev)
>      VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
>      VirtIODevice *vdev;
>  
> -    vdev = virtio_net_init(&pci_dev->qdev, &proxy->nic, &proxy->net);
> +    vdev = virtio_net_init(&pci_dev->qdev, &proxy->nic, &proxy->net,
> +                           proxy->host_features);
>  
>      vdev->nvectors = proxy->nvectors;
>      virtio_init_pci(proxy, vdev);
> diff --git a/hw/virtio.h b/hw/virtio.h
> index a29a54d..1e206b8 100644
> --- a/hw/virtio.h
> +++ b/hw/virtio.h
> @@ -243,7 +243,8 @@ typedef struct VirtIOBlkConf VirtIOBlkConf;
>  VirtIODevice *virtio_blk_init(DeviceState *dev, VirtIOBlkConf *blk);
>  struct virtio_net_conf;
>  VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf,
> -                              struct virtio_net_conf *net);
> +                              struct virtio_net_conf *net,
> +                              uint32_t host_features);
>  typedef struct virtio_serial_conf virtio_serial_conf;
>  VirtIODevice *virtio_serial_init(DeviceState *dev, virtio_serial_conf *serial);
>  VirtIODevice *virtio_balloon_init(DeviceState *dev);

The virtio_net_init() implementation went into 2/2 so this breaks.

Andreas
fred.konrad@greensocs.com Feb. 4, 2013, 7:32 a.m. UTC | #2
On 03/02/2013 00:06, Anthony Liguori wrote:
> Signed-off-by: Anthony Liguori<aliguori@us.ibm.com>
> ---
>   hw/s390x/s390-virtio-bus.c | 3 ++-
>   hw/s390x/virtio-ccw.c      | 3 ++-
>   hw/virtio-pci.c            | 3 ++-
>   hw/virtio.h                | 3 ++-
>   4 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c
> index d467781..089ed92 100644
> --- a/hw/s390x/s390-virtio-bus.c
> +++ b/hw/s390x/s390-virtio-bus.c
> @@ -153,7 +153,8 @@ static int s390_virtio_net_init(VirtIOS390Device *dev)
>   {
>       VirtIODevice *vdev;
>
> -    vdev = virtio_net_init((DeviceState *)dev,&dev->nic,&dev->net);
> +    vdev = virtio_net_init((DeviceState *)dev,&dev->nic,&dev->net,
> +                           dev->host_features);
>       if (!vdev) {
>           return -1;
>       }
> diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
> index 231f81e..d92e427 100644
> --- a/hw/s390x/virtio-ccw.c
> +++ b/hw/s390x/virtio-ccw.c
> @@ -555,7 +555,8 @@ static int virtio_ccw_net_init(VirtioCcwDevice *dev)
>   {
>       VirtIODevice *vdev;
>
> -    vdev = virtio_net_init((DeviceState *)dev,&dev->nic,&dev->net);
> +    vdev = virtio_net_init((DeviceState *)dev,&dev->nic,&dev->net,
> +                           dev->host_features[0]);
>       if (!vdev) {
>           return -1;
>       }
> diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
> index 9abbcdf..a869f53 100644
> --- a/hw/virtio-pci.c
> +++ b/hw/virtio-pci.c
> @@ -997,7 +997,8 @@ static int virtio_net_init_pci(PCIDevice *pci_dev)
>       VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
>       VirtIODevice *vdev;
>
> -    vdev = virtio_net_init(&pci_dev->qdev,&proxy->nic,&proxy->net);
> +    vdev = virtio_net_init(&pci_dev->qdev,&proxy->nic,&proxy->net,
> +                           proxy->host_features);
Can't you pass the multiqueue enabled flags through proxy->net?

It would be better for me, as I only pass virtio net conf to device and
never host_features field.

>
>       vdev->nvectors = proxy->nvectors;
>       virtio_init_pci(proxy, vdev);
> diff --git a/hw/virtio.h b/hw/virtio.h
> index a29a54d..1e206b8 100644
> --- a/hw/virtio.h
> +++ b/hw/virtio.h
> @@ -243,7 +243,8 @@ typedef struct VirtIOBlkConf VirtIOBlkConf;
>   VirtIODevice *virtio_blk_init(DeviceState *dev, VirtIOBlkConf *blk);
>   struct virtio_net_conf;
>   VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf,
> -                              struct virtio_net_conf *net);
> +                              struct virtio_net_conf *net,
> +                              uint32_t host_features);
>   typedef struct virtio_serial_conf virtio_serial_conf;
>   VirtIODevice *virtio_serial_init(DeviceState *dev, virtio_serial_conf *serial);
>   VirtIODevice *virtio_balloon_init(DeviceState *dev);
diff mbox

Patch

diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c
index d467781..089ed92 100644
--- a/hw/s390x/s390-virtio-bus.c
+++ b/hw/s390x/s390-virtio-bus.c
@@ -153,7 +153,8 @@  static int s390_virtio_net_init(VirtIOS390Device *dev)
 {
     VirtIODevice *vdev;
 
-    vdev = virtio_net_init((DeviceState *)dev, &dev->nic, &dev->net);
+    vdev = virtio_net_init((DeviceState *)dev, &dev->nic, &dev->net,
+                           dev->host_features);
     if (!vdev) {
         return -1;
     }
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
index 231f81e..d92e427 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -555,7 +555,8 @@  static int virtio_ccw_net_init(VirtioCcwDevice *dev)
 {
     VirtIODevice *vdev;
 
-    vdev = virtio_net_init((DeviceState *)dev, &dev->nic, &dev->net);
+    vdev = virtio_net_init((DeviceState *)dev, &dev->nic, &dev->net,
+                           dev->host_features[0]);
     if (!vdev) {
         return -1;
     }
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 9abbcdf..a869f53 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -997,7 +997,8 @@  static int virtio_net_init_pci(PCIDevice *pci_dev)
     VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
     VirtIODevice *vdev;
 
-    vdev = virtio_net_init(&pci_dev->qdev, &proxy->nic, &proxy->net);
+    vdev = virtio_net_init(&pci_dev->qdev, &proxy->nic, &proxy->net,
+                           proxy->host_features);
 
     vdev->nvectors = proxy->nvectors;
     virtio_init_pci(proxy, vdev);
diff --git a/hw/virtio.h b/hw/virtio.h
index a29a54d..1e206b8 100644
--- a/hw/virtio.h
+++ b/hw/virtio.h
@@ -243,7 +243,8 @@  typedef struct VirtIOBlkConf VirtIOBlkConf;
 VirtIODevice *virtio_blk_init(DeviceState *dev, VirtIOBlkConf *blk);
 struct virtio_net_conf;
 VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf,
-                              struct virtio_net_conf *net);
+                              struct virtio_net_conf *net,
+                              uint32_t host_features);
 typedef struct virtio_serial_conf virtio_serial_conf;
 VirtIODevice *virtio_serial_init(DeviceState *dev, virtio_serial_conf *serial);
 VirtIODevice *virtio_balloon_init(DeviceState *dev);