mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-03 02:15:23 +00:00
qemuDomainAttachNetDevice: Use 'qemuFDPass' for the vdpa file descriptor
We use the qemuFDPass infrastructure when building the command line, refactor the monitor too. 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
5077263ecb
commit
1d3e955938
@ -1184,8 +1184,8 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
|
|||||||
virErrorPtr originalError = NULL;
|
virErrorPtr originalError = NULL;
|
||||||
g_autofree char *slirpfdName = NULL;
|
g_autofree char *slirpfdName = NULL;
|
||||||
int slirpfd = -1;
|
int slirpfd = -1;
|
||||||
g_autofree char *vdpafdName = NULL;
|
|
||||||
int vdpafd = -1;
|
int vdpafd = -1;
|
||||||
|
g_autoptr(qemuFDPass) vdpa = NULL;
|
||||||
char **tapfdName = NULL;
|
char **tapfdName = NULL;
|
||||||
int *tapfd = NULL;
|
int *tapfd = NULL;
|
||||||
size_t tapfdSize = 0;
|
size_t tapfdSize = 0;
|
||||||
@ -1394,6 +1394,10 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
|
|||||||
|
|
||||||
if ((vdpafd = qemuInterfaceVDPAConnect(net)) < 0)
|
if ((vdpafd = qemuInterfaceVDPAConnect(net)) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
vdpa = qemuFDPassNew(net->info.alias, priv);
|
||||||
|
|
||||||
|
qemuFDPassAddFD(vdpa, &vdpafd, "-vdpa");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_NET_TYPE_SERVER:
|
case VIR_DOMAIN_NET_TYPE_SERVER:
|
||||||
@ -1455,24 +1459,15 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
|
|||||||
|
|
||||||
qemuDomainObjEnterMonitor(driver, vm);
|
qemuDomainObjEnterMonitor(driver, vm);
|
||||||
|
|
||||||
if (vdpafd > 0) {
|
if (qemuFDPassTransferMonitor(vdpa, priv->mon) < 0) {
|
||||||
/* vhost-vdpa only accepts a filename. We can pass an open fd by
|
qemuDomainObjExitMonitor(vm);
|
||||||
* filename if we add the fd to an fdset and then pass a filename of
|
goto cleanup;
|
||||||
* /dev/fdset/$FDSETID. */
|
|
||||||
qemuMonitorAddFdInfo fdinfo;
|
|
||||||
if (qemuMonitorAddFileHandleToSet(priv->mon, vdpafd, -1,
|
|
||||||
net->data.vdpa.devicepath,
|
|
||||||
&fdinfo) < 0) {
|
|
||||||
qemuDomainObjExitMonitor(vm);
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
vdpafdName = g_strdup_printf("/dev/fdset/%d", fdinfo.fdset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(netprops = qemuBuildHostNetProps(net,
|
if (!(netprops = qemuBuildHostNetProps(net,
|
||||||
tapfdName, tapfdSize,
|
tapfdName, tapfdSize,
|
||||||
vhostfdName, vhostfdSize,
|
vhostfdName, vhostfdSize,
|
||||||
slirpfdName, vdpafdName))) {
|
slirpfdName, qemuFDPassGetPath(vdpa)))) {
|
||||||
qemuDomainObjExitMonitor(vm);
|
qemuDomainObjExitMonitor(vm);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user