From nobody Sat Nov 23 15:09:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1715544884880989.0109391536582; Sun, 12 May 2024 13:14:44 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id C11AF1B25; Sun, 12 May 2024 16:14:43 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 6C6F71AA3; Sun, 12 May 2024 16:12:53 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id DDC071A57; Sun, 12 May 2024 16:12:48 -0400 (EDT) Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 190841A68 for ; Sun, 12 May 2024 16:12:46 -0400 (EDT) Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-41fd5dc0508so23140335e9.0 for ; Sun, 12 May 2024 13:12:46 -0700 (PDT) Received: from localhost.localdomain ([162.213.65.233]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42014f563adsm22354735e9.38.2024.05.12.13.12.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 May 2024 13:12:44 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715544765; x=1716149565; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ypDz4+AYTmCCi4wCr/0XwHo7pKBjTs1Rm0ekHEbT9FU=; b=j9cSdq07+gHBAjPKCBRsZ/cZcEIXPZJCgtmD5rwk2nNPFZSRllI6PXUyMMtLKR3xPW TvedRg432IVYRDGFFcLyHlcrDGEa8f9kgu5daFmjdpNS6bALQo1CAMYV1yTgCYyQ7WsP DcKh3BBKMFH6L9M9c+CO59ZgdzMobwigDp9Z2YrrgcnIqLO+FtQzBaJAKzBuK2P/i9Hd yMPvJhA8jkpaFNeoYGHAF7qTsJyZNb7gHMN0ZXh+Q2DM4Fqu9xLunX/I2sw74SZ+97J/ wTovfmcKuPrjFa+ltlFd5lElIc5+Xq8cahmAV1xq0ADf+HJXS+8qBFdgx3C5B+exzxEU +zRg== X-Gm-Message-State: AOJu0YwEmGSAX0RCaX1+pGgUUE2ijpqZvxh2OF5ROKZ4jPgF+aOS7kVV LS3mVDN3Lv1gCCE1pgjB0pz7/E1F/p6kiI2JUFnf8rt5C7YmNz24L1Uzi0hlqiG/rS8f9K9Wc5R p X-Google-Smtp-Source: AGHT+IFUkxbL5Qqm9eKDAVI5taFs1EXZusZBN439d9rTMJHvF8F3kSjQAqTg9jLjBS80fw224rDHZQ== X-Received: by 2002:a05:600c:4fcd:b0:41c:2931:e670 with SMTP id 5b1f17b1804b1-41fea9320acmr57241305e9.2.1715544764913; Sun, 12 May 2024 13:12:44 -0700 (PDT) From: Andrew Melnychenko To: devel@lists.libvirt.org Subject: [RFC PATCH v3 1/6] qemu_monitor: Added QEMU's "request-ebpf" support. Date: Sun, 12 May 2024 22:45:43 +0300 Message-ID: <20240512194550.5023-2-andrew@daynix.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240512194550.5023-1-andrew@daynix.com> References: <20240512194550.5023-1-andrew@daynix.com> MIME-Version: 1.0 Message-ID-Hash: XUA3IFOQMANMKVEMHE4VRVN35DVGEMVQ X-Message-ID-Hash: XUA3IFOQMANMKVEMHE4VRVN35DVGEMVQ X-MailFrom: andrew@daynix.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: yuri.benditovich@daynix.com, yan@daynix.com X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1715544885540100001 Added code for monitor and monitor_json. The "request-ebpf" return's eBPF binary object encoded in base64. QEMU provides eBPF that can be loaded and passed to it from Libvirt. QEMU requires exact eBPF program/maps, so it can be retrieved using QAPI. To load eBPF program - administrative capabilities are required, so Libvirt may load it and pass it to the QEMU instance. For now, there is only "RSS"(Receive Side Scaling) for virtio-net eBPF prog= ram and maps. Signed-off-by: Andrew Melnychenko --- src/qemu/qemu_monitor.c | 13 +++++++++++++ src/qemu/qemu_monitor.h | 3 +++ src/qemu/qemu_monitor_json.c | 26 ++++++++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 3 +++ 4 files changed, 45 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 34e2ccab97..1dc2fa3fac 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4511,3 +4511,16 @@ qemuMonitorDisplayReload(qemuMonitor *mon, =20 return qemuMonitorJSONDisplayReload(mon, type, tlsCerts); } + +const char * +qemuMonitorGetEbpf(qemuMonitor *mon, const char *ebpfName) +{ + QEMU_CHECK_MONITOR_NULL(mon); + + if (ebpfName =3D=3D NULL) { + virReportInvalidNonNullArg(ebpfName); + return NULL; + } + + return qemuMonitorJSONGetEbpf(mon, ebpfName); +} diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 6e81945201..fe8853a2c4 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1586,3 +1586,6 @@ int qemuMonitorDisplayReload(qemuMonitor *mon, const char *type, bool tlsCerts); + +const char * +qemuMonitorGetEbpf(qemuMonitor *mon, const char *ebpfName); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index eb84a3d938..585a645e66 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -8896,3 +8896,29 @@ int qemuMonitorJSONDisplayReload(qemuMonitor *mon, =20 return 0; } + +const char * +qemuMonitorJSONGetEbpf(qemuMonitor *mon, const char *ebpfName) +{ + g_autoptr(virJSONValue) cmd =3D NULL; + g_autoptr(virJSONValue) reply =3D NULL; + virJSONValue *ret =3D NULL; + + if (!(cmd =3D qemuMonitorJSONMakeCommand("request-ebpf", "s:id", ebpfN= ame, NULL))) + return NULL; + + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + return NULL; + + if (qemuMonitorJSONCheckError(cmd, reply) < 0) + return NULL; + + ret =3D virJSONValueObjectGet(reply, "return"); + if (!ret) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("request-ebpf reply was missing 'return' data")); + return NULL; + } + + return g_strdup(virJSONValueObjectGetString(ret, "object")); +} diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 9684660d86..4a6fc9324e 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -829,3 +829,6 @@ qemuMonitorJSONQueryStats(qemuMonitor *mon, int qemuMonitorJSONDisplayReload(qemuMonitor *mon, const char *type, bool tlsCerts); + +const char * +qemuMonitorJSONGetEbpf(qemuMonitor *mon, const char *ebpfName); --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org