[RFC PATCH 01/10] domain_conf: Added configs for RSS and Hash report.

Andrew Melnychenko posted 10 patches 4 years, 6 months ago
There is a newer version of this series
[RFC PATCH 01/10] domain_conf: Added configs for RSS and Hash report.
Posted by Andrew Melnychenko 4 years, 6 months ago
Added "rss" and "rss_hash_report" configuration that should be used with
qemu virtio RSS.
Both options are triswitches. Used as "driver" options and affects only NIC
with model type "virtio".
In other patches - options should turn on virtio-net RSS and hash properties.
Also "rss" may used to affect "ebpf_rss_fds" property of virtio-net in qemu.

Signed-off-by: Andrew Melnychenko <andrew@daynix.com>
---
 src/conf/domain_conf.c | 31 ++++++++++++++++++++++++++++++-
 src/conf/domain_conf.h |  2 ++
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 06c1fcf5e5..7289acc9c6 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10244,6 +10244,8 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
     g_autofree char *vhost_path = NULL;
     g_autofree char *tap = NULL;
     g_autofree char *vhost = NULL;
+    g_autofree char *virtio_rss = NULL;
+    g_autofree char *virtio_rss_hash_report = NULL;
     const char *prefix = xmlopt ? xmlopt->config.netPrefix : NULL;
 
     if (!(def = virDomainNetDefNew(xmlopt)))
@@ -10385,6 +10387,8 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
     queues = virXMLPropString(driver_node, "queues");
     rx_queue_size = virXMLPropString(driver_node, "rx_queue_size");
     tx_queue_size = virXMLPropString(driver_node, "tx_queue_size");
+    virtio_rss = virXMLPropString(driver_node, "rss");
+    virtio_rss_hash_report = virXMLPropString(driver_node, "rss_hash_report");
 
     if ((filterref_node = virXPathNode("./filterref", ctxt))) {
         filter = virXMLPropString(filterref_node, "filter");
@@ -10796,7 +10800,24 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
             }
             def->driver.virtio.tx_queue_size = q;
         }
-
+        if (virtio_rss) {
+            if ((val = virTristateSwitchTypeFromString(virtio_rss)) <= 0) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                        _("'rss' attribute must be 'on'/'off'/'default': %s"),
+                        virtio_rss);
+                goto error;
+            }
+            def->driver.virtio.rss = val;
+        }
+        if (virtio_rss_hash_report) {
+            if ((val = virTristateSwitchTypeFromString(virtio_rss_hash_report)) <= 0) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                        _("'rss_hash_report' attribute must be 'on'/'off'/'default': %s"),
+                        virtio_rss_hash_report);
+                goto error;
+            }
+            def->driver.virtio.rss_hash_report = val;
+        }
         if ((tmpNode = virXPathNode("./driver/host", ctxt))) {
             if (virXMLPropTristateSwitch(tmpNode, "csum", VIR_XML_PROP_NONE,
                                          &def->driver.virtio.host.csum) < 0)
@@ -24568,6 +24589,14 @@ virDomainVirtioNetDriverFormat(virBuffer *buf,
     if (def->driver.virtio.tx_queue_size)
         virBufferAsprintf(buf, " tx_queue_size='%u'",
                           def->driver.virtio.tx_queue_size);
+    if (def->driver.virtio.rss != VIR_TRISTATE_SWITCH_ABSENT) {
+        virBufferAsprintf(buf, " rss='%s'",
+                          virTristateSwitchTypeToString(def->driver.virtio.rss));
+    }
+    if (def->driver.virtio.rss_hash_report != VIR_TRISTATE_SWITCH_ABSENT) {
+        virBufferAsprintf(buf, " rss_hash_report='%s'",
+                          virTristateSwitchTypeToString(def->driver.virtio.rss_hash_report));
+    }
 
     virDomainVirtioOptionsFormat(buf, def->virtio);
 }
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index ca21082624..60cb70b204 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1046,6 +1046,8 @@ struct _virDomainNetDef {
                 virTristateSwitch ecn;
                 virTristateSwitch ufo;
             } guest;
+            virTristateSwitch rss;
+            virTristateSwitch rss_hash_report;
         } virtio;
     } driver;
     struct {
-- 
2.31.1

Re: [RFC PATCH 01/10] domain_conf: Added configs for RSS and Hash report.
Posted by Michal Prívozník 4 years, 5 months ago
On 7/28/21 10:17 AM, Andrew Melnychenko wrote:
> Added "rss" and "rss_hash_report" configuration that should be used with
> qemu virtio RSS.
> Both options are triswitches. Used as "driver" options and affects only NIC
> with model type "virtio".
> In other patches - options should turn on virtio-net RSS and hash properties.
> Also "rss" may used to affect "ebpf_rss_fds" property of virtio-net in qemu.
> 
> Signed-off-by: Andrew Melnychenko <andrew@daynix.com>
> ---
>  src/conf/domain_conf.c | 31 ++++++++++++++++++++++++++++++-
>  src/conf/domain_conf.h |  2 ++
>  2 files changed, 32 insertions(+), 1 deletion(-)

Any change to domain XML should go hand in hand with RNG update
(docs/schemas/...) and documentation (i.e. squash 10/10 into this one).
Ideally, the patch would also introduce xml2xml test (in this case
qemuxml2xmltest looks reasonable).

Michal

Re: [RFC PATCH 01/10] domain_conf: Added configs for RSS and Hash report.
Posted by Andrew Melnichenko 4 years, 5 months ago
Hi,
I'll squash it and add tests.

On Fri, Aug 20, 2021 at 3:57 PM Michal Prívozník <mprivozn@redhat.com>
wrote:

> On 7/28/21 10:17 AM, Andrew Melnychenko wrote:
> > Added "rss" and "rss_hash_report" configuration that should be used with
> > qemu virtio RSS.
> > Both options are triswitches. Used as "driver" options and affects only
> NIC
> > with model type "virtio".
> > In other patches - options should turn on virtio-net RSS and hash
> properties.
> > Also "rss" may used to affect "ebpf_rss_fds" property of virtio-net in
> qemu.
> >
> > Signed-off-by: Andrew Melnychenko <andrew@daynix.com>
> > ---
> >  src/conf/domain_conf.c | 31 ++++++++++++++++++++++++++++++-
> >  src/conf/domain_conf.h |  2 ++
> >  2 files changed, 32 insertions(+), 1 deletion(-)
>
> Any change to domain XML should go hand in hand with RNG update
> (docs/schemas/...) and documentation (i.e. squash 10/10 into this one).
> Ideally, the patch would also introduce xml2xml test (in this case
> qemuxml2xmltest looks reasonable).
>
> Michal
>
>