• David Vernet's avatar
    bpf: Define new BPF_MAP_TYPE_USER_RINGBUF map type · 583c1f42
    David Vernet authored
    We want to support a ringbuf map type where samples are published from
    user-space, to be consumed by BPF programs. BPF currently supports a
    kernel -> user-space circular ring buffer via the BPF_MAP_TYPE_RINGBUF
    map type.  We'll need to define a new map type for user-space -> kernel,
    as none of the helpers exported for BPF_MAP_TYPE_RINGBUF will apply
    to a user-space producer ring buffer, and we'll want to add one or
    more helper functions that would not apply for a kernel-producer
    ring buffer.
    
    This patch therefore adds a new BPF_MAP_TYPE_USER_RINGBUF map type
    definition. The map type is useless in its current form, as there is no
    way to access or use it for anything until we one or more BPF helpers. A
    follow-on patch will therefore add a new helper function that allows BPF
    programs to run callbacks on samples that are published to the ring
    buffer.
    Signed-off-by: default avatarDavid Vernet <void@manifault.com>
    Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
    Acked-by: default avatarAndrii Nakryiko <andrii@kernel.org>
    Link: https://lore.kernel.org/bpf/20220920000100.477320-2-void@manifault.com
    583c1f42
ringbuf.c 16.4 KB