All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH bpf-next v3 0/7] Implement bpf queue/stack maps
@ 2018-09-18  4:52 Mauricio Vasquez B
  2018-09-18  4:52 ` [RFC PATCH bpf-next v3 1/7] bpf: rename stack trace map Mauricio Vasquez B
                   ` (6 more replies)
  0 siblings, 7 replies; 17+ messages in thread
From: Mauricio Vasquez B @ 2018-09-18  4:52 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, netdev; +Cc: Yonghong Song

In some applications this is needed have a pool of free elements, like for
example the list of free L4 ports in a SNAT.  None of the current maps allow
to do it as it is not possibleto get an any element without having they key
it is associated to.

This patchset implements two new kind of eBPF maps: queue and stack.
Those maps provide to eBPF programs the peek, push and pop operations, and for
userspace applications a new bpf_map_lookup_and_delete_elem() is added.

Signed-off-by: Mauricio Vasquez B <mauricio.vasquez@polito.it>

v2 -> v3:
 - Return elements by value instead that by reference
 - Implement queue/stack base on array and head + tail indexes
 - Rename stack trace related files to avoid confusion and conflicts

v1 -> v2:
 - Create two separate maps instead of single one + flags
 - Implement bpf_map_lookup_and_delete syscall
 - Support peek operation
 - Define replacement policy through flags in the update() method
 - Add eBPF side tests

---

Mauricio Vasquez B (7):
      bpf: rename stack trace map
      bpf/syscall: allow key to be null in map functions
      bpf: add lookup_and_delete map operation
      bpf: add bpf queue and stack maps
      bpf: restrict use of peek/push/pop
      Sync uapi/bpf.h to tools/include
      selftests/bpf: add test cases for queue and stack maps


 include/linux/bpf.h                                |    4 
 include/linux/bpf_types.h                          |    4 
 include/uapi/linux/bpf.h                           |   31 +
 kernel/bpf/Makefile                                |    4 
 kernel/bpf/core.c                                  |    3 
 kernel/bpf/helpers.c                               |   98 +++
 kernel/bpf/queue_stack_maps.c                      |  291 +++++++++
 kernel/bpf/stackmap.c                              |  624 --------------------
 kernel/bpf/stacktracemap.c                         |  624 ++++++++++++++++++++
 kernel/bpf/syscall.c                               |  101 +++
 kernel/bpf/verifier.c                              |   19 +
 net/core/filter.c                                  |    6 
 tools/include/uapi/linux/bpf.h                     |   31 +
 tools/lib/bpf/bpf.c                                |   12 
 tools/lib/bpf/bpf.h                                |    1 
 tools/testing/selftests/bpf/Makefile               |    5 
 tools/testing/selftests/bpf/bpf_helpers.h          |    7 
 tools/testing/selftests/bpf/test_maps.c            |  130 ++++
 tools/testing/selftests/bpf/test_progs.c           |   99 +++
 tools/testing/selftests/bpf/test_queue_map.c       |    4 
 tools/testing/selftests/bpf/test_queue_stack_map.h |   59 ++
 tools/testing/selftests/bpf/test_stack_map.c       |    4 
 22 files changed, 1526 insertions(+), 635 deletions(-)
 create mode 100644 kernel/bpf/queue_stack_maps.c
 delete mode 100644 kernel/bpf/stackmap.c
 create mode 100644 kernel/bpf/stacktracemap.c
 create mode 100644 tools/testing/selftests/bpf/test_queue_map.c
 create mode 100644 tools/testing/selftests/bpf/test_queue_stack_map.h
 create mode 100644 tools/testing/selftests/bpf/test_stack_map.c

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2018-10-04  4:01 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-18  4:52 [RFC PATCH bpf-next v3 0/7] Implement bpf queue/stack maps Mauricio Vasquez B
2018-09-18  4:52 ` [RFC PATCH bpf-next v3 1/7] bpf: rename stack trace map Mauricio Vasquez B
2018-09-18 23:05   ` Alexei Starovoitov
2018-09-19  2:53     ` Mauricio Vasquez
2018-09-18  4:52 ` [RFC PATCH bpf-next v3 2/7] bpf/syscall: allow key to be null in map functions Mauricio Vasquez B
2018-09-18  4:52 ` [RFC PATCH bpf-next v3 3/7] bpf: add lookup_and_delete map operation Mauricio Vasquez B
2018-09-18  4:52 ` [RFC PATCH bpf-next v3 4/7] bpf: add bpf queue and stack maps Mauricio Vasquez B
2018-09-18 23:27   ` Alexei Starovoitov
2018-09-19  4:28     ` Mauricio Vasquez
     [not found]       ` <12a0d7d2-9590-b44f-803a-a00eefe611c1@polito.it>
2018-10-02  0:26         ` Alexei Starovoitov
2018-10-03 17:01           ` Mauricio Vasquez
2018-10-03 21:10             ` Alexei Starovoitov
2018-09-18  4:52 ` [RFC PATCH bpf-next v3 5/7] bpf: restrict use of peek/push/pop Mauricio Vasquez B
2018-09-18  4:53 ` [RFC PATCH bpf-next v3 6/7] Sync uapi/bpf.h to tools/include Mauricio Vasquez B
2018-09-18  4:53 ` [RFC PATCH bpf-next v3 7/7] selftests/bpf: add test cases for queue and stack maps Mauricio Vasquez B
2018-09-18 23:32   ` Alexei Starovoitov
2018-09-19  4:36     ` Mauricio Vasquez

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.