From ffe6370c9f2a596814bf14e472910fe6ef7e001d Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Sun, 21 Jun 2009 19:51:18 +0300 Subject: qemu/net: flag to control the number of vectors a nic has Add an option to specify the number of MSI-X vectors for PCI NIC cards. This can also be used to disable MSI-X, for compatibility with old qemu. This option currently only affects virtio cards. Signed-off-by: Michael S. Tsirkin Signed-off-by: Anthony Liguori --- net.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'net.c') diff --git a/net.c b/net.c index 55f70f2..4ca2817 100644 --- a/net.c +++ b/net.c @@ -2169,7 +2169,7 @@ int net_client_init(Monitor *mon, const char *device, const char *p) } if (!strcmp(device, "nic")) { static const char * const nic_params[] = { - "vlan", "name", "macaddr", "model", "addr", NULL + "vlan", "name", "macaddr", "model", "addr", "vectors", NULL }; NICInfo *nd; uint8_t *macaddr; @@ -2207,6 +2207,22 @@ int net_client_init(Monitor *mon, const char *device, const char *p) if (get_param_value(buf, sizeof(buf), "addr", p)) { nd->devaddr = strdup(buf); } + nd->nvectors = NIC_NVECTORS_UNSPECIFIED; + if (get_param_value(buf, sizeof(buf), "vectors", p)) { + char *endptr; + long vectors = strtol(buf, &endptr, 0); + if (*endptr) { + config_error(mon, "invalid syntax for # of vectors\n"); + ret = -1; + goto out; + } + if (vectors < 0 || vectors > 0x7ffffff) { + config_error(mon, "invalid # of vectors\n"); + ret = -1; + goto out; + } + nd->nvectors = vectors; + } nd->vlan = vlan; nd->name = name; nd->used = 1; -- cgit v1.1