Re: [PATCH v2 bpf-next 7/9] libbpf: add libbpf support to batch ops

From: Yonghong Song
Date: Thu Nov 21 2019 - 13:30:32 EST




On 11/19/19 11:30 AM, Brian Vazquez wrote:
> From: Yonghong Song <yhs@xxxxxx>
>
> Added four libbpf API functions to support map batch operations:
> . int bpf_map_delete_batch( ... )
> . int bpf_map_lookup_batch( ... )
> . int bpf_map_lookup_and_delete_batch( ... )
> . int bpf_map_update_batch( ... )
>
> Signed-off-by: Yonghong Song <yhs@xxxxxx>
> ---
> tools/lib/bpf/bpf.c | 61 ++++++++++++++++++++++++++++++++++++++++
> tools/lib/bpf/bpf.h | 14 +++++++++
> tools/lib/bpf/libbpf.map | 4 +++
> 3 files changed, 79 insertions(+)
>
> diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
> index 98596e15390fb..9acd9309b47b3 100644
> --- a/tools/lib/bpf/bpf.c
> +++ b/tools/lib/bpf/bpf.c
> @@ -443,6 +443,67 @@ int bpf_map_freeze(int fd)
> return sys_bpf(BPF_MAP_FREEZE, &attr, sizeof(attr));
> }
>
[...]> LIBBPF_API int bpf_obj_pin(int fd, const char *pathname);
> LIBBPF_API int bpf_obj_get(const char *pathname);
> LIBBPF_API int bpf_prog_attach(int prog_fd, int attachable_fd,
> diff --git a/tools/lib/bpf/libbpf.map b/tools/lib/bpf/libbpf.map
> index 8ddc2c40e482d..56462fea66f74 100644
> --- a/tools/lib/bpf/libbpf.map
> +++ b/tools/lib/bpf/libbpf.map
> @@ -207,4 +207,8 @@ LIBBPF_0.0.6 {
> bpf_program__size;
> btf__find_by_name_kind;
> libbpf_find_vmlinux_btf_id;
> + bpf_map_delete_batch;
> + bpf_map_lookup_and_delete_batch;
> + bpf_map_lookup_batch;
> + bpf_map_update_batch;

Please insert new API functions following alphabet ordering.

> } LIBBPF_0.0.5;
>