qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/5] ebpf: Added eBPF initialization by fds and map update.


From: Andrew Melnichenko
Subject: Re: [PATCH 1/5] ebpf: Added eBPF initialization by fds and map update.
Date: Wed, 25 Aug 2021 21:13:38 +0300

Hi,
Yes - to make the bpf() syscall capabilities are required, which libvirt have no intentions to give.
Does it make any sense to leave syscall if mmap works?

On Fri, Aug 20, 2021 at 6:34 AM Jason Wang <jasowang@redhat.com> wrote:

在 2021/7/13 下午11:37, Andrew Melnychenko 写道:
> -static bool ebpf_rss_set_indirections_table(struct EBPFRSSContext *ctx,
> -                                            uint16_t *indirections_table,
> -                                            size_t len)
> -{
> -    uint32_t i = 0;
> +    ctx->program_fd = program_fd;
> +    ctx->map_configuration = config_fd;
>   
> -    if (!ebpf_rss_is_loaded(ctx) || indirections_table == NULL ||
> -       len > VIRTIO_NET_RSS_MAX_TABLE_LEN) {
> +    ctx->mmap_configuration = mmap(NULL, qemu_real_host_page_size,
> +                                   PROT_READ | PROT_WRITE, MAP_SHARED,
> +                                   ctx->map_configuration, 0);
> +    if (ctx->mmap_configuration == MAP_FAILED) {
> +        trace_ebpf_error("eBPF RSS", "can not mmap eBPF configuration array");
>           return false;
>       }
>   
> -    for (; i < len; ++i) {
> -        if (bpf_map_update_elem(ctx->map_indirections_table, &i,
> -                                indirections_table + i, 0) < 0) {
> -            return false;
> -        }
> -    }
> -    return true;
> -}
> -


It looks to me you want to drop syscall path for map updating
completely. I think we'd better keep that for backward compatibility?

Thanks


reply via email to

[Prev in Thread] Current Thread [Next in Thread]