[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 5/6] qmp: Added new command to retrieve eBPF blob.
From: |
Andrew Melnychenko |
Subject: |
[PATCH v3 5/6] qmp: Added new command to retrieve eBPF blob. |
Date: |
Thu, 15 Jun 2023 01:10:25 +0300 |
Added command "request-ebpf". This command returns
eBPF program encoded base64. The program taken from the
skeleton and essentially is an ELF object that can be
loaded in the future with libbpf.
Signed-off-by: Andrew Melnychenko <andrew@daynix.com>
---
qapi/ebpf.json | 55 +++++++++++++++++++++++++++++++++++++++++++
qapi/meson.build | 1 +
qapi/qapi-schema.json | 1 +
3 files changed, 57 insertions(+)
create mode 100644 qapi/ebpf.json
diff --git a/qapi/ebpf.json b/qapi/ebpf.json
new file mode 100644
index 00000000000..6f9a1f1a0c9
--- /dev/null
+++ b/qapi/ebpf.json
@@ -0,0 +1,55 @@
+# -*- Mode: Python -*-
+# vim: filetype=python
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or later.
+# See the COPYING file in the top-level directory.
+
+##
+# = Machines
+##
+
+{ 'include': 'common.json' }
+
+##
+# @EbpfObject:
+#
+# Structure that holds eBPF ELF object encoded in base64.
+#
+# Since: 8.1
+#
+##
+{ 'struct': 'EbpfObject',
+ 'data': {'object': 'str'} }
+
+##
+# @EbpfProgramID:
+#
+# An enumeration of the eBPF programs. Currently, only RSS is presented.
+# RSS - Receive side scaling, technology that allows steering traffic
+# between queues by calculation hash. Users may set up indirection table
+# and hash/packet types configurations. Used with virtio-net.
+#
+# Since: 8.1
+##
+{ 'enum': 'EbpfProgramID',
+ 'data': [ { 'name': 'rss', 'if': 'CONFIG_EBPF' } ] }
+
+##
+# @request-ebpf:
+#
+# Returns eBPF object that can be loaded with libbpf.
+# Management applications (g.e. libvirt) may load it and pass file
+# descriptors to QEMU. Which allows running QEMU without BPF capabilities.
+# It's crucial that eBPF program/map is compatible with QEMU, so it's
+# provided through QMP.
+#
+# Returns: RSS eBPF object encoded in base64.
+#
+# Since: 8.1
+#
+##
+{ 'command': 'request-ebpf',
+ 'data': { 'id': 'EbpfProgramID' },
+ 'returns': 'EbpfObject',
+ 'if': 'CONFIG_EBPF' }
+
diff --git a/qapi/meson.build b/qapi/meson.build
index 9fd480c4d81..12a1cb1f9c2 100644
--- a/qapi/meson.build
+++ b/qapi/meson.build
@@ -52,6 +52,7 @@ qapi_all_modules = [
'transaction',
'virtio',
'yank',
+ 'ebpf',
]
if have_system
qapi_all_modules += [
diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
index 6594afba312..169cfe8d386 100644
--- a/qapi/qapi-schema.json
+++ b/qapi/qapi-schema.json
@@ -79,3 +79,4 @@
{ 'include': 'virtio.json' }
{ 'include': 'cryptodev.json' }
{ 'include': 'cxl.json' }
+{ 'include': 'ebpf.json' }
--
2.39.1
- [PATCH v3 0/6] eBPF RSS through QMP support., Andrew Melnychenko, 2023/06/14
- [PATCH v3 1/6] ebpf: Added eBPF map update through mmap., Andrew Melnychenko, 2023/06/14
- [PATCH v3 2/6] ebpf: Added eBPF initialization by fds., Andrew Melnychenko, 2023/06/14
- [PATCH v3 3/6] virtio-net: Added property to load eBPF RSS with fds., Andrew Melnychenko, 2023/06/14
- [PATCH v3 5/6] qmp: Added new command to retrieve eBPF blob.,
Andrew Melnychenko <=
- [PATCH v3 4/6] ebpf: Added declaration/initialization routines., Andrew Melnychenko, 2023/06/14
- [PATCH v3 6/6] ebpf: Updated eBPF program and skeleton., Andrew Melnychenko, 2023/06/14
- Re: [PATCH v3 0/6] eBPF RSS through QMP support., Jason Wang, 2023/06/30