Re: [PATCH 2/3] qemu_capabilities: Added capabilites for qemu's "rss" and "hash".

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 30, 2021 at 08:01:44 +0200, Andrew Melnychenko wrote:
> Added qemu's property check for virtio-net.
> And added capability QEMU_CAPS_VIRTIO_RSS.

Please name the new capability 'QEMU_CAPS_VIRTIO_NET_RSS' as it's
specific to virtio-net.

> With "rss" and "rss_hash_report" from domain config,
> qemu should enable "rss" and "hash" for virtio-net.
> If domain config contains "rss" and/or "rss_hash_report" options for driver.
> Libvirt will create an NIC device command line with enabled "rss"/"hash".
> 
> Signed-off-by: Andrew Melnychenko <andrew@xxxxxxxxxx>
> ---
>  src/qemu/qemu_capabilities.c |  2 ++
>  src/qemu/qemu_capabilities.h |  1 +
>  src/qemu/qemu_command.c      |  2 ++
>  src/qemu/qemu_validate.c     | 16 ++++++++++++++++
>  4 files changed, 21 insertions(+)
> 
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index 4f63322a9e..c36a0b22e1 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -653,6 +653,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
>                "query-dirty-rate", /* QEMU_CAPS_QUERY_DIRTY_RATE */
>                "rbd-encryption", /* QEMU_CAPS_RBD_ENCRYPTION */
>                "sev-guest-kernel-hashes", /* QEMU_CAPS_SEV_GUEST_KERNEL_HASHES */
> +              "virtio-net.rss", /* QEMU_CAPS_VIRTIO_RSS */
>      );
>  
>  
> @@ -1410,6 +1411,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioNet[] = {
>      { "failover", QEMU_CAPS_VIRTIO_NET_FAILOVER, NULL },
>      { "packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES, NULL },
>      { "acpi-index", QEMU_CAPS_ACPI_INDEX, NULL },
> +    { "rss", QEMU_CAPS_VIRTIO_RSS, NULL },
>  };
>  
>  static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsPCIeRootPort[] = {
> diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
> index aaac20a834..916a087169 100644
> --- a/src/qemu/qemu_capabilities.h
> +++ b/src/qemu/qemu_capabilities.h
> @@ -632,6 +632,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
>      QEMU_CAPS_QUERY_DIRTY_RATE, /* accepts query-dirty-rate */
>      QEMU_CAPS_RBD_ENCRYPTION, /* Ceph RBD encryption support */
>      QEMU_CAPS_SEV_GUEST_KERNEL_HASHES, /* sev-guest.kernel-hashes= */
> +    QEMU_CAPS_VIRTIO_RSS, /* virtio-net rss feature */
>  
>      QEMU_CAPS_LAST /* this must always be the last item */
>  } virQEMUCapsFlags;

'qemucapabilitiestest' fails after this patch because you didn't include
the required test data update in this commit.

Per our coding guidelines the tree must cleanly compile and pass
testsuite after every single commit [1].


[1]: https://www.libvirt.org/hacking.html#preparing-patches


> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index d822533ccb..dfe6eefd1e 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -4168,6 +4168,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)
> diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
> index 3a69733f81..399f5aa78f 100644
> --- a/src/qemu/qemu_validate.c
> +++ b/src/qemu/qemu_validate.c
> @@ -1743,6 +1743,22 @@ qemuValidateDomainDeviceDefNetwork(const virDomainNetDef *net,
>              }
>          }
>  
> +        if (net->driver.virtio.rss &&
> +            !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_RSS)) {
> +            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                           _("virtio rss is not supported with this "
> +                             "QEMU binary"));

Please no linebreaks in error messages. (so that they can be grepped in
the repository. We have an exception for the long line rule.

> +            return -1;
> +        }
> +
> +        if (net->driver.virtio.rss_hash_report &&
> +            !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_RSS)) {
> +            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                           _("virtio rss hash report is not supported with this "
> +                             "QEMU binary"));

Same here.


Aditionally, please split the non-capability changes into a new commit.

> +            return -1;
> +        }
> +
>          if (net->mtu &&
>              !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_HOST_MTU)) {
>              virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> -- 
> 2.34.1
> 




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux