Skip to content

RFC bpf: Clean up _OR_NULL arg types

Hao Luo bpf 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest8 of 9 patches 8 repliesIn review

8 of 9 patches are in this archive. The cover letter announces 9.

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
2/9bpf: Remove ARG_PTR_TO_MAP_VALUE_OR_NULLinclude/linux/bpf.h kernel/bpf/bpf_inode_storage.c kernel/bpf/bpf_task_storage.c +2 more+30 -120 replies
3/9bpf: Remove ARG_PTR_TO_MEM_OR_NULLinclude/linux/bpf.h kernel/bpf/helpers.c kernel/bpf/verifier.c +2 more+32 -120 replies
4/9bpf: Remove ARG_CONST_SIZE_OR_ZEROinclude/linux/bpf.h kernel/bpf/helpers.c kernel/bpf/ringbuf.c +4 more+135 -401 reply
5/9bpf: Remove ARG_PTR_TO_CTX_OR_NULLinclude/linux/bpf.h kernel/bpf/cgroup.c kernel/bpf/verifier.c +1 more+20 -80 replies
6/9bpf: Remove ARG_PTR_TO_SOCKET_OR_NULLinclude/linux/bpf.h kernel/bpf/verifier.c net/core/filter.c+4 -40 replies
7/9bpf: Remove ARG_PTR_TO_ALLOC_MEM_OR_NULLinclude/linux/bpf.h kernel/bpf/verifier.c+0 -30 replies
8/9bpf: Rename ARG_CONST_ALLOC_SIZE_OR_ZEROinclude/linux/bpf.h kernel/bpf/ringbuf.c kernel/bpf/verifier.c+7 -40 replies
9/9bpf: Rename ARG_PTR_TO_STACK_OR_NULLinclude/linux/bpf.h kernel/bpf/bpf_iter.c kernel/bpf/task_iter.c +1 more+11 -60 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH bpf-next 0/9] bpf: Clean up _OR_NULL arg types

This is a pure cleanup patchset that tries to use flag to mark whether an arg may be null. It replaces enum bpf_arg_type with a struct. Doing so allows us to embed the properties of arguments in the struct, which is a more scalable solution than introducing a new enum. This patchset performs this transformation only on arg_type. If it looks good, follow-up patches will do the same on reg_type and ret_type.

The first patch replaces 'enum bpf_arg_type' with 'struct bpf_arg_type' and each of the rest patches transforms one type of ARG_XXX_OR_NULLs.

This is purely refactoring patch and should not have any behavior changes.

Hao Luo (9):
bpf: Replace enum bpf_arg_type with struct.
bpf: Remove ARG_PTR_TO_MAP_VALUE_OR_NULL
bpf: Remove ARG_PTR_TO_MEM_OR_NULL
bpf: Remove ARG_CONST_SIZE_OR_ZERO
bpf: Remove ARG_PTR_TO_CTX_OR_NULL
bpf: Remove ARG_PTR_TO_SOCKET_OR_NULL
bpf: Remove ARG_PTR_TO_ALLOC_MEM_OR_NULL
bpf: Rename ARG_CONST_ALLOC_SIZE_OR_ZERO
bpf: Rename ARG_PTR_TO_STACK_OR_NULL

 include/linux/bpf.h            | 102 ++---
 kernel/bpf/bpf_inode_storage.c |  15 +-
 kernel/bpf/bpf_iter.c          |  11 +-
 kernel/bpf/bpf_lsm.c           |  10 +-
 kernel/bpf/bpf_task_storage.c  |  15 +-
 kernel/bpf/btf.c               |   8 +-
 kernel/bpf/cgroup.c            |  31 +-
 kernel/bpf/core.c              |   8 +-
 kernel/bpf/helpers.c           | 138 ++++---
 kernel/bpf/ringbuf.c           |  32 +-
 kernel/bpf/stackmap.c          |  45 +-
 kernel/bpf/syscall.c           |  16 +-
 kernel/bpf/task_iter.c         |  13 +-
 kernel/bpf/verifier.c          | 179 ++++----
 kernel/trace/bpf_trace.c       | 267 +++++++-----
 net/core/bpf_sk_storage.c      |  41 +-
 net/core/filter.c              | 729 +++++++++++++++++----------------
 net/core/sock_map.c            |  48 +--
 net/ipv4/bpf_tcp_ca.c          |   4 +-
 19 files changed, 932 insertions(+), 780 deletions(-)
Signature · 1 line
2.34.0.rc0.344.g81b53c2807-goog