From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MQNTw-0007uy-QG for qemu-devel@nongnu.org; Mon, 13 Jul 2009 11:30:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MQNTr-0007sa-Iz for qemu-devel@nongnu.org; Mon, 13 Jul 2009 11:30:20 -0400 Received: from [199.232.76.173] (port=33436 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MQNTr-0007sL-CC for qemu-devel@nongnu.org; Mon, 13 Jul 2009 11:30:15 -0400 Received: from mx2.redhat.com ([66.187.237.31]:51073) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MQNTq-0000uN-Qr for qemu-devel@nongnu.org; Mon, 13 Jul 2009 11:30:15 -0400 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 n6DFUEg9015530 for ; Mon, 13 Jul 2009 11:30:14 -0400 From: Gerd Hoffmann Date: Mon, 13 Jul 2009 17:30:05 +0200 Message-Id: <1247499005-31011-7-git-send-email-kraxel@redhat.com> In-Reply-To: <1247499005-31011-1-git-send-email-kraxel@redhat.com> References: <1247499005-31011-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 6/6] qdev/compat: virtio-net-pci 0.10 compatibility. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann Signed-off-by: Gerd Hoffmann --- 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