On Thu, Feb 20, 2025 at 4:56 PM Eduard Zingerman <eddyz87@xxxxxxxxx> wrote: > > On Thu, 2025-02-20 at 16:52 -0800, Andrii Nakryiko wrote: > > On Tue, Feb 18, 2025 at 11:01 AM Mykyta Yatsenko > > <mykyta.yatsenko5@xxxxxxxxx> wrote: > > > > > > From: Mykyta Yatsenko <yatsenko@xxxxxxxx> > > > > > > Add XDP setup type for dynptr tests, enabling testing for > > > non-contiguous buffer. > > > Add 2 tests: > > > - test_dynptr_copy - verify correctness for the fast (contiguous > > > buffer) code path. > > > - test_dynptr_copy_xdp - verifies code paths that handle > > > non-contiguous buffer. > > > > > > Signed-off-by: Mykyta Yatsenko <yatsenko@xxxxxxxx> > > > --- > > > tools/testing/selftests/bpf/bpf_kfuncs.h | 8 ++ > > > .../testing/selftests/bpf/prog_tests/dynptr.c | 25 ++++++ > > > .../selftests/bpf/progs/dynptr_success.c | 77 +++++++++++++++++++ > > > 3 files changed, 110 insertions(+) > > > > > > diff --git a/tools/testing/selftests/bpf/bpf_kfuncs.h b/tools/testing/selftests/bpf/bpf_kfuncs.h > > > index 8215c9b3115e..e9c193036c82 100644 > > > --- a/tools/testing/selftests/bpf/bpf_kfuncs.h > > > +++ b/tools/testing/selftests/bpf/bpf_kfuncs.h > > > @@ -43,6 +43,14 @@ extern bool bpf_dynptr_is_rdonly(const struct bpf_dynptr *ptr) __ksym __weak; > > > extern __u32 bpf_dynptr_size(const struct bpf_dynptr *ptr) __ksym __weak; > > > extern int bpf_dynptr_clone(const struct bpf_dynptr *ptr, struct bpf_dynptr *clone__init) __ksym __weak; > > > > > > +/* Description > > > + * Copy data from one dynptr to another > > > + * Returns > > > + * Error code > > > + */ > > > +extern int bpf_dynptr_copy(struct bpf_dynptr *dst, __u32 dst_off, > > > + struct bpf_dynptr *src, __u32 src_off, __u32 size) __ksym __weak; > > > + > > > > Do we *need* this? Doesn't all this come from vmlinux.h nowadays? > > It does come from vmlinux.h, but this test does not include vmlinux.h > (and compiles a bit faster because of that). let's switch to vmlinux.h then instead of manually adding kfunc declarations? > > [...] >