On 05/16/2013 08:49 AM, Michal Privoznik wrote: > With multiqueue network feature, we are advised to pass multiple > vhost-net FDs as well. The ratio should be 1:1. Therefore we must > alter the qemuOpenVhostNet function to allow that. > --- > src/qemu/qemu_command.c | 60 ++++++++++++++++++++++++++++++++++++------------- > src/qemu/qemu_command.h | 3 ++- > src/qemu/qemu_hotplug.c | 12 ++++++---- > 3 files changed, 54 insertions(+), 21 deletions(-) > > diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c > index a053d49..ec66a33 100644 > --- a/src/qemu/qemu_command.c > +++ b/src/qemu/qemu_command.c > @@ -405,17 +405,34 @@ cleanup: > } > > > +/** > + * qemuOpenVhostNet: > + * @def: domain definition > + * @net: network definition > + * @qemuCaps: qemu binary capabilities > + * @vhostfd: array of opened vhost-net device > + * @vhostfdSize: size of @vhostfd array > + * > + * Open vhost-net, multiple times - if requested. > + * In case, no vhost-net is needed, @vhostfdSize is set to 0 > + * and 0 is returned. > + * > + * Returns: 0 on success > + * -1 on failure > + */ > int > qemuOpenVhostNet(virDomainDefPtr def, > virDomainNetDefPtr net, > virQEMUCapsPtr qemuCaps, > - int *vhostfd) > + int *vhostfd, > + int *vhostfdSize) > { > - *vhostfd = -1; /* assume we won't use vhost */ > + int i; > > /* If the config says explicitly to not use vhost, return now */ > if (net->driver.virtio.name == VIR_DOMAIN_NET_BACKEND_TYPE_QEMU) { > - return 0; > + *vhostfdSize = 0; > + return 0; > } > > /* If qemu doesn't support vhost-net mode (including the -netdev command > @@ -430,6 +447,7 @@ qemuOpenVhostNet(virDomainDefPtr def, > "this QEMU binary")); > return -1; > } > + *vhostfdSize = 0; > return 0; > } > > @@ -441,23 +459,32 @@ qemuOpenVhostNet(virDomainDefPtr def, > "virtio network interfaces")); > return -1; > } > + *vhostfdSize = 0; > return 0; > } > > - *vhostfd = open("/dev/vhost-net", O_RDWR); > - virDomainAuditNetDevice(def, net, "/dev/vhost-net", *vhostfd >= 0); > + for (i = 0; i < *vhostfdSize; i++) { > + vhostfd[i] = open("/dev/vhost-net", O_RDWR); > + virDomainAuditNetDevice(def, net, "/dev/vhost-net", vhostfd[i] >= 0); I just realized while reviewing the next patch that we probably only want a single audit message here, rather than one for each individual fd. -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list