On 5/12/24 21:45, Andrew Melnychenko wrote:
> 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 
> program and maps.
> 
> Signed-off-by: Andrew Melnychenko <and...@daynix.com>
> ---
>  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,
>  
>      return qemuMonitorJSONDisplayReload(mon, type, tlsCerts);
>  }
> +
> +const char *
> +qemuMonitorGetEbpf(qemuMonitor *mon, const char *ebpfName)

I'm going to mentioned it here, because this is the first occurrence and
then I'll stop pointing it out: libvirt's coding style is a bit
different. I think the pre-exiting code around may give you couple of
examples. Anyway, this is a nitpick.

> +{
> +    QEMU_CHECK_MONITOR_NULL(mon);
> +
> +    if (ebpfName == NULL) {
> +        virReportInvalidNonNullArg(ebpfName);
> +        return NULL;
> +    }

We don't usually do this kind of check here. Usually there's just one
(or very few) callers of these functions and they can verify arguments
passed).

> +
> +    return qemuMonitorJSONGetEbpf(mon, ebpfName);
> +}

Michal

Reply via email to