xref: /openbmc/qemu/qapi/ebpf.json (revision 8698e144)
1e88899faSAndrew Melnychenko# -*- Mode: Python -*-
2e88899faSAndrew Melnychenko# vim: filetype=python
3e88899faSAndrew Melnychenko#
4e88899faSAndrew Melnychenko# This work is licensed under the terms of the GNU GPL, version 2 or later.
5e88899faSAndrew Melnychenko# See the COPYING file in the top-level directory.
6e88899faSAndrew Melnychenko
7e88899faSAndrew Melnychenko##
8e88899faSAndrew Melnychenko# = eBPF Objects
9e88899faSAndrew Melnychenko#
10e88899faSAndrew Melnychenko# eBPF object is an ELF binary that contains the eBPF
11e88899faSAndrew Melnychenko# program and eBPF map description(BTF). Overall, eBPF
12e88899faSAndrew Melnychenko# object should contain the program and enough metadata
13e88899faSAndrew Melnychenko# to create/load eBPF with libbpf. As the eBPF maps/program
14e88899faSAndrew Melnychenko# should correspond to QEMU, the eBPF can't be used from
15e88899faSAndrew Melnychenko# different QEMU build.
16e88899faSAndrew Melnychenko#
17e88899faSAndrew Melnychenko# Currently, there is a possible eBPF for receive-side scaling (RSS).
18e88899faSAndrew Melnychenko#
19e88899faSAndrew Melnychenko##
20e88899faSAndrew Melnychenko
21e88899faSAndrew Melnychenko##
22e88899faSAndrew Melnychenko# @EbpfObject:
23e88899faSAndrew Melnychenko#
24e88899faSAndrew Melnychenko# An eBPF ELF object.
25e88899faSAndrew Melnychenko#
26e88899faSAndrew Melnychenko# @object: the eBPF object encoded in base64
27e88899faSAndrew Melnychenko#
28e88899faSAndrew Melnychenko# Since: 9.0
29e88899faSAndrew Melnychenko##
30e88899faSAndrew Melnychenko{ 'struct': 'EbpfObject',
31e88899faSAndrew Melnychenko  'data': {'object': 'str'},
32e88899faSAndrew Melnychenko  'if': 'CONFIG_EBPF' }
33e88899faSAndrew Melnychenko
34e88899faSAndrew Melnychenko##
35e88899faSAndrew Melnychenko# @EbpfProgramID:
36e88899faSAndrew Melnychenko#
37e88899faSAndrew Melnychenko# The eBPF programs that can be gotten with request-ebpf.
38e88899faSAndrew Melnychenko#
39e88899faSAndrew Melnychenko# @rss: Receive side scaling, technology that allows steering traffic
40e88899faSAndrew Melnychenko#     between queues by calculation hash.  Users may set up
41e88899faSAndrew Melnychenko#     indirection table and hash/packet types configurations.  Used
42e88899faSAndrew Melnychenko#     with virtio-net.
43e88899faSAndrew Melnychenko#
44e88899faSAndrew Melnychenko# Since: 9.0
45e88899faSAndrew Melnychenko##
46e88899faSAndrew Melnychenko{ 'enum': 'EbpfProgramID',
47e88899faSAndrew Melnychenko  'if': 'CONFIG_EBPF',
48e88899faSAndrew Melnychenko  'data': [ { 'name': 'rss' } ] }
49e88899faSAndrew Melnychenko
50e88899faSAndrew Melnychenko##
51e88899faSAndrew Melnychenko# @request-ebpf:
52e88899faSAndrew Melnychenko#
53e88899faSAndrew Melnychenko# Retrieve an eBPF object that can be loaded with libbpf.  Management
54*8698e144SMarkus Armbruster# applications (e.g. libvirt) may load it and pass file descriptors to
55e88899faSAndrew Melnychenko# QEMU, so they can run running QEMU without BPF capabilities.
56e88899faSAndrew Melnychenko#
57e88899faSAndrew Melnychenko# @id: The ID of the program to return.
58e88899faSAndrew Melnychenko#
59e88899faSAndrew Melnychenko# Returns: eBPF object encoded in base64.
60e88899faSAndrew Melnychenko#
61e88899faSAndrew Melnychenko# Since: 9.0
62e88899faSAndrew Melnychenko##
63e88899faSAndrew Melnychenko{ 'command': 'request-ebpf',
64e88899faSAndrew Melnychenko  'data': { 'id': 'EbpfProgramID' },
65e88899faSAndrew Melnychenko  'returns': 'EbpfObject',
66e88899faSAndrew Melnychenko  'if': 'CONFIG_EBPF' }
67