From nobody Mon Feb 9 00:31:10 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1641762490652616.0376939448348; Sun, 9 Jan 2022 13:08:10 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-480-__Cl5mfBPLOLxnzYq6CaWg-1; Sun, 09 Jan 2022 16:08:05 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EEFF2180830C; Sun, 9 Jan 2022 21:08:00 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9FDE9519CA; Sun, 9 Jan 2022 21:08:00 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2696B1809CB8; Sun, 9 Jan 2022 21:07:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 209L7roT003632 for ; Sun, 9 Jan 2022 16:07:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id B2A40C08095; Sun, 9 Jan 2022 21:07:53 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast09.extmail.prod.ext.rdu2.redhat.com [10.11.55.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AE668C08092 for ; Sun, 9 Jan 2022 21:07:53 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 93ABE2BD19E7 for ; Sun, 9 Jan 2022 21:07:53 +0000 (UTC) Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-481-rxA2M76UPECsnPlKoQ6Ssg-1; Sun, 09 Jan 2022 16:07:51 -0500 Received: by mail-lf1-f50.google.com with SMTP id j11so37491801lfg.3 for ; Sun, 09 Jan 2022 13:07:51 -0800 (PST) Received: from navi.cosmonova.net.ua ([95.67.24.131]) by smtp.gmail.com with ESMTPSA id o6sm767689lfk.232.2022.01.09.13.07.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jan 2022 13:07:49 -0800 (PST) X-MC-Unique: __Cl5mfBPLOLxnzYq6CaWg-1 X-MC-Unique: rxA2M76UPECsnPlKoQ6Ssg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Nc3i1GcjkIwMUt2dGBm5JwoEUbQNe8LFw2QJsGeNOok=; b=MkpDLcxWzbL0BsBr7WIISbLHrrdD4DXwMO+Qj0997KVES2fFjlcXCX5u/2+D1aMxCj XKhT+LNnToWjlrAqqV8EHlWJuvJOW0xqjyVr/OwjjGQVZH3/YFe0F9cm4JM0J5d/gYmJ XaJSgZfxOcFAz13UcYFe8aPOeA0NSk42XF0qHYjzlymS04g2O3i542laSD++XqvZonBR QU+MhqjpYtKFBVmGUK5eTtZIPw2AY7RJ48TRgo3uwWFLvXYEi94W8lKRtmzSYIpwsmHt 0dDJaGCADB0AddC6Ej4cKZURd3TDGGv9ye79H7JuSVLDyn3hJBGZs+aZM39pOCcd6c9T uQFw== X-Gm-Message-State: AOAM530oxcOJ2r+rNC8X8xiKclElJNAeOi7C/f9gbd5h45J+BfK1FTKj 8x7OdGohJQ3fPuPUYVk/78WBlhUrNk73qlY4 X-Google-Smtp-Source: ABdhPJxy2O9MWKRkbvec67yBZLh9oyku+9+uZwVm1fSo3nw+l8kQm/oLa9Vo7BR5DMgh7nSCz3NClg== X-Received: by 2002:a19:e611:: with SMTP id d17mr33830066lfh.415.1641762469830; Sun, 09 Jan 2022 13:07:49 -0800 (PST) From: Andrew Melnychenko To: libvir-list@redhat.com Subject: [PATCH v2 1/4] domain_conf: Added configs for RSS and Hash report. Date: Sun, 9 Jan 2022 23:07:35 +0200 Message-Id: <20220109210738.2867080-2-andrew@daynix.com> In-Reply-To: <20220109210738.2867080-1-andrew@daynix.com> References: <20220109210738.2867080-1-andrew@daynix.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-loop: libvir-list@redhat.com Cc: yan@daynix.com, yuri.benditovich@daynix.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1641762491843100003 Content-Type: text/plain; charset="utf-8" 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 propertie= s. Signed-off-by: Andrew Melnychenko --- docs/formatdomain.rst | 18 ++++++++++++++++++ docs/schemas/domaincommon.rng | 10 ++++++++++ src/conf/domain_conf.c | 31 ++++++++++++++++++++++++++++++- src/conf/domain_conf.h | 2 ++ 4 files changed, 60 insertions(+), 1 deletion(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index d4f30bb8af..ce3e8a5dbf 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -5305,6 +5305,24 @@ following attributes are available for the ``"virtio= "`` NIC driver: only for ``vhostuser`` type. :since:`Since 3.7.0 (QEMU and KVM only)` **In general you should leave this option alone, unless you are very ce= rtain you know what you are doing.** +``rss`` + The ``rss`` option enables in-qemu/ebpf RSS for virtio NIC. RSS works w= ith + virtio and tap backends only. Virtio NIC will be launched with "rss" + property. For now "in-qemu" RSS is supported by libvirt. + QEMU may load eBPF RSS if it has CAP_SYS_ADMIN permissions, which is + not supported by default in libvirt. + **In general you should leave this option alone, unless you are very ce= rtain + you know what you are doing. Proper RSS configuration depends from vcpu, + tap, and vhost settings.** +``rss_hash_report`` + The ``rss_hash_report`` option enables in-qemu RSS hash report for virt= io + NIC. Virtio NIC will be launched with a "hash" property. Network packet= s provided + to VM will contain a hash of the packet in the virt header. Usually ena= bled + alongside with ``rss``. Without ``rss`` option, the hash report doesn't= affect + steering itself but provides vnet header with a calculated hash. + **In general you should leave this option alone, unless you are very ce= rtain + you know what you are doing. Proper RSS configuration depends from vcpu, + tap, and vhost settings.** virtio options For virtio interfaces, `Virtio-specific options <#elementsVirtio>`__ ca= n also be set. ( :since:`Since 3.5.0` ) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 7fa5c2b8b5..9b5b94fc6c 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3595,6 +3595,16 @@ + + + + + + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 716c6d2240..762987e8a9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10271,6 +10271,8 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt, g_autofree char *vhost_path =3D NULL; g_autofree char *tap =3D NULL; g_autofree char *vhost =3D NULL; + g_autofree char *virtio_rss =3D NULL; + g_autofree char *virtio_rss_hash_report =3D NULL; const char *prefix =3D xmlopt ? xmlopt->config.netPrefix : NULL; =20 if (!(def =3D virDomainNetDefNew(xmlopt))) @@ -10412,6 +10414,8 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt, queues =3D virXMLPropString(driver_node, "queues"); rx_queue_size =3D virXMLPropString(driver_node, "rx_queue_size"); tx_queue_size =3D virXMLPropString(driver_node, "tx_queue_size"); + virtio_rss =3D virXMLPropString(driver_node, "rss"); + virtio_rss_hash_report =3D virXMLPropString(driver_node, "rss_hash_rep= ort"); =20 if ((filterref_node =3D virXPathNode("./filterref", ctxt))) { filter =3D virXMLPropString(filterref_node, "filter"); @@ -10822,7 +10826,24 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt, } def->driver.virtio.tx_queue_size =3D q; } - + if (virtio_rss) { + if ((val =3D virTristateSwitchTypeFromString(virtio_rss)) <=3D= 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("'rss' attribute must be 'on'/'off'/'default': %= s"), + virtio_rss); + goto error; + } + def->driver.virtio.rss =3D val; + } + if (virtio_rss_hash_report) { + if ((val =3D virTristateSwitchTypeFromString(virtio_rss_hash_r= eport)) <=3D 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 =3D val; + } if ((tmpNode =3D virXPathNode("./driver/host", ctxt))) { if (virXMLPropTristateSwitch(tmpNode, "csum", VIR_XML_PROP_NON= E, &def->driver.virtio.host.csum) < = 0) @@ -24751,6 +24772,14 @@ virDomainVirtioNetDriverFormat(virBuffer *buf, if (def->driver.virtio.tx_queue_size) virBufferAsprintf(buf, " tx_queue_size=3D'%u'", def->driver.virtio.tx_queue_size); + if (def->driver.virtio.rss !=3D VIR_TRISTATE_SWITCH_ABSENT) { + virBufferAsprintf(buf, " rss=3D'%s'", + virTristateSwitchTypeToString(def->driver.virtio= .rss)); + } + if (def->driver.virtio.rss_hash_report !=3D VIR_TRISTATE_SWITCH_ABSENT= ) { + virBufferAsprintf(buf, " rss_hash_report=3D'%s'", + virTristateSwitchTypeToString(def->driver.virtio= .rss_hash_report)); + } =20 virDomainVirtioOptionsFormat(buf, def->virtio); } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 144ba4dd12..64ebff012e 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1055,6 +1055,8 @@ struct _virDomainNetDef { virTristateSwitch ecn; virTristateSwitch ufo; } guest; + virTristateSwitch rss; + virTristateSwitch rss_hash_report; } virtio; } driver; struct { --=20 2.34.1