]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_command: Generate cmd line for virtio-net.rss hash properties
authorAndrew Melnychenko <andrew@daynix.com>
Sun, 9 Jan 2022 21:07:37 +0000 (23:07 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 5 Apr 2022 13:36:30 +0000 (15:36 +0200)
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>
src/qemu/qemu_command.c
src/qemu/qemu_validate.c
tests/qemuxml2argvdata/net-virtio-rss.x86_64-latest.args [new file with mode: 0644]
tests/qemuxml2argvdata/virtio-options.x86_64-latest.args
tests/qemuxml2argvtest.c

index 1f2212469cecd73d5746e877ccfacff1df7da8f9..bb45954108b0303938b71aa44a2f96ed35d47f2e 100644 (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)
index 0ffe02be5b86fe166aace43e320d92d36bffcece..96f542767889f355c3756f6901ae334265d5c09c 100644 (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",
diff --git a/tests/qemuxml2argvdata/net-virtio-rss.x86_64-latest.args b/tests/qemuxml2argvdata/net-virtio-rss.x86_64-latest.args
new file mode 100644 (file)
index 0000000..cabea93
--- /dev/null
@@ -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
index 48f6b23c0d710c8a637d9d5d307dfebb451aeaab..ff21b4bf4a968efc71d5108b8b8bf935a2787893 100644 (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"}' \
index a840fa6853f33500cc2827239cb7b31304b4388d..ed41b7a7a269224678188672dd8a78b999202937 100644 (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,