qemu_command: Generate cmd line for virtio-net.rss hash properties

Also, validate that the requested feature is supported by QEMU.

Signed-off-by: Andrew Melnychenko <andrew@daynix.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Andrew Melnychenko 2022-01-09 23:07:37 +02:00 committed by Michal Privoznik
parent 7ab013655d
commit 4e4def21d3
5 changed files with 61 additions and 1 deletions

View File

@ -4149,6 +4149,8 @@ qemuBuildNicDevProps(virDomainDef *def,
"P:vectors", vectors,
"p:rx_queue_size", net->driver.virtio.rx_queue_size,
"p:tx_queue_size", net->driver.virtio.tx_queue_size,
"T:rss", net->driver.virtio.rss,
"T:hash", net->driver.virtio.rss_hash_report,
"p:host_mtu", net->mtu,
"T:failover", failover,
NULL) < 0)

View File

@ -1750,6 +1750,20 @@ qemuValidateDomainDeviceDefNetwork(const virDomainNetDef *net,
}
}
if (net->driver.virtio.rss &&
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_RSS)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("virtio rss is not supported with this QEMU binary"));
return -1;
}
if (net->driver.virtio.rss_hash_report &&
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_RSS)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("virtio rss hash report is not supported with this QEMU binary"));
return -1;
}
if (net->mtu &&
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_HOST_MTU)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",

View File

@ -0,0 +1,43 @@
LC_ALL=C \
PATH=/bin \
HOME=/tmp/lib/domain--1-QEMUGuest1 \
USER=test \
LOGNAME=test \
XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
/usr/bin/qemu-system-x86_64 \
-name guest=QEMUGuest1,debug-threads=on \
-S \
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}' \
-machine pc,usb=off,dump-guest-core=off,memory-backend=pc.ram \
-accel tcg \
-cpu qemu64 \
-m 214 \
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
-overcommit mem-lock=off \
-smp 1,sockets=1,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-display none \
-no-user-config \
-nodefaults \
-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
-mon chardev=charmonitor,id=monitor,mode=control \
-rtc base=utc \
-no-shutdown \
-no-acpi \
-boot strict=on \
-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
-device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-format","id":"ide0-0-0","bootindex":1}' \
-netdev user,id=hostnet0 \
-device '{"driver":"virtio-net-pci","rss":true,"netdev":"hostnet0","id":"net0","mac":"00:11:22:33:44:55","bus":"pci.0","addr":"0x2"}' \
-netdev user,id=hostnet1 \
-device '{"driver":"virtio-net-pci","hash":true,"netdev":"hostnet1","id":"net1","mac":"00:11:22:33:44:66","bus":"pci.0","addr":"0x3"}' \
-netdev user,id=hostnet2 \
-device '{"driver":"virtio-net-pci","rss":false,"hash":true,"netdev":"hostnet2","id":"net2","mac":"00:11:22:33:44:77","bus":"pci.0","addr":"0x4"}' \
-audiodev '{"id":"audio1","driver":"none"}' \
-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","addr":"0x5"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
-msg timestamp=on

View File

@ -38,7 +38,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
-fsdev local,security_model=mapped,writeout=immediate,id=fsdev-fs1,path=/export/fs2 \
-device '{"driver":"virtio-9p-pci","iommu_platform":true,"ats":true,"packed":true,"page-per-vq":true,"id":"fs1","fsdev":"fsdev-fs1","mount_tag":"fs2","bus":"pci.0","addr":"0x4"}' \
-netdev user,id=hostnet0 \
-device '{"driver":"virtio-net-pci","iommu_platform":true,"ats":true,"packed":true,"page-per-vq":true,"netdev":"hostnet0","id":"net0","mac":"52:54:56:58:5a:5c","bus":"pci.0","addr":"0x6"}' \
-device '{"driver":"virtio-net-pci","iommu_platform":true,"ats":true,"packed":true,"page-per-vq":true,"rss":true,"hash":true,"netdev":"hostnet0","id":"net0","mac":"52:54:56:58:5a:5c","bus":"pci.0","addr":"0x6"}' \
-device '{"driver":"virtio-mouse-pci","iommu_platform":true,"ats":true,"packed":true,"page-per-vq":true,"id":"input0","bus":"pci.0","addr":"0xe"}' \
-device '{"driver":"virtio-keyboard-pci","iommu_platform":true,"ats":true,"packed":true,"page-per-vq":true,"id":"input1","bus":"pci.0","addr":"0x10"}' \
-device '{"driver":"virtio-tablet-pci","iommu_platform":true,"ats":true,"packed":true,"page-per-vq":true,"id":"input2","bus":"pci.0","addr":"0x11"}' \

View File

@ -1594,6 +1594,7 @@ mymain(void)
QEMU_CAPS_DEVICE_VFIO_PCI);
DO_TEST_CAPS_LATEST("net-vdpa");
DO_TEST_CAPS_LATEST("net-vdpa-multiqueue");
DO_TEST_CAPS_LATEST("net-virtio-rss");
DO_TEST("hostdev-pci-multifunction",
QEMU_CAPS_KVM,