qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 6/6] qdev/compat: virtio-net-pci 0.10 compatibility.
Date: Mon, 13 Jul 2009 17:30:05 +0200	[thread overview]
Message-ID: <1247499005-31011-7-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1247499005-31011-1-git-send-email-kraxel@redhat.com>


Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/pc.c         |    4 ++++
 hw/virtio-pci.c |   27 ++++++++++++++++++++++++---
 2 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/hw/pc.c b/hw/pc.c
index e1187dd..da740f4 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1471,6 +1471,10 @@ static QEMUMachine pc_machine_v0_10 = {
             .driver   = "virtio-console-pci",
             .property = "class",
             .value    = stringify(PCI_CLASS_DISPLAY_OTHER),
+        },{
+            .driver   = "virtio-net-pci",
+            .property = "vectors",
+            .value    = stringify(0),
         },
         { /* end of list */ }
     },
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index f186b53..703f4fe 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -19,6 +19,7 @@
 #include "pci.h"
 //#include "sysemu.h"
 #include "msix.h"
+#include "net.h"
 
 /* from Linux's linux/virtio_pci.h */
 
@@ -87,6 +88,7 @@ typedef struct {
     VirtIODevice *vdev;
     uint32_t addr;
     uint32_t class_code;
+    uint32_t nvectors;
 } VirtIOPCIProxy;
 
 /* virtio device */
@@ -460,11 +462,21 @@ static void virtio_net_init_pci(PCIDevice *pci_dev)
     VirtIODevice *vdev;
 
     vdev = virtio_net_init(&pci_dev->qdev);
+
+    /* set nvectors from property, unless the user specified something
+     * via -net nic,model=virtio,vectors=n command line option */
+    if (pci_dev->qdev.nd->nvectors == NIC_NVECTORS_UNSPECIFIED)
+        if (proxy->nvectors != NIC_NVECTORS_UNSPECIFIED)
+            vdev->nvectors = proxy->nvectors;
+
     virtio_init_pci(proxy, vdev,
                     PCI_VENDOR_ID_REDHAT_QUMRANET,
                     PCI_DEVICE_ID_VIRTIO_NET,
                     PCI_CLASS_NETWORK_ETHERNET,
                     0x00);
+
+    /* make the actual value visible */
+    proxy->nvectors = vdev->nvectors;
 }
 
 static void virtio_balloon_init_pci(PCIDevice *pci_dev)
@@ -494,9 +506,18 @@ static PCIDeviceInfo virtio_info[] = {
             {/* end of list */}
         },
     },{
-        .qdev.name = "virtio-net-pci",
-        .qdev.size = sizeof(VirtIOPCIProxy),
-        .init      = virtio_net_init_pci,
+        .qdev.name  = "virtio-net-pci",
+        .qdev.size  = sizeof(VirtIOPCIProxy),
+        .init       = virtio_net_init_pci,
+        .qdev.props = (Property[]) {
+            {
+                .name   = "vectors",
+                .info   = &qdev_prop_uint32,
+                .offset = offsetof(VirtIOPCIProxy, nvectors),
+                .defval = (uint32_t[]) { NIC_NVECTORS_UNSPECIFIED },
+            },
+            {/* end of list */}
+        },
     },{
         .qdev.name = "virtio-console-pci",
         .qdev.size = sizeof(VirtIOPCIProxy),
-- 
1.6.2.5

  parent reply	other threads:[~2009-07-13 15:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-13 15:29 [Qemu-devel] [PATCH v3 0/7] qdev: compat properties Gerd Hoffmann
2009-07-13 15:30 ` [Qemu-devel] [PATCH 1/6] cleanup: drop unused struct elements from VirtIOPCIProxy Gerd Hoffmann
2009-07-13 15:30 ` [Qemu-devel] [PATCH 2/6] qdev/compat: compat property infrastructure Gerd Hoffmann
2009-07-13 19:36   ` Michael S. Tsirkin
2009-07-14  6:26     ` Gerd Hoffmann
2009-07-14  9:09       ` [Qemu-devel] " Juan Quintela
2009-07-14 14:19         ` Gerd Hoffmann
2009-07-13 15:30 ` [Qemu-devel] [PATCH 3/6] qdev/compat: add pc-0.10 machine type Gerd Hoffmann
2009-07-13 15:30 ` [Qemu-devel] [PATCH 4/6] qdev/compat: virtio-blk-pci 0.10 compatibility Gerd Hoffmann
2009-07-13 15:30 ` [Qemu-devel] [PATCH 5/6] qdev/compat: virtio-console-pci " Gerd Hoffmann
2009-07-13 15:30 ` Gerd Hoffmann [this message]
2009-07-13 15:47 ` [Qemu-devel] [PATCH v3 0/7] qdev: compat properties Anthony Liguori
2009-07-13 18:42   ` Gerd Hoffmann
  -- strict thread matches above, loose matches on Subject: below --
2009-07-15 11:48 [Qemu-devel] [PATCH 0/6] " Gerd Hoffmann
2009-07-15 11:48 ` [Qemu-devel] [PATCH 6/6] qdev/compat: virtio-net-pci 0.10 compatibility Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1247499005-31011-7-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).