From nobody Sun May 5 15:31:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1627481619495343.88950957685984; Wed, 28 Jul 2021 07:13:39 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-347-DNjQ30jgNUiZ5u07WwPkKw-1; Wed, 28 Jul 2021 10:13:35 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B4085107ACF5; Wed, 28 Jul 2021 14:13:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6E07F5C1CF; Wed, 28 Jul 2021 14:13:28 +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 5A3274BB7B; Wed, 28 Jul 2021 14:13:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 16S8IC5v013755 for ; Wed, 28 Jul 2021 04:18:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3A88BDAF0A; Wed, 28 Jul 2021 08:18:12 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 35585DAF05 for ; Wed, 28 Jul 2021 08:18:09 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (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 9B2678D1388 for ; Wed, 28 Jul 2021 08:18:09 +0000 (UTC) Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-535-XMv2XvolMV2ctiw9cxBLKQ-1; Wed, 28 Jul 2021 04:18:07 -0400 Received: by mail-lf1-f53.google.com with SMTP id z2so2422805lft.1 for ; Wed, 28 Jul 2021 01:18:07 -0700 (PDT) Received: from navi.cosmonova.net.ua ([95.67.24.131]) by smtp.gmail.com with ESMTPSA id p5sm571964lfd.240.2021.07.28.01.18.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jul 2021 01:18:05 -0700 (PDT) X-MC-Unique: DNjQ30jgNUiZ5u07WwPkKw-1 X-MC-Unique: XMv2XvolMV2ctiw9cxBLKQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WRr+J2BGbxYoqjiWbH0JLUM6SvmivGNydXNz6gcGA0s=; b=VVXviltDPj8Dbs0nyZtQnMC6Dz25hZW7v3h8vXzuVCoLsNB8NACVY4HH84zTOkMdyj UUyE153On3wGyYuH1QnABsnk0x5lG4uS6SQNqVHEJcXevZDhaSTbpBsjAtQy3Yvt7ZDg 3jopfc9sOd5xEuSXmQFtvE+Owym6XXPPbQRmr86IoOtCfTjJiRJJcHHzF05GrPhyBMJH FY6M+rEqCrIsE3KUm1s0iMKYdEcDMo5Tba63evEnWWxHN5mf+dUv1MiOCV4tmyaQVdER djJTuHdCFToDqwfu2IQBnBzL9wMFE/UglQ6yYkYFay1XtHAAaue08xPaywlhxPVE2b7A Kh+w== X-Gm-Message-State: AOAM5321UgmzSVoVTz3pO60pYv3CeVgDxPNXqGxcD+YEYHHTQbyuxdNH XFJBY8OWtPXqeg5hLYFHMSEL2Q1UW8ZTrG+N X-Google-Smtp-Source: ABdhPJyYoSIAsJU3xrB0q7RHF0/YnEUlLU4Z57PR2un6O2u4R65jxGeKECtKdT2kSDl5cAcqeIZW6Q== X-Received: by 2002:a19:5e15:: with SMTP id s21mr20421026lfb.282.1627460285638; Wed, 28 Jul 2021 01:18:05 -0700 (PDT) From: Andrew Melnychenko To: libvir-list@redhat.com Subject: [RFC PATCH 01/10] domain_conf: Added configs for RSS and Hash report. Date: Wed, 28 Jul 2021 11:17:05 +0300 Message-Id: <20210728081714.715287-2-andrew@daynix.com> In-Reply-To: <20210728081714.715287-1-andrew@daynix.com> References: <20210728081714.715287-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.79 on 10.11.54.5 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Wed, 28 Jul 2021 10:13:24 -0400 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.16 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: 1627481620836100003 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. Also "rss" may used to affect "ebpf_rss_fds" property of virtio-net in qemu. Signed-off-by: Andrew Melnychenko --- 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 =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))) @@ -10385,6 +10387,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"); @@ -10796,7 +10800,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) @@ -24568,6 +24589,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 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 { --=20 2.31.1 From nobody Sun May 5 15:31:12 2024 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 1627481632412439.5168035211806; Wed, 28 Jul 2021 07:13:52 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-128-BBDixJV1O8WMz3hEMEYDPA-1; Wed, 28 Jul 2021 10:13:48 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9E5191006C87; Wed, 28 Jul 2021 14:13:42 +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 81ACF136F5; Wed, 28 Jul 2021 14:13:42 +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 4EEB8180BAB2; Wed, 28 Jul 2021 14:13:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 16S8IIV4013777 for ; Wed, 28 Jul 2021 04:18:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6EBAD200E4A9; Wed, 28 Jul 2021 08:18:18 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 69F36200AD0C for ; Wed, 28 Jul 2021 08:18:18 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (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 5226489C7DE for ; Wed, 28 Jul 2021 08:18:18 +0000 (UTC) Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-406-uMBQXLHNMGmlxJN5quVsiw-1; Wed, 28 Jul 2021 04:18:15 -0400 Received: by mail-lf1-f44.google.com with SMTP id bp1so2419066lfb.3 for ; Wed, 28 Jul 2021 01:18:15 -0700 (PDT) Received: from navi.cosmonova.net.ua ([95.67.24.131]) by smtp.gmail.com with ESMTPSA id p5sm571964lfd.240.2021.07.28.01.18.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jul 2021 01:18:13 -0700 (PDT) X-MC-Unique: BBDixJV1O8WMz3hEMEYDPA-1 X-MC-Unique: uMBQXLHNMGmlxJN5quVsiw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7Qst4T0enrLp9cPcgBgdhNhZEXmKH6ojHbel9wiCxHw=; b=eiOqnGcFF6+H7cKUstxJOtessmgDn+ikT3HxhT3s19bypRwGXYPxr9FHdp1T54bZYb ZpzOzAX5CMLNVR/loi3meBL6QDgaicNgzRBepcn42W8AxbBO8eY7uJhowan0MtS8p8/x P1MvFBOHdTvBLKHwO/JhYrUb5P4rU3PLzxDvy03vvXbyfuXYBOT6IcJ3f/DOA0lo5yyH KcCMuxw/0DAzuR/A/NNMAkNfajgZzH/qRivfF0qFawaXmmLK/tq7Xaf96a0noWsaV89c 2+QddIUHoQR4rzJjoM1BIk6fMAzr6L8JDwWbbqjMfVIUEfLuP2uH1/J0lmG9qdsEDXB1 mSCg== X-Gm-Message-State: AOAM5329VFWyULnxu3XmqY2+bpwGN+6jOK6HIzowl0sfbDGMmJvExKgf xqkyuimEz0mrhMYZ0qBl/UuIoiaDGy9/piEe X-Google-Smtp-Source: ABdhPJwEmfgbxF3Wp50xupd6J5+XoG8Ly6yFR+gDPqGMNsWwvxvJ7Yvaxn0vYUBwFpZut1H1DwwQvg== X-Received: by 2002:a19:6709:: with SMTP id b9mr9290656lfc.95.1627460294030; Wed, 28 Jul 2021 01:18:14 -0700 (PDT) From: Andrew Melnychenko To: libvir-list@redhat.com Subject: [RFC PATCH 02/10] qemu_capabilities: Added capabilites for qemu's "rss" and "hash". Date: Wed, 28 Jul 2021 11:17:06 +0300 Message-Id: <20210728081714.715287-3-andrew@daynix.com> In-Reply-To: <20210728081714.715287-1-andrew@daynix.com> References: <20210728081714.715287-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.78 on 10.11.54.6 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Wed, 28 Jul 2021 10:13:24 -0400 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.11 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: 1627481633038100006 Content-Type: text/plain; charset="utf-8" Added qemu's property check for virtio-net. And added capability QEMU_CAPS_VIRTIO_RSS. With "rss" and "rss_hash_report" from domain config, qemu should enable "rss" and "hash" for virtio-net. Signed-off-by: Andrew Melnychenko --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_validate.c | 16 ++++++++++++++++ 3 files changed, 19 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 9558938866..7cd6dab259 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -637,6 +637,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "confidential-guest-support", "query-display-options", "s390-pv-guest", + "virtio-net.rss", ); =20 =20 @@ -1421,6 +1422,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCaps= DevicePropsVirtioNet[] =3D { { "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 }, }; =20 static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsPCIeRootPo= rt[] =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 2b1bb57a49..6b2446fe5f 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -617,6 +617,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ QEMU_CAPS_MACHINE_CONFIDENTAL_GUEST_SUPPORT, /* -machine confidential-= guest-support */ QEMU_CAPS_QUERY_DISPLAY_OPTIONS, /* 'query-display-options' qmp comman= d present */ QEMU_CAPS_S390_PV_GUEST, /* -object s390-pv-guest,... */ + QEMU_CAPS_VIRTIO_RSS, /* virtio-net rss feature */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index a964c8593d..265938a99f 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1607,6 +1607,22 @@ qemuValidateDomainDeviceDefNetwork(const virDomainNe= tDef *net, } } =20 + 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")); + 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")); + return -1; + } + if (net->mtu && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_HOST_MTU)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", --=20 2.31.1 From nobody Sun May 5 15:31:12 2024 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 1627481631694936.1446325254656; Wed, 28 Jul 2021 07:13:51 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-144-Vj5Oi6wuM3mg6ZC_8DVKyQ-1; Wed, 28 Jul 2021 10:13:48 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A47771804877; Wed, 28 Jul 2021 14:13:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 833825C1D1; Wed, 28 Jul 2021 14:13:42 +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 503864A706; Wed, 28 Jul 2021 14:13:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 16S8IJBW013784 for ; Wed, 28 Jul 2021 04:18:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0CAA3200E4A9; Wed, 28 Jul 2021 08:18:19 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 07D2D200AD0C for ; Wed, 28 Jul 2021 08:18:19 +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 E497189C7DC for ; Wed, 28 Jul 2021 08:18:18 +0000 (UTC) Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-293-3dCnzN5aPyG6lTav8YE6fA-1; Wed, 28 Jul 2021 04:18:16 -0400 Received: by mail-lf1-f49.google.com with SMTP id h14so2365704lfv.7 for ; Wed, 28 Jul 2021 01:18:16 -0700 (PDT) Received: from navi.cosmonova.net.ua ([95.67.24.131]) by smtp.gmail.com with ESMTPSA id p5sm571964lfd.240.2021.07.28.01.18.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jul 2021 01:18:14 -0700 (PDT) X-MC-Unique: Vj5Oi6wuM3mg6ZC_8DVKyQ-1 X-MC-Unique: 3dCnzN5aPyG6lTav8YE6fA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ExDAjbmKPg9eJYQlQkCtYcUFayYAZJ32LSZuVJQL4LU=; b=DTW4OXP9ncUqROqDaWbgqGIXBYzYgcIzSwb8SOPCS73fZj5PlDoLYcxGjENGoDNTII p2xqyn3XPNn/bqKG5AXTG484Sq3ERfu4DeT0Q5gN6NdVva/Cmm2zt6YEOu64A6YcUkZl YL/2t7HkBsVUWFFwWq+BfVpfsTpVrdEOdhtDVC6OTQ6DhCClpbbyJlLLZXUuRpUOf7UP v75EliSB2PO7/uTvjnUIFOPoo0rTKZTBg63Xf9/Zv5ZkHiJSx0jiFeIBF7e/fKs65JX/ Uw2b6eacalvrOLoAc8XulSC8Ihm6Xi0Jvuqyc8vKasCAlwA67S5C/VOSrpIMEoAk5Kaq BnMg== X-Gm-Message-State: AOAM532gTcV8FZOOFjbcR6dadXsjaIriKXxlZlrqIHUmVqwxgdStPjON DzKzNiGv5NnOUBvxLljbwMQLWCdxQ+5nhiEo X-Google-Smtp-Source: ABdhPJxm4q7zM2oUuHzzFIvFigJejx9HA6cGnRdSKXRfYqthgI/f3UGu3js8K/PK1eIfEYa+uLbPJg== X-Received: by 2002:a05:6512:e87:: with SMTP id bi7mr20543152lfb.218.1627460294805; Wed, 28 Jul 2021 01:18:14 -0700 (PDT) From: Andrew Melnychenko To: libvir-list@redhat.com Subject: [RFC PATCH 03/10] qemu_command: Added "rss" and "hash" properties. Date: Wed, 28 Jul 2021 11:17:07 +0300 Message-Id: <20210728081714.715287-4-andrew@daynix.com> In-Reply-To: <20210728081714.715287-1-andrew@daynix.com> References: <20210728081714.715287-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.78 on 10.11.54.6 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Wed, 28 Jul 2021 10:13:24 -0400 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.16 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: 1627481632790100002 Content-Type: text/plain; charset="utf-8" If domain config contains "rss" and/or "rss_hash_report" options for driver. Also if the qemu has device capabilities for RSS. Libvirt will create an NI= C device command line with enabled "rss"/"hash". Signed-off-by: Andrew Melnychenko --- src/qemu/qemu_command.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 156af4caee..67a396a513 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3495,6 +3495,16 @@ qemuBuildNicDevStr(virDomainDef *def, if (net->driver.virtio.tx_queue_size) virBufferAsprintf(&buf, ",tx_queue_size=3D%u", net->driver.vir= tio.tx_queue_size); =20 + if (net->driver.virtio.rss =3D=3D VIR_TRISTATE_SWITCH_ON) { + virBufferAsprintf(&buf, ",rss=3D%s", + virTristateSwitchTypeToString(net->driver.virtio.rss)); + } + + if (net->driver.virtio.rss_hash_report =3D=3D VIR_TRISTATE_SWITCH_= ON) { + virBufferAsprintf(&buf, ",hash=3D%s", + virTristateSwitchTypeToString(net->driver.virtio.rss_h= ash_report)); + } + if (net->mtu) virBufferAsprintf(&buf, ",host_mtu=3D%u", net->mtu); =20 --=20 2.31.1 From nobody Sun May 5 15:31:12 2024 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 1627481637400503.99436834050346; Wed, 28 Jul 2021 07:13:57 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-122-6Phv3zpPPcmocNvNmXrqZw-1; Wed, 28 Jul 2021 10:13:55 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9AD3294EE9; Wed, 28 Jul 2021 14:13:45 +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 76AC760C0F; Wed, 28 Jul 2021 14:13:45 +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 3C0BF180BAC0; Wed, 28 Jul 2021 14:13:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 16S8IJ36013790 for ; Wed, 28 Jul 2021 04:18:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id B54B6200AD0C; Wed, 28 Jul 2021 08:18:19 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B08D0200E641 for ; Wed, 28 Jul 2021 08:18:19 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (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 99112801E80 for ; Wed, 28 Jul 2021 08:18:19 +0000 (UTC) Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-278-PMcJtE9EMuKomzQlN-khJA-1; Wed, 28 Jul 2021 04:18:17 -0400 Received: by mail-lj1-f170.google.com with SMTP id h9so2063694ljq.8 for ; Wed, 28 Jul 2021 01:18:17 -0700 (PDT) Received: from navi.cosmonova.net.ua ([95.67.24.131]) by smtp.gmail.com with ESMTPSA id p5sm571964lfd.240.2021.07.28.01.18.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jul 2021 01:18:15 -0700 (PDT) X-MC-Unique: 6Phv3zpPPcmocNvNmXrqZw-1 X-MC-Unique: PMcJtE9EMuKomzQlN-khJA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Cy3NRNKh+kvApJkg5MlcuPeF5PzXTnzHYlYAopWIvbE=; b=egrYPb28+L8ShqEYTawR4AsSRXqY88XG/IhqFg+uG0tD3OYbhOyn7+5hYa0eEtRN+g XRzQZa6Mi7PS9CUuah7rp8/+U/N5kJCaZhvpn/J+3YalKE+ZnzIIqgQq8nMNuE3AZuey qbfUR/R6B8MhEFGOlZj8+ZAASa+4keoNzXkUredA/ZV9JJKxOT/Dx3VGxr5U972PkgD4 g3FYkdHRMEyiM5RNQ59vifzpNZ41SQDgAtxxtfbwL2s8IKVmLdr0CUZVxYuNQiAIpi3v OV1jaNJAxDW9xD/oDCuChLOubQBux1FT3TtqHLTa/K1e8fHSGlaGVRcY6nvDefBsJCzL 2VjQ== X-Gm-Message-State: AOAM533npkY/a5rfIiORt+h5VHz3+2m3o2DmaYbsQw6sdjpMKyuJ0mwk f7fopi6pYpm1kBJAqr9fd4NPTONmdzK339AM X-Google-Smtp-Source: ABdhPJxgwt+fjjG9NYp9Fhj+UEtzqiMrlyEiZG1i5KQs78CZxB9K8ZY4JtBvQVpQ+IPtDZ5DhDob5w== X-Received: by 2002:a2e:bd85:: with SMTP id o5mr18124413ljq.313.1627460295595; Wed, 28 Jul 2021 01:18:15 -0700 (PDT) From: Andrew Melnychenko To: libvir-list@redhat.com Subject: [RFC PATCH 04/10] virsocket: Added receive for multiple fds. Date: Wed, 28 Jul 2021 11:17:08 +0300 Message-Id: <20210728081714.715287-5-andrew@daynix.com> In-Reply-To: <20210728081714.715287-1-andrew@daynix.com> References: <20210728081714.715287-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.78 on 10.11.54.6 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Wed, 28 Jul 2021 10:13:24 -0400 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.12 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: 1627481639643100001 Content-Type: text/plain; charset="utf-8" Similar to virSocketRecvFD() added virSocketRecvMultipleFDs(). This function returns multiple fds through unix socket. New function is required for "qemu-ebpf-rss-helper" program. The helper may pass few file descriptors - eBPF program and maps. Signed-off-by: Andrew Melnychenko --- src/libvirt_private.syms | 1 + src/util/virsocket.c | 83 ++++++++++++++++++++++++++++++++++++++++ src/util/virsocket.h | 2 + 3 files changed, 86 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 43493ea76e..6987ff00c2 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3226,6 +3226,7 @@ virSecureEraseString; # util/virsocket.h virSocketRecvFD; virSocketSendFD; +virSocketRecvMultipleFDs; =20 =20 # util/virsocketaddr.h diff --git a/src/util/virsocket.c b/src/util/virsocket.c index b971da16e3..da8af42e72 100644 --- a/src/util/virsocket.c +++ b/src/util/virsocket.c @@ -486,6 +486,82 @@ virSocketRecvFD(int sock, int fdflags) =20 return fd; } + + +/* virSocketRecvMultipleFDs receives few file descriptors through the sock= et. + The flags are a bitmask, possibly including O_CLOEXEC (defined in ). + + Return the number of recived file descriptors on success, + or -1 with errno set in case of error. +*/ +int +virSocketRecvMultipleFDs(int sock, int *fds, size_t nfds, int fdflags) +{ + char byte =3D 0; + struct iovec iov; + struct msghdr msg; + int ret =3D -1; + ssize_t len; + struct cmsghdr *cmsg; + char buf[CMSG_SPACE(sizeof(int) * nfds)]; + int fdflags_recvmsg =3D fdflags & O_CLOEXEC ? MSG_CMSG_CLOEXEC : 0; + int fdSize =3D -1; + int i =3D 0; + int saved_errno =3D 0; + + if ((fdflags & ~O_CLOEXEC) !=3D 0) { + errno =3D EINVAL; + return -1; + } + + /* send at least one char */ + memset(&msg, 0, sizeof(msg)); + iov.iov_base =3D &byte; + iov.iov_len =3D 1; + msg.msg_iov =3D &iov; + msg.msg_iovlen =3D 1; + msg.msg_name =3D NULL; + msg.msg_namelen =3D 0; + + msg.msg_control =3D buf; + msg.msg_controllen =3D sizeof(buf); + + len =3D recvmsg(sock, &msg, fdflags_recvmsg); + if (len < 0) { + return -1; + } + + cmsg =3D CMSG_FIRSTHDR(&msg); + /* be paranoiac */ + if (len =3D=3D 0 || cmsg =3D=3D NULL || cmsg->cmsg_len < CMSG_LEN(size= of(int)) + || cmsg->cmsg_level !=3D SOL_SOCKET || cmsg->cmsg_type !=3D SCM_RI= GHTS) { + /* fake errno: at end the file is not available */ + errno =3D len ? EACCES : ENOTCONN; + return -1; + } + + fdSize =3D cmsg->cmsg_len - CMSG_LEN(0); + memcpy(fds, CMSG_DATA(cmsg), fdSize); + ret =3D fdSize/sizeof(int); + + /* set close-on-exec flag */ + if (!MSG_CMSG_CLOEXEC && (fdflags & O_CLOEXEC)) { + for (i =3D 0; i < ret; ++i) { + if (virSetCloseExec(fds[i]) < 0) { + saved_errno =3D errno; + goto error; + } + } + } + + return ret; +error: + for (i =3D 0; i < ret; ++i) { + VIR_FORCE_CLOSE(fds[i]); + } + errno =3D saved_errno; + return -1; +} #else /* WIN32 */ int virSocketSendFD(int sock G_GNUC_UNUSED, int fd G_GNUC_UNUSED) @@ -500,4 +576,11 @@ virSocketRecvFD(int sock G_GNUC_UNUSED, int fdflags G_= GNUC_UNUSED) errno =3D ENOSYS; return -1; } + +int +virSocketRecvMultipleFDs(int sock, int *fds, size_t nfds, int fdflags) +{ + errno =3D ENOSYS; + return -1; +} #endif /* WIN32 */ diff --git a/src/util/virsocket.h b/src/util/virsocket.h index 419da8b3ae..c926effbc3 100644 --- a/src/util/virsocket.h +++ b/src/util/virsocket.h @@ -22,6 +22,8 @@ =20 int virSocketSendFD(int sock, int fd); int virSocketRecvFD(int sock, int fdflags); +int +virSocketRecvMultipleFDs(int sock, int *fds, size_t nfds, int fdflags); =20 #ifdef WIN32 =20 --=20 2.31.1 From nobody Sun May 5 15:31:12 2024 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 16274816425061019.3979255110443; Wed, 28 Jul 2021 07:14:02 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-246-zhg3i0T0NlORpc-b97rtSg-1; Wed, 28 Jul 2021 10:13:59 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 58FD81006C82; Wed, 28 Jul 2021 14:13:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2D29469320; Wed, 28 Jul 2021 14:13:54 +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 EAE164A70F; Wed, 28 Jul 2021 14:13:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 16S8ISNn013858 for ; Wed, 28 Jul 2021 04:18:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2D8DF2077FA9; Wed, 28 Jul 2021 08:18:28 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2731F2077FAE for ; Wed, 28 Jul 2021 08:18:20 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.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 BD977101A54C for ; Wed, 28 Jul 2021 08:18:20 +0000 (UTC) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-483-p_jvEg5tN9WLZlDja8VdGg-1; Wed, 28 Jul 2021 04:18:18 -0400 Received: by mail-lf1-f54.google.com with SMTP id g13so2325196lfj.12 for ; Wed, 28 Jul 2021 01:18:17 -0700 (PDT) Received: from navi.cosmonova.net.ua ([95.67.24.131]) by smtp.gmail.com with ESMTPSA id p5sm571964lfd.240.2021.07.28.01.18.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jul 2021 01:18:16 -0700 (PDT) X-MC-Unique: zhg3i0T0NlORpc-b97rtSg-1 X-MC-Unique: p_jvEg5tN9WLZlDja8VdGg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lYCj58Y21F9lznReGi1vxurKHpe9YsNDcsdLQCQlSSs=; b=aLJ9c9ncihf3GZnm3BeWm1H9vT48puaNgmo+dRAFHo1ffDN5N9/BDqPBrZtCYwS+4y 171hmky8hQIeMSv99fuOLK/9quw7sFvfqmtjvBz/Os64ckb2oAGtPhUKaap+eKnZOXsa CrgsOb3qmPV3MREJJNz2SV0wNyWWpG75ZNz4RDwsnEcNUCXYW+dgAnv+R+8j2aCwWXfT zLpjAwX5iuKR+o4AbsWWvD+JzGtNdJmftDJuWqELjqIpxhfM6GE0yzt5PaGrgvFcGwlz 8shzbe5byLjCIU0yCbcUALFsfqeDCPmo9O+sLaTaTm6tg9+mWOJxuitC7z62pyOeT597 upVQ== X-Gm-Message-State: AOAM532oPjaEeVamxXfeCaBNYpleC6Pq2Ntwte2k4n/7I3S9wQfEHvf6 WuipuwUNzVSQJJbmEY5MerwB5dWY9BR9iS1a X-Google-Smtp-Source: ABdhPJwko7490/pEShPUN9HTnUPXDP+ZvQTe9CednmvcGoVvIlEmZ+tOJtjnaDNv32dnqQeiHLcqDw== X-Received: by 2002:a05:6512:6d1:: with SMTP id u17mr20113139lff.227.1627460296414; Wed, 28 Jul 2021 01:18:16 -0700 (PDT) From: Andrew Melnychenko To: libvir-list@redhat.com Subject: [RFC PATCH 05/10] qemu_capabilities: Added capability for qemu's "ebpf_rss_fds". Date: Wed, 28 Jul 2021 11:17:09 +0300 Message-Id: <20210728081714.715287-6-andrew@daynix.com> In-Reply-To: <20210728081714.715287-1-andrew@daynix.com> References: <20210728081714.715287-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.78 on 10.11.54.4 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Wed, 28 Jul 2021 10:13:24 -0400 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.15 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: 1627481644143100003 Content-Type: text/plain; charset="utf-8" Added check for qemu virtio-net "ebpf_rss_fds" property. This property allows to pass eBPF program/map file descriptors for RSS prog= ram. In other patches, libvirt may launch qemu-ebpf-rss-helper and pass fds to virtio-net qemu. Signed-off-by: Andrew Melnychenko --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + 2 files changed, 3 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 7cd6dab259..f16115226d 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -638,6 +638,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "query-display-options", "s390-pv-guest", "virtio-net.rss", + "virtio-net.ebpf_rss_fds", ); =20 =20 @@ -1423,6 +1424,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCaps= DevicePropsVirtioNet[] =3D { { "packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES, NULL }, { "acpi-index", QEMU_CAPS_ACPI_INDEX, NULL }, { "rss", QEMU_CAPS_VIRTIO_RSS, NULL }, + { "ebpf_rss_fds", QEMU_CAPS_VIRTIO_EBPF_RSS_FDS, NULL }, }; =20 static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsPCIeRootPo= rt[] =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 6b2446fe5f..c938b63e91 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -618,6 +618,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ QEMU_CAPS_QUERY_DISPLAY_OPTIONS, /* 'query-display-options' qmp comman= d present */ QEMU_CAPS_S390_PV_GUEST, /* -object s390-pv-guest,... */ QEMU_CAPS_VIRTIO_RSS, /* virtio-net rss feature */ + QEMU_CAPS_VIRTIO_EBPF_RSS_FDS, /* virtio-net ebpf_rss_fds feature */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; --=20 2.31.1 From nobody Sun May 5 15:31:12 2024 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 1627481617871960.7173388525484; Wed, 28 Jul 2021 07:13:37 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-452-35NPViAJMVuo-J4mg7BCrQ-1; Wed, 28 Jul 2021 10:13:35 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B7F731006C81; Wed, 28 Jul 2021 14:13:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 834075D6AB; Wed, 28 Jul 2021 14:13:29 +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 1743C4BB7C; Wed, 28 Jul 2021 14:13:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 16S8ILAq013801 for ; Wed, 28 Jul 2021 04:18:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id B89C6DAF05; Wed, 28 Jul 2021 08:18:21 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B3159DAF04 for ; Wed, 28 Jul 2021 08:18:21 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (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 9ADA98D1381 for ; Wed, 28 Jul 2021 08:18:21 +0000 (UTC) Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-512-xWeLVEzNO0Wm9GaBlc2i1A-1; Wed, 28 Jul 2021 04:18:19 -0400 Received: by mail-lj1-f176.google.com with SMTP id a7so2046522ljq.11 for ; Wed, 28 Jul 2021 01:18:18 -0700 (PDT) Received: from navi.cosmonova.net.ua ([95.67.24.131]) by smtp.gmail.com with ESMTPSA id p5sm571964lfd.240.2021.07.28.01.18.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jul 2021 01:18:16 -0700 (PDT) X-MC-Unique: 35NPViAJMVuo-J4mg7BCrQ-1 X-MC-Unique: xWeLVEzNO0Wm9GaBlc2i1A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=j8aBbI2+UXuZL/5tqwZpVb8MjKlSlnzT51oaWSYP1QE=; b=Shb8+yEUDUXe3jlqpsqxKj1eir2Nc3FH2v9cUrUs0OWCP+DOdqSsjSrorGDyEfPBj7 NyH/wWRZhkZqMz+0ZvAFMR6zDtlQJSu49B8UterbokGa+vvFcmrp714vy/gj0vvKKSke STlpO5aVZlwU3MbhTWgB+26isUrqv4g9k8YuxhLZaeqYuAe1dygo3krn237IcnrXdr+C AsFhxfNNHT95vQSu4UNVHr54ge7bxvwpQbSZIqEX9ppbXref2GM8ANowOhIVMsbMoJ4m c4SDJUB96yS2sb7V6YYCHTU2GLdopdXCShyCS6diATdMuRDj/Pi2CMKlDot9Z9hfZcwS 0iqQ== X-Gm-Message-State: AOAM53077BUgJQjihfjx1eGAhFY/acIrHM7OMTLBfrYseROELTxe9Kdm OozPNy9tc3C+K4dp2GS5FwtRFYkI47ioLdpR X-Google-Smtp-Source: ABdhPJxMwF1mqiUBfpU1M0TJkoMRD59/ubVCO+UNxdL1y/SedZDSFjvfSbFfuifv06nYfxuphG3nUA== X-Received: by 2002:a05:651c:1102:: with SMTP id d2mr18877587ljo.277.1627460297179; Wed, 28 Jul 2021 01:18:17 -0700 (PDT) From: Andrew Melnychenko To: libvir-list@redhat.com Subject: [RFC PATCH 06/10] qemu_capabilities: Added capability for ebpf helper path. Date: Wed, 28 Jul 2021 11:17:10 +0300 Message-Id: <20210728081714.715287-7-andrew@daynix.com> In-Reply-To: <20210728081714.715287-1-andrew@daynix.com> References: <20210728081714.715287-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.79 on 10.11.54.5 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Wed, 28 Jul 2021 10:13:24 -0400 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.15 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: 1627481618733100001 Content-Type: text/plain; charset="utf-8" Added qmp call to receive helper path. Also added monitor functions. For virQEMUCaps added field for helper path. Libvirt queries "query-helper-paths" from qmp and saves in qemuCaps. The qemu and the helper should be "sync" and the helper should return proper eBPF fd and maps with "interface" for current qemu. So, qemu returns where to find the helper through qmp, if the qemu supports "ebpf_rss_fds". Signed-off-by: Andrew Melnychenko --- src/qemu/qemu_capabilities.c | 44 +++++++++++++++++++++++++++++++ src/qemu/qemu_capabilities.h | 3 +++ src/qemu/qemu_monitor.c | 9 +++++++ src/qemu/qemu_monitor.h | 3 +++ src/qemu/qemu_monitor_json.c | 50 ++++++++++++++++++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 3 +++ 6 files changed, 112 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index f16115226d..f62088d32f 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -722,6 +722,9 @@ struct _virQEMUCaps { /* Capabilities which may differ depending on the accelerator. */ virQEMUCapsAccel kvm; virQEMUCapsAccel tcg; + + /* Helpers returned by qemu */ + char *helperEbpfRSS; }; =20 struct virQEMUCapsSearchData { @@ -1994,6 +1997,8 @@ virQEMUCaps *virQEMUCapsNewCopy(virQEMUCaps *qemuCaps) qemuCaps->sevCapabilities) < 0) goto error; =20 + ret->helperEbpfRSS =3D g_strdup(qemuCaps->helperEbpfRSS); + return ret; =20 error: @@ -2037,6 +2042,8 @@ void virQEMUCapsDispose(void *obj) =20 virQEMUCapsAccelClear(&qemuCaps->kvm); virQEMUCapsAccelClear(&qemuCaps->tcg); + + g_free(qemuCaps->helperEbpfRSS); } =20 void @@ -4418,6 +4425,8 @@ virQEMUCapsLoadCache(virArch hostArch, if (virXPathBoolean("boolean(./kvmSupportsSecureGuest)", ctxt) > 0) qemuCaps->kvmSupportsSecureGuest =3D true; =20 + qemuCaps->helperEbpfRSS =3D virXPathString("string(./EbpfHelperPath)",= ctxt); + if (skipInvalidation) qemuCaps->invalidation =3D false; =20 @@ -4671,6 +4680,10 @@ virQEMUCapsFormatCache(virQEMUCaps *qemuCaps) if (qemuCaps->kvmSupportsSecureGuest) virBufferAddLit(&buf, "\n"); =20 + if (qemuCaps->helperEbpfRSS) { + virBufferAsprintf(&buf, "%s\n", q= emuCaps->helperEbpfRSS); + } + virBufferAdjustIndent(&buf, -2); virBufferAddLit(&buf, "\n"); =20 @@ -5265,6 +5278,30 @@ virQEMUCapsGetVirtType(virQEMUCaps *qemuCaps) return type; } =20 +static int +virQEMUCapsProbeQMPHelperPath(virQEMUCaps *qemuCaps, + qemuMonitor *mon) +{ + g_autoptr(GHashTable) helperList =3D NULL; + const char *entry =3D NULL; + + helperList =3D qemuMonitorGetHelperPath(mon); + + if (!helperList) { + return -1; + } + + /* TODO: parse all helpers? */ + entry =3D virHashLookup(helperList, "qemu-ebpf-rss-helper"); + if (!entry) { + return -1; + } + + qemuCaps->helperEbpfRSS =3D g_strdup(entry); + + return 0; +} + int virQEMUCapsInitQMPMonitor(virQEMUCaps *qemuCaps, qemuMonitor *mon) @@ -5345,6 +5382,8 @@ virQEMUCapsInitQMPMonitor(virQEMUCaps *qemuCaps, if (virQEMUCapsProbeQMPHostCPU(qemuCaps, accel, mon, type) < 0) return -1; =20 + virQEMUCapsProbeQMPHelperPath(qemuCaps, mon); + return 0; } =20 @@ -6459,3 +6498,8 @@ virQEMUCapsStripMachineAliases(virQEMUCaps *qemuCaps) virQEMUCapsStripMachineAliasesForVirtType(qemuCaps, VIR_DOMAIN_VIRT_KV= M); virQEMUCapsStripMachineAliasesForVirtType(qemuCaps, VIR_DOMAIN_VIRT_QE= MU); } + +const char *virQEMUCapsGetEBPFHelperPath(virQEMUCaps *qemuCaps) +{ + return qemuCaps->helperEbpfRSS; +} diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index c938b63e91..b25bdd4ec3 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -816,3 +816,6 @@ virQEMUCapsGetKVMSupportsSecureGuest(virQEMUCaps *qemuC= aps) G_GNUC_NO_INLINE; =20 virArch virQEMUCapsArchFromString(const char *arch); const char *virQEMUCapsArchToString(virArch arch); + +const char * +virQEMUCapsGetEBPFHelperPath(virQEMUCaps *qemuCaps); diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 6e2d8010c5..585fb2d6b4 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4617,3 +4617,12 @@ qemuMonitorQueryDirtyRate(qemuMonitor *mon, =20 return qemuMonitorJSONQueryDirtyRate(mon, info); } + + +GHashTable * +qemuMonitorGetHelperPath(qemuMonitor *mon) +{ + QEMU_CHECK_MONITOR_NULL(mon); + + return qemuMonitorJSONGetHelperPath(mon); +} diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 1491c1297c..0ee87d2c46 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1491,3 +1491,6 @@ struct _qemuMonitorDirtyRateInfo { int qemuMonitorQueryDirtyRate(qemuMonitor *mon, qemuMonitorDirtyRateInfo *info); + +GHashTable * +qemuMonitorGetHelperPath(qemuMonitor *mon); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index ca2c3bb6cf..0579eee36a 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -9387,3 +9387,53 @@ qemuMonitorJSONQueryDirtyRate(qemuMonitor *mon, =20 return qemuMonitorJSONExtractDirtyRateInfo(data, info); } + +static int +qemuMonitorJSONGetHelperPathWorker(size_t pos G_GNUC_UNUSED, + virJSONValue *item, + void *opaque) +{ + const char *name =3D virJSONValueObjectGetString(item, "name"); + const char *path =3D virJSONValueObjectGetString(item, "path"); + GHashTable *pathsList =3D opaque; + + if (!name) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("reply data was missing 'name'")); + return -1; + } + + if (virHashAddEntry(pathsList, name, g_strdup(path)) < 0) + return -1; + + return 0; +} + +GHashTable * +qemuMonitorJSONGetHelperPath(qemuMonitor *mon) +{ + g_autoptr(GHashTable) pathsList =3D virHashNew(g_free); + g_autoptr(virJSONValue) cmd =3D NULL; + g_autoptr(virJSONValue) reply =3D NULL; + + if (!(cmd =3D qemuMonitorJSONMakeCommand("query-helper-paths", NULL))) + return NULL; + + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + return NULL; + + /* return empty hash */ + if (qemuMonitorJSONHasError(reply, "CommandNotFound")) + return g_steal_pointer(&pathsList); + + if (qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_ARRAY) < 0) + return NULL; + + if (virJSONValueArrayForeachSteal(virJSONValueObjectGetArray(reply, "r= eturn"), + qemuMonitorJSONGetHelperPathWorker, + pathsList) < 0) + return NULL; + + return g_steal_pointer(&pathsList); +} + diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 01a3ba25f1..80e47cf68f 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -706,3 +706,6 @@ qemuMonitorJSONStartDirtyRateCalc(qemuMonitor *mon, int qemuMonitorJSONQueryDirtyRate(qemuMonitor *mon, qemuMonitorDirtyRateInfo *info); + +GHashTable * +qemuMonitorJSONGetHelperPath(qemuMonitor *mon); --=20 2.31.1 From nobody Sun May 5 15:31:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 16274816320364.963836553928104; Wed, 28 Jul 2021 07:13:52 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-467-r3N-WmzrPSqZ1UpYcV337g-1; Wed, 28 Jul 2021 10:13:49 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A27D0802928; Wed, 28 Jul 2021 14:13:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8029E60CA1; Wed, 28 Jul 2021 14:13:42 +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 4D8194A705; Wed, 28 Jul 2021 14:13:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 16S8INL5013807 for ; Wed, 28 Jul 2021 04:18:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 05BA6DAF04; Wed, 28 Jul 2021 08:18:23 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F30CCDAF19 for ; Wed, 28 Jul 2021 08:18:22 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.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 DB8B28CA948 for ; Wed, 28 Jul 2021 08:18:22 +0000 (UTC) Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-221-ZKUJmhtUPt2PdD006ZyGnA-1; Wed, 28 Jul 2021 04:18:19 -0400 Received: by mail-lf1-f49.google.com with SMTP id d17so2478992lfv.0 for ; Wed, 28 Jul 2021 01:18:19 -0700 (PDT) Received: from navi.cosmonova.net.ua ([95.67.24.131]) by smtp.gmail.com with ESMTPSA id p5sm571964lfd.240.2021.07.28.01.18.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jul 2021 01:18:17 -0700 (PDT) X-MC-Unique: r3N-WmzrPSqZ1UpYcV337g-1 X-MC-Unique: ZKUJmhtUPt2PdD006ZyGnA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QnBE8DFYcOgv+ymIwf5lnpudAxiJSD25dLvGsTtLHSU=; b=Ie5ciaTwGBfvYO8f8CVWZQyi6blSGyQzsn+mHgptArTDXOjJtrFNChsmmSLBJVbcHB q+NmLCFEjQEiIsxQTDEoinSJy5+2wBMr+sZcH+2smgxeLXVUh7rIYTetIAYqb97ZGVTO 6vjblOEvQVIwbh4H5TmYhRsMZ9cNkOaf9CGxc60KA12yZWOq0n1VicHGXs/VqynzYk4V 8MTV2VhoOzvhq7KQEA4oFvGjCG0S0sATXJacajcUpGVmiJ6374MBnYfaMypNiIDonJbW XAa4C54gpOUMiNQlNRwilP8nioIkep5vLaFNYk+72h5ODiARAInPgpW6y2GqqfKdJUsg qGMA== X-Gm-Message-State: AOAM5315MIIQA5xga6LmcMak9lZN3t1nBbAjq1I84WNzg9Duv6G9lkb2 83O6rRgA57j+cSrjc3X70AT98b06mRP1y+U4 X-Google-Smtp-Source: ABdhPJxbdb3mHmyDEMP341GRZJISRmlWJ8FUUyvmQKEDybdUZ6dSomUeQafRtAj8YLgOd0kesTlTug== X-Received: by 2002:a05:6512:2283:: with SMTP id f3mr18271630lfu.400.1627460297933; Wed, 28 Jul 2021 01:18:17 -0700 (PDT) From: Andrew Melnychenko To: libvir-list@redhat.com Subject: [RFC PATCH 07/10] qemu_interface: Added ebpf helper call. Date: Wed, 28 Jul 2021 11:17:11 +0300 Message-Id: <20210728081714.715287-8-andrew@daynix.com> In-Reply-To: <20210728081714.715287-1-andrew@daynix.com> References: <20210728081714.715287-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.79 on 10.11.54.5 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Wed, 28 Jul 2021 10:13:24 -0400 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.12 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: 1627481632877100004 Content-Type: text/plain; charset="utf-8" New function to call "qemu-ebpf-rss-helper". The helper passes few fds through unix socket. Technically libvirt should not be aware how many and what those fds. The helper should return fds that should be passed to the qemu as is and in= same order. Signed-off-by: Andrew Melnychenko --- src/qemu/qemu_interface.c | 54 +++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_interface.h | 2 ++ 2 files changed, 56 insertions(+) diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c index ac0168c80d..76435af94e 100644 --- a/src/qemu/qemu_interface.c +++ b/src/qemu/qemu_interface.c @@ -777,3 +777,57 @@ qemuInterfaceOpenVhostNet(virDomainDef *def, =20 return -1; } + + +int qemuEbpfRssHelper(const char *helper, int *fds, int nfds) +{ + int ret =3D 0; + int err =3D 0; + int unix_fds[2] =3D { -1, -1 }; + virCommand *cmd =3D NULL; + + if (!helper || !fds || !nfds) { + return -1; + } + + ret =3D socketpair(AF_UNIX, SOCK_STREAM, 0, unix_fds); + if (ret) { + virReportSystemError(errno, "%s", _("failed to create socket")); + return -1; + } + + cmd =3D virCommandNew(helper); + if (cmd =3D=3D NULL) { + VIR_FORCE_CLOSE(unix_fds[1]); + ret =3D -1; + goto cleanup; + } + virCommandAddArgFormat(cmd, "--fd=3D%d", unix_fds[1]); + virCommandPassFD(cmd, unix_fds[1], VIR_COMMAND_PASS_FD_CLOSE_PARENT); + virCommandDoAsyncIO(cmd); + + if (virCommandRunAsync(cmd, NULL) < 0) { + VIR_FORCE_CLOSE(unix_fds[1]); + ret =3D -1; + goto cleanup; + } + + memset(fds, 0, sizeof(*fds) * nfds); + + ret =3D virSocketRecvMultipleFDs(unix_fds[0], fds, nfds, 0); + + if (virCommandWait(cmd, &err) < 0) { + int i =3D 0; + for (; i < ret; ++i) { + if (fds[i]) { + VIR_FORCE_CLOSE(fds[i]); + } + } + ret =3D -1; + } + +cleanup: + VIR_FORCE_CLOSE(unix_fds[0]); + virCommandFree(cmd); + return ret; +} diff --git a/src/qemu/qemu_interface.h b/src/qemu/qemu_interface.h index 438d548065..63d7590035 100644 --- a/src/qemu/qemu_interface.h +++ b/src/qemu/qemu_interface.h @@ -61,3 +61,5 @@ int qemuInterfacePrepareSlirp(virQEMUDriver *driver, qemuSlirp **slirp); =20 int qemuInterfaceVDPAConnect(virDomainNetDef *net) G_GNUC_NO_INLINE; + +int qemuEbpfRssHelper(const char *helper, int *fds, int nfds); --=20 2.31.1 From nobody Sun May 5 15:31:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1627481638271283.53147772493446; Wed, 28 Jul 2021 07:13:58 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-573-y09sR7qvPIuSfDz2kR0NSw-1; Wed, 28 Jul 2021 10:13:55 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A9E66107ACF5; Wed, 28 Jul 2021 14:13:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8CB9A179B3; Wed, 28 Jul 2021 14:13:48 +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 57A8E4A7CB; Wed, 28 Jul 2021 14:13:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 16S8INq0013819 for ; Wed, 28 Jul 2021 04:18:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9BF7ADAF05; Wed, 28 Jul 2021 08:18:23 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 97440DAF19 for ; Wed, 28 Jul 2021 08:18:23 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (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 7FEF289C7E4 for ; Wed, 28 Jul 2021 08:18:23 +0000 (UTC) Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-280-EaBj7Z4tP46XbqiCXSm9QA-1; Wed, 28 Jul 2021 04:18:21 -0400 Received: by mail-lf1-f49.google.com with SMTP id y34so2366544lfa.8 for ; Wed, 28 Jul 2021 01:18:20 -0700 (PDT) Received: from navi.cosmonova.net.ua ([95.67.24.131]) by smtp.gmail.com with ESMTPSA id p5sm571964lfd.240.2021.07.28.01.18.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jul 2021 01:18:18 -0700 (PDT) X-MC-Unique: y09sR7qvPIuSfDz2kR0NSw-1 X-MC-Unique: EaBj7Z4tP46XbqiCXSm9QA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=K3Sz0c3WpQqSb+Sk/GziDCZqsTWNt387HEredPbWTmk=; b=VpF7d75487kU6Qx/IogBYc6e7ObJFRIMQTlOYWXZzF4AWOEFdduUTKKL2GWddFQp2A +c3lS2Kr+v1fSe7LaowQCbdDXoXoXjkWRaILl+Q72RRt/ptyCEI3DC50nttMue7slKs8 h0ZxEuj5NGRzusKdp8FRUS0DUAFHbjEdL/K3qebJiBZPMIb5NJPPZbINBuwizNpioeFY SwtE1z2f8Jj8hi6wv2n3IyNlD3fsT//BSdfo3JABlgFO87EeqbPMXGJr4WIgTDAYZ7gL DlJdYARxw7WfHFj8pdZ4vzAyVpabPIwUXB7T8p9PcKz1z+H6MDeJroYeGAefv04dbJ/y DzNQ== X-Gm-Message-State: AOAM531RDNzgKaM2dBM3aIvOnWnthCJDWBzu9k0kfwl82OfqXeCAFd3t V/DLAd7FwVG+9pytBG9dYh5ZaaFxfaGGvRop X-Google-Smtp-Source: ABdhPJxDCHXOKkNix1RHgH7bqvCLduBI4bdv3kjKNiEP5cAJLlXsuL8+Sk4ovO+vXAmcfpk0w9fzHw== X-Received: by 2002:a05:6512:990:: with SMTP id w16mr19700351lft.346.1627460298766; Wed, 28 Jul 2021 01:18:18 -0700 (PDT) From: Andrew Melnychenko To: libvir-list@redhat.com Subject: [RFC PATCH 08/10] qemu_command: Added ebpf RSS helper call for NIC creation. Date: Wed, 28 Jul 2021 11:17:12 +0300 Message-Id: <20210728081714.715287-9-andrew@daynix.com> In-Reply-To: <20210728081714.715287-1-andrew@daynix.com> References: <20210728081714.715287-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.79 on 10.11.54.5 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Wed, 28 Jul 2021 10:13:24 -0400 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.11 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: 1627481639695100002 Content-Type: text/plain; charset="utf-8" The helper called before NIC string creation. EBPF fds passed to the child = process. The helper called if qemu supports "ebpf_rss_fds" and returns the helper pa= th. If libvirt can't retrieve fds from the helper, qemu will be launched without "ebpf_rss_fds" virtio-net property. Signed-off-by: Andrew Melnychenko --- src/qemu/qemu_command.c | 36 +++++++++++++++++++++++++++++++++++- src/qemu/qemu_command.h | 2 ++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 67a396a513..2fffcee609 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3377,11 +3377,14 @@ qemuBuildNicDevStr(virDomainDef *def, virDomainNetDef *net, unsigned int bootindex, size_t vhostfdSize, + char **ebpfRSSfds, + size_t ebpfRSSnfds, virQEMUCaps *qemuCaps) { g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; bool usingVirtio =3D false; char macaddr[VIR_MAC_STRING_BUFLEN]; + size_t i =3D 0; =20 if (virDomainNetIsVirtioModel(net)) { if (qemuBuildVirtioDevStr(&buf, "virtio-net", qemuCaps, @@ -3498,6 +3501,15 @@ qemuBuildNicDevStr(virDomainDef *def, if (net->driver.virtio.rss =3D=3D VIR_TRISTATE_SWITCH_ON) { virBufferAsprintf(&buf, ",rss=3D%s", virTristateSwitchTypeToString(net->driver.virtio.rss)); + + if (ebpfRSSfds !=3D NULL && ebpfRSSnfds) + { + virBufferAsprintf(&buf, ",ebpf_rss_fds=3D"); + for (i =3D 0; i < (ebpfRSSnfds - 1); ++i) { + virBufferAsprintf(&buf, "%s:",ebpfRSSfds[i]); + } + virBufferAsprintf(&buf, "%s",ebpfRSSfds[ebpfRSSnfds - 1]); + } } =20 if (net->driver.virtio.rss_hash_report =3D=3D VIR_TRISTATE_SWITCH_= ON) { @@ -8492,6 +8504,9 @@ qemuBuildInterfaceCommandLine(virQEMUDriver *driver, qemuSlirp *slirp; size_t i; g_autoptr(virJSONValue) hostnetprops =3D NULL; + char **ebpfRSSfdsName =3D NULL; + int ebpfRSSfds[16] =3D {}; + int ebpfRSSnfds =3D 0; =20 =20 if (!bootindex) @@ -8744,8 +8759,20 @@ qemuBuildInterfaceCommandLine(virQEMUDriver *driver, if (qemuCommandAddExtDevice(cmd, &net->info) < 0) goto cleanup; =20 + if (net->driver.virtio.rss =3D=3D VIR_TRISTATE_SWITCH_ON + && virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_EBPF_RSS_FDS)= ) { + ebpfRSSnfds =3D qemuEbpfRssHelper(virQEMUCapsGetEBPFHelperPath= (qemuCaps), ebpfRSSfds, 16); + if (ebpfRSSnfds > 0) { + ebpfRSSfdsName =3D g_new0(char *, ebpfRSSnfds); + for (i =3D 0; i < ebpfRSSnfds; ++i) { + ebpfRSSfdsName[i] =3D g_strdup_printf("%d", ebpfRSSfds= [i]); + virCommandPassFD(cmd, ebpfRSSfds[i], VIR_COMMAND_PASS_= FD_CLOSE_PARENT); + } + } + } + if (!(nic =3D qemuBuildNicDevStr(def, net, bootindex, - net->driver.virtio.queues, qemuCaps= ))) + net->driver.virtio.queues, ebpfRSSf= dsName, ebpfRSSnfds, qemuCaps))) goto cleanup; virCommandAddArgList(cmd, "-device", nic, NULL); } else if (!requireNicdev) { @@ -8785,6 +8812,13 @@ qemuBuildInterfaceCommandLine(virQEMUDriver *driver, } VIR_FREE(tapfdName); VIR_FREE(vhostfd); + for (i =3D 0; ret < 0 && ebpfRSSfds[i] && i < 16; i++) { + if (ret < 0) + VIR_FORCE_CLOSE(ebpfRSSfds[i]); + if (ebpfRSSfdsName) + VIR_FREE(ebpfRSSfdsName[i]); + } + VIR_FREE(ebpfRSSfdsName); VIR_FREE(tapfd); VIR_FORCE_CLOSE(vdpafd); return ret; diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index 188e63ea1f..cab0bb7770 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -107,6 +107,8 @@ char *qemuBuildNicDevStr(virDomainDef *def, virDomainNetDef *net, unsigned int bootindex, size_t vhostfdSize, + char **ebpf_rss_fds, + size_t nfds, virQEMUCaps *qemuCaps); =20 char *qemuDeviceDriveHostAlias(virDomainDiskDef *disk); --=20 2.31.1 From nobody Sun May 5 15:31:12 2024 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 1627481639673427.32620281238667; Wed, 28 Jul 2021 07:13:59 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-476-UZo9NdzMM-K5YQrp-X2bwg-1; Wed, 28 Jul 2021 10:13:56 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ACEBE1006C8B; Wed, 28 Jul 2021 14:13:51 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 830CC104327D; Wed, 28 Jul 2021 14:13:51 +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 4A5504A70B; Wed, 28 Jul 2021 14:13:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 16S8IQub013843 for ; Wed, 28 Jul 2021 04:18:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id 332D4DAF10; Wed, 28 Jul 2021 08:18:26 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2E777DAF05 for ; Wed, 28 Jul 2021 08:18:23 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (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 AC258180F6E2 for ; Wed, 28 Jul 2021 08:18:23 +0000 (UTC) Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-380-94M7-bU1Maa0Nj5URW05SA-1; Wed, 28 Jul 2021 04:18:21 -0400 Received: by mail-lj1-f169.google.com with SMTP id h11so2037156ljo.12 for ; Wed, 28 Jul 2021 01:18:21 -0700 (PDT) Received: from navi.cosmonova.net.ua ([95.67.24.131]) by smtp.gmail.com with ESMTPSA id p5sm571964lfd.240.2021.07.28.01.18.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jul 2021 01:18:19 -0700 (PDT) X-MC-Unique: UZo9NdzMM-K5YQrp-X2bwg-1 X-MC-Unique: 94M7-bU1Maa0Nj5URW05SA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4NWx3znQYIBzGgtBS0IF3wEzmHDvmpTvDN6lNLyFhYA=; b=eH0RxdzczfYTC3sU0OaCQYbNx35dxvR7W1AdRccq5aDLaquJeQ8dpMbIPZtZLY5kKv KwPktzkVXKvI6G6A/hkgWNQiy/ANE8PO24v+mEXvvG1gXJslDQCVZkHkXO031PKEIRJ4 vC/mU23bQB+D/qRFYkaYBh6uQLnLlipwuvJaonMOvz/S291SRrEz7uxa1Xnypw5q49zF K+5W5aNkVJSXwzO3S7F+sDFJelP7pulro10klHHt8j06OtgmCrFahRzMMaPNDtpLhu8R JiWjCqxVxQ5G7VaJdAItipAfDj65IgxoDpsQ0IVNIq9L+Vv3KxK77lChWjbP5dxOhJHz szLg== X-Gm-Message-State: AOAM533xNsZ6tOk9yRokzM3z5qNQkNX/zGgr0PrmUQuAIXe0uNiRTfEJ SHG6li+Dam+xbDjQnIyoJ9FLDkxhOIYcVnC/ X-Google-Smtp-Source: ABdhPJwSBXr8q0jVeMVezFptMfkRVHB0p2avosimQan1mmfA+DFTD7thpSyZYeXWS5pMckBMxPCwoA== X-Received: by 2002:a2e:a44f:: with SMTP id v15mr17674758ljn.301.1627460299512; Wed, 28 Jul 2021 01:18:19 -0700 (PDT) From: Andrew Melnychenko To: libvir-list@redhat.com Subject: [RFC PATCH 09/10] qemu_hotplug: Added helper call for hotplug NIC. Date: Wed, 28 Jul 2021 11:17:13 +0300 Message-Id: <20210728081714.715287-10-andrew@daynix.com> In-Reply-To: <20210728081714.715287-1-andrew@daynix.com> References: <20210728081714.715287-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.79 on 10.11.54.5 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Wed, 28 Jul 2021 10:13:24 -0400 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.84 on 10.5.11.22 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: 1627481642682100001 Content-Type: text/plain; charset="utf-8" The helper called before NIC string creation. eBPF fds passed to the child = process through qmp. Qemu should support "ebpf_rss_fds" and return path to the helper. Also added check for device "update". Signed-off-by: Andrew Melnychenko --- src/qemu/qemu_hotplug.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 6743a8a742..6dd8e7dad4 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1205,6 +1205,9 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver, g_autofree char *netdev_name =3D NULL; g_autoptr(virConnect) conn =3D NULL; virErrorPtr save_err =3D NULL; + char **ebpfRSSfdsName =3D NULL; + int ebpfRSSfds[16] =3D {}; + int ebpfRSSnfds =3D 0; =20 /* If appropriate, grab a physical device from the configured * network's pool of devices, or resolve bridge device name @@ -1495,8 +1498,23 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver, for (i =3D 0; i < vhostfdSize; i++) VIR_FORCE_CLOSE(vhostfd[i]); =20 + if (net->driver.virtio.rss =3D=3D VIR_TRISTATE_SWITCH_ON + && virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_EBPF_RSS_FD= S)) { + ebpfRSSnfds =3D qemuEbpfRssHelper(virQEMUCapsGetEBPFHelperPath(pri= v->qemuCaps), ebpfRSSfds, 16); + if (ebpfRSSnfds > 0) { + ebpfRSSfdsName =3D g_new0(char *, ebpfRSSnfds); + for (i =3D 0; i < ebpfRSSnfds; ++i) { + ebpfRSSfdsName[i] =3D g_strdup_printf("ebpfrssfd-%s%zu", n= et->info.alias, i); + if (qemuMonitorSendFileHandle(priv->mon, NULL, ebpfRSSfds[= i])) { + ebpfRSSnfds =3D 0; + break; + } + } + } + } + if (!(nicstr =3D qemuBuildNicDevStr(vm->def, net, 0, - queueSize, priv->qemuCaps))) + queueSize, ebpfRSSfdsName, ebpfRSSnf= ds, priv->qemuCaps))) goto try_remove; =20 qemuDomainObjEnterMonitor(driver, vm); @@ -1599,6 +1617,12 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver, } VIR_FREE(vhostfd); VIR_FREE(vhostfdName); + for (i =3D 0; ret < 0 && ebpfRSSfds[i] && i < 16; i++) { + VIR_FORCE_CLOSE(ebpfRSSfds[i]); + if (ebpfRSSfdsName) + VIR_FREE(ebpfRSSfdsName[i]); + } + VIR_FREE(ebpfRSSfdsName); virDomainCCWAddressSetFree(ccwaddrs); VIR_FORCE_CLOSE(slirpfd); VIR_FORCE_CLOSE(vdpafd); @@ -3624,7 +3648,9 @@ qemuDomainChangeNet(virQEMUDriver *driver, olddev->driver.virtio.guest.tso4 !=3D newdev->driver.virtio.guest= .tso4 || olddev->driver.virtio.guest.tso6 !=3D newdev->driver.virtio.guest= .tso6 || olddev->driver.virtio.guest.ecn !=3D newdev->driver.virtio.guest.= ecn || - olddev->driver.virtio.guest.ufo !=3D newdev->driver.virtio.guest.= ufo)) { + olddev->driver.virtio.guest.ufo !=3D newdev->driver.virtio.guest.= ufo || + olddev->driver.virtio.rss !=3D newdev->driver.virtio.rss || + olddev->driver.virtio.rss_hash_report !=3D newdev->driver.virtio.= rss_hash_report)) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("cannot modify virtio network device driver attri= butes")); goto cleanup; --=20 2.31.1 From nobody Sun May 5 15:31:12 2024 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 1627481634974264.1978279358376; Wed, 28 Jul 2021 07:13:54 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-466-RqTJk28lP32g9Tl9dNAXZA-1; Wed, 28 Jul 2021 10:13:51 -0400 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 9B190802B9E; Wed, 28 Jul 2021 14:13:45 +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 76FD75D9FC; Wed, 28 Jul 2021 14:13:45 +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 38118180BABF; Wed, 28 Jul 2021 14:13:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 16S8IOjM013827 for ; Wed, 28 Jul 2021 04:18:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 77C84200E4A9; Wed, 28 Jul 2021 08:18:24 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 736E3200AD0C for ; Wed, 28 Jul 2021 08:18:24 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (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 5CA12180F6E6 for ; Wed, 28 Jul 2021 08:18:24 +0000 (UTC) Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-254-uJXv9ExBPAS8t5DaTNqYZw-1; Wed, 28 Jul 2021 04:18:22 -0400 Received: by mail-lj1-f176.google.com with SMTP id h9so2063936ljq.8 for ; Wed, 28 Jul 2021 01:18:21 -0700 (PDT) Received: from navi.cosmonova.net.ua ([95.67.24.131]) by smtp.gmail.com with ESMTPSA id p5sm571964lfd.240.2021.07.28.01.18.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jul 2021 01:18:19 -0700 (PDT) X-MC-Unique: RqTJk28lP32g9Tl9dNAXZA-1 X-MC-Unique: uJXv9ExBPAS8t5DaTNqYZw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ue+t1CS7QuGdcel7FMjYX+4PS+GcJsjTPYqf18xxr90=; b=cC3SkJEeMfs30E/BB56kVNgQi69dqZTiAEjFNOu58l26b/FCKDa6jZPxmDSbG4JY36 M7+D8ntGnkLSxJkw0xF77KgJ0PN+U2xH6jin9xQrG6/xjs5kR5ZcYHBNdUTZ4w2ap5Oh Pf7C/YTE6XDS/FvwIY+AHRNfZAKh8al4tYrWDY4+HYkGgNrimgTYQ493Ps9MFlMjBq83 E+zeXLufcalDSgVqbiKJdLT3uXCTK+vpRJ/DtyVle0MnX1KkO1sF04FBmaswEZXuNSsU jojXnvlE6o6ig0IFOJDL4qjiruUdwElUL7/nLd9MmdwvyegE2I9bKkV28ADl3EWGrVfr cY/A== X-Gm-Message-State: AOAM532CuU9nii5L9rgEimodueTfS9CVBTQp6+FsOl0V+ZNQGhCkY9Gh iVN5IFn7cWfzKBBPElVwtl+aE/lwIgguQIWn X-Google-Smtp-Source: ABdhPJxxSzn9ddM6XcdMlsCfM85ksH025uETETaDaMzMobxBE9l8UgRU72CZxRshvDajAANpddhAZA== X-Received: by 2002:a2e:8e88:: with SMTP id z8mr18853713ljk.487.1627460300288; Wed, 28 Jul 2021 01:18:20 -0700 (PDT) From: Andrew Melnychenko To: libvir-list@redhat.com Subject: [RFC PATCH 10/10] docs: Added descriptions for "rss" and "rss_hash_report" configurations. Date: Wed, 28 Jul 2021 11:17:14 +0300 Message-Id: <20210728081714.715287-11-andrew@daynix.com> In-Reply-To: <20210728081714.715287-1-andrew@daynix.com> References: <20210728081714.715287-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.78 on 10.11.54.6 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Wed, 28 Jul 2021 10:13:24 -0400 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: 1627481635241100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Andrew Melnychenko --- docs/formatdomain.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 61ccd8895a..22ad19439f 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -5233,6 +5233,22 @@ 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. For ebpf RSS the "ebpf helper" is used. H= elper + binary path received from qemu by qmp. The helper is't used if qemu doe= sn't + provide "ebpf_rss_fds" property or helper path. Without helper, virtio = NIC + will be launched only with "rss" property. Qemu may load eBPF by itself= if it + has CAP_SYS_ADMIN permissions. In other cases, "in-qemu" RSS is used. + **In general you should leave this option alone, unless you are very ce= rtain + you know what you are doing.** +``rss_hash_report`` + The ``rss_hash_report`` option enables in-qemu RSS hash report for virt= io + NIC. Ebpf RSS doesn't support hash report yet. Usually enabled alongsid= e 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.** virtio options For virtio interfaces, `Virtio-specific options <#elementsVirtio>`__ ca= n also be set. ( :since:`Since 3.5.0` ) --=20 2.31.1