On Fri, Feb 21, 2025 at 4:08 AM Mykyta Yatsenko <mykyta.yatsenko5@xxxxxxxxx> wrote: > > On 21/02/2025 00:52, 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(+) > >> [...] > > > > BTW, more questions to networking folks (maybe Martin knows). Is there > > a way to setup SKB or XDP packet with a non-linear region for testing? > The setup I made in dynptr.c for XDP makes non-linear region. > It looks like maximum linear mem size is 4k, so when going above that, > it creates multiple frags in xdp_buff: > > ``` > > char data[5000]; > ... > .data_in = &data, > > ``` > > I verified that in this test xdp_buff is non-linear, and all non-fast > code paths of > the bpf_dynptr_copy are tested. Ah, awesome, great job! > > > > >> + > >> + return XDP_DROP; > >> +} > >> -- > >> 2.48.1 > >> > Thanks for findings, fixing them in v2.