* [Qemu-devel] [PATCH 1/2] qdev: Add a DEV_NVECTORS_UNSPECIFIED enum for unspecified nr of MSI vectors
@ 2010-02-25 11:54 Amit Shah
2010-02-25 11:54 ` [Qemu-devel] [PATCH 2/2] virtio-pci: Use DEV_NVECTORS_UNSPECIFIED instead of -1 for virtio-serial Amit Shah
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Amit Shah @ 2010-02-25 11:54 UTC (permalink / raw)
To: qemu-devel; +Cc: Amit Shah, mst
net.c used a constant to signify no MSI vectors were specified. Extend
that to all qdev devices.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reported-by: "Michael S. Tsirkin" <mst@redhat.com>
---
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];
--
1.6.2.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 2/2] virtio-pci: Use DEV_NVECTORS_UNSPECIFIED instead of -1 for virtio-serial
2010-02-25 11:54 [Qemu-devel] [PATCH 1/2] qdev: Add a DEV_NVECTORS_UNSPECIFIED enum for unspecified nr of MSI vectors Amit Shah
@ 2010-02-25 11:54 ` Amit Shah
2010-02-25 12:04 ` [Qemu-devel] " Michael S. Tsirkin
2010-02-25 12:02 ` [Qemu-devel] Re: [PATCH 1/2] qdev: Add a DEV_NVECTORS_UNSPECIFIED enum for unspecified nr of MSI vectors Michael S. Tsirkin
2010-03-09 14:25 ` [Qemu-devel] " Anthony Liguori
2 siblings, 1 reply; 5+ messages in thread
From: Amit Shah @ 2010-02-25 11:54 UTC (permalink / raw)
To: qemu-devel; +Cc: Amit Shah, mst
Use the named constant instead of -1.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reported-by: "Michael S. Tsirkin" <mst@redhat.com>
---
hw/virtio-pci.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index bcd40f7..799f664 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -500,8 +500,9 @@ static int virtio_serial_init_pci(PCIDevice *pci_dev)
if (!vdev) {
return -1;
}
- vdev->nvectors = proxy->nvectors == -1 ? proxy->max_virtserial_ports + 1
- : proxy->nvectors;
+ vdev->nvectors = proxy->nvectors == DEV_NVECTORS_UNSPECIFIED
+ ? proxy->max_virtserial_ports + 1
+ : proxy->nvectors;
virtio_init_pci(proxy, vdev,
PCI_VENDOR_ID_REDHAT_QUMRANET,
PCI_DEVICE_ID_VIRTIO_CONSOLE,
@@ -585,7 +586,8 @@ static PCIDeviceInfo virtio_info[] = {
.init = virtio_serial_init_pci,
.exit = virtio_exit_pci,
.qdev.props = (Property[]) {
- DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, -1),
+ DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors,
+ DEV_NVECTORS_UNSPECIFIED),
DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),
DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features),
DEFINE_PROP_UINT32("max_ports", VirtIOPCIProxy, max_virtserial_ports,
--
1.6.2.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] Re: [PATCH 1/2] qdev: Add a DEV_NVECTORS_UNSPECIFIED enum for unspecified nr of MSI vectors
2010-02-25 11:54 [Qemu-devel] [PATCH 1/2] qdev: Add a DEV_NVECTORS_UNSPECIFIED enum for unspecified nr of MSI vectors Amit Shah
2010-02-25 11:54 ` [Qemu-devel] [PATCH 2/2] virtio-pci: Use DEV_NVECTORS_UNSPECIFIED instead of -1 for virtio-serial Amit Shah
@ 2010-02-25 12:02 ` Michael S. Tsirkin
2010-03-09 14:25 ` [Qemu-devel] " Anthony Liguori
2 siblings, 0 replies; 5+ messages in thread
From: Michael S. Tsirkin @ 2010-02-25 12:02 UTC (permalink / raw)
To: Amit Shah; +Cc: qemu-devel
On Thu, Feb 25, 2010 at 05:24:43PM +0530, Amit Shah wrote:
> net.c used a constant to signify no MSI vectors were specified. Extend
> that to all qdev devices.
>
> Signed-off-by: Amit Shah <amit.shah@redhat.com>
> Reported-by: "Michael S. Tsirkin" <mst@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> 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];
> --
> 1.6.2.5
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] Re: [PATCH 2/2] virtio-pci: Use DEV_NVECTORS_UNSPECIFIED instead of -1 for virtio-serial
2010-02-25 11:54 ` [Qemu-devel] [PATCH 2/2] virtio-pci: Use DEV_NVECTORS_UNSPECIFIED instead of -1 for virtio-serial Amit Shah
@ 2010-02-25 12:04 ` Michael S. Tsirkin
0 siblings, 0 replies; 5+ messages in thread
From: Michael S. Tsirkin @ 2010-02-25 12:04 UTC (permalink / raw)
To: Amit Shah; +Cc: qemu-devel
On Thu, Feb 25, 2010 at 05:24:44PM +0530, Amit Shah wrote:
> Use the named constant instead of -1.
>
> Signed-off-by: Amit Shah <amit.shah@redhat.com>
> Reported-by: "Michael S. Tsirkin" <mst@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> hw/virtio-pci.c | 8 +++++---
> 1 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
> index bcd40f7..799f664 100644
> --- a/hw/virtio-pci.c
> +++ b/hw/virtio-pci.c
> @@ -500,8 +500,9 @@ static int virtio_serial_init_pci(PCIDevice *pci_dev)
> if (!vdev) {
> return -1;
> }
> - vdev->nvectors = proxy->nvectors == -1 ? proxy->max_virtserial_ports + 1
> - : proxy->nvectors;
> + vdev->nvectors = proxy->nvectors == DEV_NVECTORS_UNSPECIFIED
> + ? proxy->max_virtserial_ports + 1
> + : proxy->nvectors;
> virtio_init_pci(proxy, vdev,
> PCI_VENDOR_ID_REDHAT_QUMRANET,
> PCI_DEVICE_ID_VIRTIO_CONSOLE,
> @@ -585,7 +586,8 @@ static PCIDeviceInfo virtio_info[] = {
> .init = virtio_serial_init_pci,
> .exit = virtio_exit_pci,
> .qdev.props = (Property[]) {
> - DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, -1),
> + DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors,
> + DEV_NVECTORS_UNSPECIFIED),
> DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),
> DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features),
> DEFINE_PROP_UINT32("max_ports", VirtIOPCIProxy, max_virtserial_ports,
> --
> 1.6.2.5
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] qdev: Add a DEV_NVECTORS_UNSPECIFIED enum for unspecified nr of MSI vectors
2010-02-25 11:54 [Qemu-devel] [PATCH 1/2] qdev: Add a DEV_NVECTORS_UNSPECIFIED enum for unspecified nr of MSI vectors Amit Shah
2010-02-25 11:54 ` [Qemu-devel] [PATCH 2/2] virtio-pci: Use DEV_NVECTORS_UNSPECIFIED instead of -1 for virtio-serial Amit Shah
2010-02-25 12:02 ` [Qemu-devel] Re: [PATCH 1/2] qdev: Add a DEV_NVECTORS_UNSPECIFIED enum for unspecified nr of MSI vectors Michael S. Tsirkin
@ 2010-03-09 14:25 ` Anthony Liguori
2 siblings, 0 replies; 5+ messages in thread
From: Anthony Liguori @ 2010-03-09 14:25 UTC (permalink / raw)
To: Amit Shah; +Cc: qemu-devel, mst
On 02/25/2010 05:54 AM, Amit Shah wrote:
> net.c used a constant to signify no MSI vectors were specified. Extend
> that to all qdev devices.
>
> Signed-off-by: Amit Shah<amit.shah@redhat.com>
> Reported-by: "Michael S. Tsirkin"<mst@redhat.com>
>
Applied. Thanks.
Regards,
Anthony Liguori
> ---
> 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];
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-03-09 14:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-25 11:54 [Qemu-devel] [PATCH 1/2] qdev: Add a DEV_NVECTORS_UNSPECIFIED enum for unspecified nr of MSI vectors Amit Shah
2010-02-25 11:54 ` [Qemu-devel] [PATCH 2/2] virtio-pci: Use DEV_NVECTORS_UNSPECIFIED instead of -1 for virtio-serial Amit Shah
2010-02-25 12:04 ` [Qemu-devel] " Michael S. Tsirkin
2010-02-25 12:02 ` [Qemu-devel] Re: [PATCH 1/2] qdev: Add a DEV_NVECTORS_UNSPECIFIED enum for unspecified nr of MSI vectors Michael S. Tsirkin
2010-03-09 14:25 ` [Qemu-devel] " Anthony Liguori
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).