From: "Alexis Lothoré" <alexis.lothore@bootlin.com>
To: Stanislav Fomichev <stfomichev@gmail.com>
Cc: Andrii Nakryiko <andrii@kernel.org>,
Eduard Zingerman <eddyz87@gmail.com>,
Mykola Lysenko <mykolal@fb.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>, Shuah Khan <shuah@kernel.org>,
ebpf@linuxfoundation.org,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Bastien Curutchet <bastien.curutchet@bootlin.com>,
Petar Penkov <ppenkov@google.com>,
bpf@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next 09/10] selftests/bpf: migrate bpf flow dissectors tests to test_progs
Date: Thu, 14 Nov 2024 09:04:27 +0100 [thread overview]
Message-ID: <81dececf-b646-4ed3-bfa8-e32c0e1d69db@bootlin.com> (raw)
In-Reply-To: <ZzToxolRWf2uieWP@mini-arch>
On 11/13/24 18:58, Stanislav Fomichev wrote:
> On 11/13, Alexis Lothoré (eBPF Foundation) wrote:
>> test_flow_dissector.sh loads flow_dissector program and subprograms,
>> creates and configured relevant tunnels and interfaces, and ensure that
>> the bpf dissection is actually performed correctly. Similar tests exist
>> in test_progs (thanks to flow_dissector.c) and run the same programs,
>> but those are only executed with BPF_PROG_RUN: those tests are then
>> missing some coverage (eg: coverage for flow keys manipulated when the
>> configured flower uses a port range, which has a dedicated test in
>> test_flow_dissector.sh)
>>
>> Convert test_flow_dissector.sh into test_progs so that the corresponding
>> tests are also run in CI.
>>
>> Signed-off-by: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
>> ---
[...]
>> +static uint16_t build_udp_v6_csum(const struct ipv6hdr *ip6h,
>> + const struct udphdr *udph, int num_words)
>> +{
>> + unsigned long pseudo_sum;
>> + int num_u16 = sizeof(ip6h->saddr); /* halfwords: twice byte len */
>> +
>> + pseudo_sum = add_csum_hword((void *)&ip6h->saddr, num_u16);
>> + pseudo_sum += htons(ip6h->nexthdr);
>> + pseudo_sum += ip6h->payload_len;
>> + return build_ip_csum((void *)udph, num_words, pseudo_sum);
>> +}
>
> I remember adding a bunch of similar code to tools/testing/selftests/bpf/prog_tests/xdp_metadata.c
> and tools/testing/selftests/bpf/network_helpers.h. The csum handling in
> particular (csum_tcpudp_magic/etc for pseudo headers).
> Can you see if something can be reused? Maybe something we
> can move into network_helpers.h? For example build_ip_csum/ip_csum.
Ah, indeed, thanks for the pointer. I can definitely take a look and make sure
that those helpers are shared.
Thanks,
Alexis
--
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2024-11-14 8:04 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-13 13:53 [PATCH bpf-next 00/10] selftests/bpf: migrate test_flow_dissector.sh to test_progs Alexis Lothoré (eBPF Foundation)
2024-11-13 13:53 ` [PATCH bpf-next 01/10] selftests/bpf: add a macro to compare raw memory Alexis Lothoré (eBPF Foundation)
2024-11-13 17:31 ` Stanislav Fomichev
2024-11-13 13:53 ` [PATCH bpf-next 02/10] selftests/bpf: use ASSERT_MEMEQ to compare bpf flow keys Alexis Lothoré (eBPF Foundation)
2024-11-13 17:32 ` Stanislav Fomichev
2024-11-13 13:53 ` [PATCH bpf-next 03/10] selftests/bpf: replace CHECK calls with ASSERT macros in flow_dissector test Alexis Lothoré (eBPF Foundation)
2024-11-13 17:34 ` Stanislav Fomichev
2024-11-13 13:53 ` [PATCH bpf-next 04/10] selftests/bpf: re-split main function into dedicated tests Alexis Lothoré (eBPF Foundation)
2024-11-13 17:42 ` Stanislav Fomichev
2024-11-14 7:57 ` Alexis Lothoré
2024-11-13 13:53 ` [PATCH bpf-next 05/10] selftests/bpf: expose all subtests from flow_dissector Alexis Lothoré (eBPF Foundation)
2024-11-13 17:43 ` Stanislav Fomichev
2024-11-13 13:53 ` [PATCH bpf-next 06/10] selftests/bpf: add gre packets testing to flow_dissector Alexis Lothoré (eBPF Foundation)
2024-11-13 17:46 ` Stanislav Fomichev
2024-11-13 13:53 ` [PATCH bpf-next 07/10] selftests/bpf: migrate flow_dissector namespace exclusivity test Alexis Lothoré (eBPF Foundation)
2024-11-13 14:23 ` Alexis Lothoré
2024-11-13 17:50 ` Stanislav Fomichev
2024-11-14 7:58 ` Alexis Lothoré
2024-11-13 13:53 ` [PATCH bpf-next 08/10] selftests/bpf: Enable generic tc actions in selftests config Alexis Lothoré (eBPF Foundation)
2024-11-13 17:51 ` Stanislav Fomichev
2024-11-13 13:53 ` [PATCH bpf-next 09/10] selftests/bpf: migrate bpf flow dissectors tests to test_progs Alexis Lothoré (eBPF Foundation)
2024-11-13 17:58 ` Stanislav Fomichev
2024-11-14 8:04 ` Alexis Lothoré [this message]
2024-11-13 13:53 ` [PATCH bpf-next 10/10] selftests/bpf: remove test_flow_dissector.sh Alexis Lothoré (eBPF Foundation)
2024-11-13 17:59 ` Stanislav Fomichev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=81dececf-b646-4ed3-bfa8-e32c0e1d69db@bootlin.com \
--to=alexis.lothore@bootlin.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bastien.curutchet@bootlin.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=ebpf@linuxfoundation.org \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=mykolal@fb.com \
--cc=ppenkov@google.com \
--cc=sdf@fomichev.me \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=stfomichev@gmail.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox