[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <81dececf-b646-4ed3-bfa8-e32c0e1d69db@bootlin.com>
Date: Thu, 14 Nov 2024 09:04:27 +0100
From: Alexis Lothoré <alexis.lothore@...tlin.com>
To: Stanislav Fomichev <stfomichev@...il.com>
Cc: Andrii Nakryiko <andrii@...nel.org>, Eduard Zingerman
<eddyz87@...il.com>, Mykola Lysenko <mykolal@...com>,
Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <martin.lau@...ux.dev>, Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>,
John Fastabend <john.fastabend@...il.com>, KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>,
Jiri Olsa <jolsa@...nel.org>, Shuah Khan <shuah@...nel.org>,
ebpf@...uxfoundation.org, Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Bastien Curutchet <bastien.curutchet@...tlin.com>,
Petar Penkov <ppenkov@...gle.com>, bpf@...r.kernel.org,
linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH bpf-next 09/10] selftests/bpf: migrate bpf flow dissectors
tests to test_progs
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@...tlin.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
Powered by blists - more mailing lists