Skip to content

implementation of eBPF maps

Alexei Starovoitov linux-api lkml netdev 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest7 patches 8 repliesIn review
  2. v17 patches 8 repliesSuperseded

Changes in v2 from the cover letter

renamed flags for MAP_UPDATE_ELEM command to be more concise, clarified commit logs and improved comments in patches 1,3,7 per discussions with Daniel

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7bpf: add 'flags' attribute to BPF_MAP_UPDATE_ELEM commandinclude/linux/bpf.h include/uapi/linux/bpf.h kernel/bpf/syscall.c+10 -44 replies
2/7bpf: add hashtable type of eBPF mapsinclude/uapi/linux/bpf.h kernel/bpf/Makefile kernel/bpf/hashtab.c+364 -10 replies
3/7bpf: add array type of eBPF mapsinclude/uapi/linux/bpf.h kernel/bpf/Makefile kernel/bpf/arraymap.c+153 -10 replies
4/7bpf: fix BPF_MAP_LOOKUP_ELEM command return codekernel/bpf/syscall.c+1 -10 replies
5/7bpf: add a testsuite for eBPF mapssamples/bpf/Makefile samples/bpf/libbpf.c samples/bpf/libbpf.h +1 more+296 -30 replies
6/7bpf: allow eBPF programs to use mapsinclude/linux/bpf.h include/uapi/linux/bpf.h kernel/bpf/Makefile +1 more+98 -13 replies
7/7bpf: remove test map scaffolding and user proper typeskernel/bpf/test_stub.c samples/bpf/test_verifier.c+16 -540 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [PATCH v2 net-next 0/7] implementation of eBPF maps

Hi All,

v1->v2:
renamed flags for MAP_UPDATE_ELEM command to be more concise, clarified commit logs and improved comments in patches 1,3,7 per discussions with Daniel

Old v1 cover:

this set of patches adds implementation of HASH and ARRAY types of eBPF maps which were described in manpage in commit b4fc1a460f30("Merge branch 'bpf-next'")

The difference vs previous version of these patches from August:
- added 'flags' attribute to BPF_MAP_UPDATE_ELEM
- in HASH type implementation removed per-map kmem_cache.
I was doing kmem_cache_create() for every map to enable selective slub debugging to check for overflows and leaks. Now it's not needed, so just use normal kmalloc() for map elements.
- added ARRAY type which was mentioned in manpage, but wasn't public yet
- added map testsuite and removed temporary bits from test_stubs

Note, eBPF programs cannot be attached to events yet. It will come in the next set.

Alexei Starovoitov (7):
bpf: add 'flags' attribute to BPF_MAP_UPDATE_ELEM command
bpf: add hashtable type of eBPF maps
bpf: add array type of eBPF maps
bpf: fix BPF_MAP_LOOKUP_ELEM command return code
bpf: add a testsuite for eBPF maps
bpf: allow eBPF programs to use maps
bpf: remove test map scaffolding and user proper types

 include/linux/bpf.h         |    7 +-
 include/uapi/linux/bpf.h    |   13 +-
 kernel/bpf/Makefile         |    2 +-
 kernel/bpf/arraymap.c       |  151 ++++++++++++++++++
 kernel/bpf/hashtab.c        |  362 +++++++++++++++++++++++++++++++++++++++++++
 kernel/bpf/helpers.c        |   89 +++++++++++
 kernel/bpf/syscall.c        |    6 +-
 kernel/bpf/test_stub.c      |   56 ++-----
 samples/bpf/Makefile        |    3 +-
 samples/bpf/libbpf.c        |    3 +-
 samples/bpf/libbpf.h        |    2 +-
 samples/bpf/test_maps.c     |  291 ++++++++++++++++++++++++++++++++++
 samples/bpf/test_verifier.c |   14 +-
 13 files changed, 936 insertions(+), 63 deletions(-)
 create mode 100644 kernel/bpf/arraymap.c
 create mode 100644 kernel/bpf/hashtab.c
 create mode 100644 kernel/bpf/helpers.c
 create mode 100644 samples/bpf/test_maps.c
Signature · 1 line
1.7.9.5