From patchwork Thu Feb 25 11:54:43 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Shah X-Patchwork-Id: 46234 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 501CBB7B98 for ; Thu, 25 Feb 2010 22:59:34 +1100 (EST) Received: from localhost ([127.0.0.1]:53118 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NkcLW-0006En-1R for incoming@patchwork.ozlabs.org; Thu, 25 Feb 2010 06:57:34 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NkcKI-0006Dx-Ai for qemu-devel@nongnu.org; Thu, 25 Feb 2010 06:56:18 -0500 Received: from [199.232.76.173] (port=59048 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NkcKI-0006Dk-0p for qemu-devel@nongnu.org; Thu, 25 Feb 2010 06:56:18 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NkcKD-00010l-VG for qemu-devel@nongnu.org; Thu, 25 Feb 2010 06:56:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:23824) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NkcKA-00010E-Rp for qemu-devel@nongnu.org; Thu, 25 Feb 2010 06:56:13 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o1PBu1qH032485 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 25 Feb 2010 06:56:01 -0500 Received: from localhost (vpn-233-100.phx2.redhat.com [10.3.233.100]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o1PBu0v9027565; Thu, 25 Feb 2010 06:56:01 -0500 From: Amit Shah To: qemu-devel@nongnu.org Date: Thu, 25 Feb 2010 17:24:43 +0530 Message-Id: <1267098884-5103-1-git-send-email-amit.shah@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Amit Shah , mst@redhat.com Subject: [Qemu-devel] [PATCH 1/2] qdev: Add a DEV_NVECTORS_UNSPECIFIED enum for unspecified nr of MSI vectors X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org net.c used a constant to signify no MSI vectors were specified. Extend that to all qdev devices. Signed-off-by: Amit Shah Reported-by: "Michael S. Tsirkin" Acked-by: Michael S. Tsirkin --- hw/qdev.c | 2 +- hw/qdev.h | 4 ++++ net.c | 6 ++++-- net.h | 3 --- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/hw/qdev.c b/hw/qdev.c index d0052d4..b634890 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -387,7 +387,7 @@ void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd) qdev_prop_set_vlan(dev, "vlan", nd->vlan); if (nd->netdev) qdev_prop_set_netdev(dev, "netdev", nd->netdev); - if (nd->nvectors != NIC_NVECTORS_UNSPECIFIED && + if (nd->nvectors != DEV_NVECTORS_UNSPECIFIED && qdev_prop_exists(dev, "vectors")) { qdev_prop_set_uint32(dev, "vectors", nd->nvectors); } diff --git a/hw/qdev.h b/hw/qdev.h index 0eb45b0..adfcf79 100644 --- a/hw/qdev.h +++ b/hw/qdev.h @@ -24,6 +24,10 @@ enum DevState { DEV_STATE_INITIALIZED, }; +enum { + DEV_NVECTORS_UNSPECIFIED = -1, +}; + /* This structure should not be accessed directly. We declare it here so that it can be embedded in individual device state structures. */ struct DeviceState { diff --git a/net.c b/net.c index a1bf49f..dd3962e 100644 --- a/net.c +++ b/net.c @@ -35,6 +35,7 @@ #include "sysemu.h" #include "qemu-common.h" #include "qemu_socket.h" +#include "hw/qdev.h" static QTAILQ_HEAD(, VLANState) vlans; static QTAILQ_HEAD(, VLANClientState) non_vlan_clients; @@ -804,8 +805,9 @@ static int net_init_nic(QemuOpts *opts, return -1; } - nd->nvectors = qemu_opt_get_number(opts, "vectors", NIC_NVECTORS_UNSPECIFIED); - if (nd->nvectors != NIC_NVECTORS_UNSPECIFIED && + nd->nvectors = qemu_opt_get_number(opts, "vectors", + DEV_NVECTORS_UNSPECIFIED); + if (nd->nvectors != DEV_NVECTORS_UNSPECIFIED && (nd->nvectors < 0 || nd->nvectors > 0x7ffffff)) { qemu_error("invalid # of vectors: %d\n", nd->nvectors); return -1; diff --git a/net.h b/net.h index 33a1eaf..16f19c5 100644 --- a/net.h +++ b/net.h @@ -123,9 +123,6 @@ void do_set_link(Monitor *mon, const QDict *qdict); /* NIC info */ #define MAX_NICS 8 -enum { - NIC_NVECTORS_UNSPECIFIED = -1 -}; struct NICInfo { uint8_t macaddr[6];