Re: [PATCH v2 bpf-next 04/12] bpf: Define enum bpf_core_relo_kind as uapi.

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

 



On Thu, Nov 11, 2021 at 9:02 PM Alexei Starovoitov
<alexei.starovoitov@xxxxxxxxx> wrote:
>
> From: Alexei Starovoitov <ast@xxxxxxxxxx>
>
> enum bpf_core_relo_kind is generated by llvm and processed by libbpf.
> It's a de-facto uapi.
> With CO-RE in the kernel the bpf_core_relo_kind values become uapi de-jure.
> Also rename them with BPF_CORE_ prefix to distinguish from conflicting names in
> bpf_core_read.h. The enums bpf_field_info_kind, bpf_type_id_kind,
> bpf_type_info_kind, bpf_enum_value_kind are passing different values from bpf
> program into llvm.
>
> Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx>
> Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
> ---
>  include/uapi/linux/bpf.h       | 19 ++++++++
>  tools/include/uapi/linux/bpf.h | 19 ++++++++
>  tools/lib/bpf/libbpf.c         |  2 +-
>  tools/lib/bpf/relo_core.c      | 84 +++++++++++++++++-----------------
>  tools/lib/bpf/relo_core.h      | 18 --------
>  5 files changed, 81 insertions(+), 61 deletions(-)
>

[...]

> index 3b9f8f18346c..7720af11f96f 100644
> --- a/tools/lib/bpf/relo_core.h
> +++ b/tools/lib/bpf/relo_core.h
> @@ -4,24 +4,6 @@
>  #ifndef __RELO_CORE_H
>  #define __RELO_CORE_H

Can you please add #include <linux/bpf.h> here for enum
bpf_core_relo_kind? It should be fine for both libbpf and kernel
modes. Implicit #include dependency is very confusing.

>
> -/* bpf_core_relo_kind encodes which aspect of captured field/type/enum value
> - * has to be adjusted by relocations.
> - */
> -enum bpf_core_relo_kind {
> -       BPF_FIELD_BYTE_OFFSET = 0,      /* field byte offset */
> -       BPF_FIELD_BYTE_SIZE = 1,        /* field size in bytes */
> -       BPF_FIELD_EXISTS = 2,           /* field existence in target kernel */
> -       BPF_FIELD_SIGNED = 3,           /* field signedness (0 - unsigned, 1 - signed) */
> -       BPF_FIELD_LSHIFT_U64 = 4,       /* bitfield-specific left bitshift */
> -       BPF_FIELD_RSHIFT_U64 = 5,       /* bitfield-specific right bitshift */
> -       BPF_TYPE_ID_LOCAL = 6,          /* type ID in local BPF object */
> -       BPF_TYPE_ID_TARGET = 7,         /* type ID in target kernel */
> -       BPF_TYPE_EXISTS = 8,            /* type existence in target kernel */
> -       BPF_TYPE_SIZE = 9,              /* type size in bytes */
> -       BPF_ENUMVAL_EXISTS = 10,        /* enum value existence in target kernel */
> -       BPF_ENUMVAL_VALUE = 11,         /* enum value integer value */
> -};
> -
>  /* The minimum bpf_core_relo checked by the loader
>   *
>   * CO-RE relocation captures the following data:
> --
> 2.30.2
>



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux