bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/5] introduce dummy BPF STRUCT_OPS
@ 2021-09-28  2:52 Hou Tao
  2021-09-28  2:52 ` [PATCH bpf-next 1/5] bpf: add dummy BPF STRUCT_OPS for test purpose Hou Tao
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Hou Tao @ 2021-09-28  2:52 UTC (permalink / raw)
  To: Martin KaFai Lau, Alexei Starovoitov
  Cc: Daniel Borkmann, Andrii Nakryiko, netdev, bpf, houtao1

Hi,

Currently the test of BPF STRUCT_OPS depends on the specific bpf
implementation (e.g, tcp_congestion_ops), but it can not cover all
basic functionalities (e.g, return value handling), so introduce
a dummy BPF STRUCT_OPS for test purpose.

Instead of loading a userspace-implemeted bpf_dummy_ops map into
kernel and calling the specific function by writing to sysfs provided
by bpf_testmode.ko, only loading bpf_dummy_ops related prog into
kernel and calling these prog by bpf_prog_test_run(). The latter
is more flexible and has no dependency on extra kernel module.

Now only the return value handling related test cases are supported,
if more is needed, we can add afterwards.

Comments are always welcome.
Regards,
Hou

Changelog:
* RFC: https://www.spinics.net/lists/bpf/msg46117.html


Hou Tao (5):
  bpf: add dummy BPF STRUCT_OPS for test purpose
  bpf: factor out a helper to prepare trampoline for struct_ops prog
  bpf: do .test_run in dummy BPF STRUCT_OPS
  bpf: hook .test_run for struct_ops program
  selftests/bpf: test return value handling for struct_ops prog

 include/linux/bpf.h                           |   5 +
 include/linux/bpf_dummy_ops.h                 |  25 ++
 kernel/bpf/bpf_struct_ops.c                   |  43 +++-
 kernel/bpf/bpf_struct_ops_types.h             |   2 +
 net/bpf/Makefile                              |   3 +
 net/bpf/bpf_dummy_struct_ops.c                | 220 ++++++++++++++++++
 .../selftests/bpf/prog_tests/dummy_st_ops.c   |  81 +++++++
 .../selftests/bpf/progs/dummy_st_ops.c        |  33 +++
 8 files changed, 403 insertions(+), 9 deletions(-)
 create mode 100644 include/linux/bpf_dummy_ops.h
 create mode 100644 net/bpf/bpf_dummy_struct_ops.c
 create mode 100644 tools/testing/selftests/bpf/prog_tests/dummy_st_ops.c
 create mode 100644 tools/testing/selftests/bpf/progs/dummy_st_ops.c

-- 
2.29.2


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

end of thread, other threads:[~2021-10-01 19:09 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-28  2:52 [PATCH bpf-next 0/5] introduce dummy BPF STRUCT_OPS Hou Tao
2021-09-28  2:52 ` [PATCH bpf-next 1/5] bpf: add dummy BPF STRUCT_OPS for test purpose Hou Tao
2021-09-28  2:52 ` [PATCH bpf-next 2/5] bpf: factor out a helper to prepare trampoline for struct_ops prog Hou Tao
2021-09-29 17:56   ` Martin KaFai Lau
2021-09-30 10:17     ` Hou Tao
2021-10-01 17:39       ` Martin KaFai Lau
2021-09-28  2:52 ` [PATCH bpf-next 3/5] bpf: do .test_run in dummy BPF STRUCT_OPS Hou Tao
2021-09-29 18:55   ` Martin KaFai Lau
2021-09-30 11:05     ` Hou Tao
2021-10-01 19:09       ` Martin KaFai Lau
2021-09-28  2:52 ` [PATCH bpf-next 4/5] bpf: hook .test_run for struct_ops program Hou Tao
2021-09-28  2:52 ` [PATCH bpf-next 5/5] selftests/bpf: test return value handling for struct_ops prog Hou Tao
2021-09-28 23:19   ` Andrii Nakryiko
2021-09-30 11:08     ` Hou Tao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).