mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-24 12:22:20 +00:00
qemuBuildNicDevProps: Don't pass 'vhostfdSize'
All callers effectively pass 'net->driver.virtio.queues'. In case of the code in 'qemu_hotplug.c' this value was set to '1' if it was 0 before. Since 'qemuBuildNicDevProps' only uses it if it's greater than 1 we can remove all the extra complexity. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
29458f0491
commit
7c43765513
@ -4096,7 +4096,6 @@ qemuBuildLegacyNicStr(virDomainNetDef *net)
|
|||||||
virJSONValue *
|
virJSONValue *
|
||||||
qemuBuildNicDevProps(virDomainDef *def,
|
qemuBuildNicDevProps(virDomainDef *def,
|
||||||
virDomainNetDef *net,
|
virDomainNetDef *net,
|
||||||
size_t vhostfdSize,
|
|
||||||
virQEMUCaps *qemuCaps)
|
virQEMUCaps *qemuCaps)
|
||||||
{
|
{
|
||||||
g_autoptr(virJSONValue) props = NULL;
|
g_autoptr(virJSONValue) props = NULL;
|
||||||
@ -4133,7 +4132,7 @@ qemuBuildNicDevProps(virDomainDef *def,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vhostfdSize > 1) {
|
if (net->driver.virtio.queues > 1) {
|
||||||
if (net->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
|
if (net->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
|
||||||
/* ccw provides a one to one relation of fds to queues and
|
/* ccw provides a one to one relation of fds to queues and
|
||||||
* does not support the vectors option
|
* does not support the vectors option
|
||||||
@ -4144,7 +4143,7 @@ qemuBuildNicDevProps(virDomainDef *def,
|
|||||||
* we should add vectors=2*N+2 where N is the vhostfdSize
|
* we should add vectors=2*N+2 where N is the vhostfdSize
|
||||||
*/
|
*/
|
||||||
mq = VIR_TRISTATE_SWITCH_ON;
|
mq = VIR_TRISTATE_SWITCH_ON;
|
||||||
vectors = 2 * vhostfdSize + 2;
|
vectors = 2 * net->driver.virtio.queues + 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9009,7 +9008,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriver *driver,
|
|||||||
if (qemuCommandAddExtDevice(cmd, &net->info, def, qemuCaps) < 0)
|
if (qemuCommandAddExtDevice(cmd, &net->info, def, qemuCaps) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(nicprops = qemuBuildNicDevProps(def, net, net->driver.virtio.queues, qemuCaps)))
|
if (!(nicprops = qemuBuildNicDevProps(def, net, qemuCaps)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
if (qemuBuildDeviceCommandlineFromJSON(cmd, nicprops, def, qemuCaps) < 0)
|
if (qemuBuildDeviceCommandlineFromJSON(cmd, nicprops, def, qemuCaps) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -102,7 +102,6 @@ qemuBuildInterfaceConnect(virDomainObj *vm,
|
|||||||
virJSONValue *
|
virJSONValue *
|
||||||
qemuBuildNicDevProps(virDomainDef *def,
|
qemuBuildNicDevProps(virDomainDef *def,
|
||||||
virDomainNetDef *net,
|
virDomainNetDef *net,
|
||||||
size_t vhostfdSize,
|
|
||||||
virQEMUCaps *qemuCaps);
|
virQEMUCaps *qemuCaps);
|
||||||
|
|
||||||
char *qemuDeviceDriveHostAlias(virDomainDiskDef *disk);
|
char *qemuDeviceDriveHostAlias(virDomainDiskDef *disk);
|
||||||
|
@ -1191,7 +1191,6 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
|
|||||||
char **vhostfdName = NULL;
|
char **vhostfdName = NULL;
|
||||||
int *vhostfd = NULL;
|
int *vhostfd = NULL;
|
||||||
size_t vhostfdSize = 0;
|
size_t vhostfdSize = 0;
|
||||||
size_t queueSize = 0;
|
|
||||||
g_autoptr(virJSONValue) nicprops = NULL;
|
g_autoptr(virJSONValue) nicprops = NULL;
|
||||||
g_autoptr(virJSONValue) netprops = NULL;
|
g_autoptr(virJSONValue) netprops = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -1287,7 +1286,6 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
|
|||||||
tapfdSize = vhostfdSize = net->driver.virtio.queues;
|
tapfdSize = vhostfdSize = net->driver.virtio.queues;
|
||||||
if (!tapfdSize)
|
if (!tapfdSize)
|
||||||
tapfdSize = vhostfdSize = 1;
|
tapfdSize = vhostfdSize = 1;
|
||||||
queueSize = tapfdSize;
|
|
||||||
tapfd = g_new0(int, tapfdSize);
|
tapfd = g_new0(int, tapfdSize);
|
||||||
memset(tapfd, -1, sizeof(*tapfd) * tapfdSize);
|
memset(tapfd, -1, sizeof(*tapfd) * tapfdSize);
|
||||||
vhostfd = g_new0(int, vhostfdSize);
|
vhostfd = g_new0(int, vhostfdSize);
|
||||||
@ -1304,7 +1302,6 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
|
|||||||
tapfdSize = vhostfdSize = net->driver.virtio.queues;
|
tapfdSize = vhostfdSize = net->driver.virtio.queues;
|
||||||
if (!tapfdSize)
|
if (!tapfdSize)
|
||||||
tapfdSize = vhostfdSize = 1;
|
tapfdSize = vhostfdSize = 1;
|
||||||
queueSize = tapfdSize;
|
|
||||||
tapfd = g_new0(int, tapfdSize);
|
tapfd = g_new0(int, tapfdSize);
|
||||||
memset(tapfd, -1, sizeof(*tapfd) * tapfdSize);
|
memset(tapfd, -1, sizeof(*tapfd) * tapfdSize);
|
||||||
vhostfd = g_new0(int, vhostfdSize);
|
vhostfd = g_new0(int, vhostfdSize);
|
||||||
@ -1322,7 +1319,6 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
|
|||||||
tapfdSize = vhostfdSize = net->driver.virtio.queues;
|
tapfdSize = vhostfdSize = net->driver.virtio.queues;
|
||||||
if (!tapfdSize)
|
if (!tapfdSize)
|
||||||
tapfdSize = vhostfdSize = 1;
|
tapfdSize = vhostfdSize = 1;
|
||||||
queueSize = tapfdSize;
|
|
||||||
tapfd = g_new0(int, tapfdSize);
|
tapfd = g_new0(int, tapfdSize);
|
||||||
memset(tapfd, -1, sizeof(*tapfd) * tapfdSize);
|
memset(tapfd, -1, sizeof(*tapfd) * tapfdSize);
|
||||||
vhostfd = g_new0(int, vhostfdSize);
|
vhostfd = g_new0(int, vhostfdSize);
|
||||||
@ -1336,9 +1332,6 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
|
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
|
||||||
queueSize = net->driver.virtio.queues;
|
|
||||||
if (!queueSize)
|
|
||||||
queueSize = 1;
|
|
||||||
if (!qemuDomainSupportsNicdev(vm->def, net)) {
|
if (!qemuDomainSupportsNicdev(vm->def, net)) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Nicdev support unavailable"));
|
"%s", _("Nicdev support unavailable"));
|
||||||
@ -1388,9 +1381,6 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_NET_TYPE_VDPA:
|
case VIR_DOMAIN_NET_TYPE_VDPA:
|
||||||
queueSize = net->driver.virtio.queues;
|
|
||||||
if (!queueSize)
|
|
||||||
queueSize = 1;
|
|
||||||
if (qemuDomainAdjustMaxMemLock(vm, false) < 0)
|
if (qemuDomainAdjustMaxMemLock(vm, false) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
adjustmemlock = true;
|
adjustmemlock = true;
|
||||||
@ -1506,7 +1496,7 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
|
|||||||
for (i = 0; i < vhostfdSize; i++)
|
for (i = 0; i < vhostfdSize; i++)
|
||||||
VIR_FORCE_CLOSE(vhostfd[i]);
|
VIR_FORCE_CLOSE(vhostfd[i]);
|
||||||
|
|
||||||
if (!(nicprops = qemuBuildNicDevProps(vm->def, net, queueSize, priv->qemuCaps)))
|
if (!(nicprops = qemuBuildNicDevProps(vm->def, net, priv->qemuCaps)))
|
||||||
goto try_remove;
|
goto try_remove;
|
||||||
|
|
||||||
qemuDomainObjEnterMonitor(driver, vm);
|
qemuDomainObjEnterMonitor(driver, vm);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user