mirror of https://github.com/xemu-project/xemu.git
qdev: Add a DEV_NVECTORS_UNSPECIFIED enum for unspecified nr of MSI vectors
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> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
1a8e2aaa3f
commit
75422b0d38
|
@ -387,7 +387,7 @@ void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd)
|
||||||
qdev_prop_set_vlan(dev, "vlan", nd->vlan);
|
qdev_prop_set_vlan(dev, "vlan", nd->vlan);
|
||||||
if (nd->netdev)
|
if (nd->netdev)
|
||||||
qdev_prop_set_netdev(dev, "netdev", 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_exists(dev, "vectors")) {
|
||||||
qdev_prop_set_uint32(dev, "vectors", nd->nvectors);
|
qdev_prop_set_uint32(dev, "vectors", nd->nvectors);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,10 @@ enum DevState {
|
||||||
DEV_STATE_INITIALIZED,
|
DEV_STATE_INITIALIZED,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
DEV_NVECTORS_UNSPECIFIED = -1,
|
||||||
|
};
|
||||||
|
|
||||||
/* This structure should not be accessed directly. We declare it here
|
/* This structure should not be accessed directly. We declare it here
|
||||||
so that it can be embedded in individual device state structures. */
|
so that it can be embedded in individual device state structures. */
|
||||||
struct DeviceState {
|
struct DeviceState {
|
||||||
|
|
6
net.c
6
net.c
|
@ -35,6 +35,7 @@
|
||||||
#include "sysemu.h"
|
#include "sysemu.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "qemu_socket.h"
|
#include "qemu_socket.h"
|
||||||
|
#include "hw/qdev.h"
|
||||||
|
|
||||||
static QTAILQ_HEAD(, VLANState) vlans;
|
static QTAILQ_HEAD(, VLANState) vlans;
|
||||||
static QTAILQ_HEAD(, VLANClientState) non_vlan_clients;
|
static QTAILQ_HEAD(, VLANClientState) non_vlan_clients;
|
||||||
|
@ -804,8 +805,9 @@ static int net_init_nic(QemuOpts *opts,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
nd->nvectors = qemu_opt_get_number(opts, "vectors", NIC_NVECTORS_UNSPECIFIED);
|
nd->nvectors = qemu_opt_get_number(opts, "vectors",
|
||||||
if (nd->nvectors != NIC_NVECTORS_UNSPECIFIED &&
|
DEV_NVECTORS_UNSPECIFIED);
|
||||||
|
if (nd->nvectors != DEV_NVECTORS_UNSPECIFIED &&
|
||||||
(nd->nvectors < 0 || nd->nvectors > 0x7ffffff)) {
|
(nd->nvectors < 0 || nd->nvectors > 0x7ffffff)) {
|
||||||
qemu_error("invalid # of vectors: %d\n", nd->nvectors);
|
qemu_error("invalid # of vectors: %d\n", nd->nvectors);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in New Issue