Re: [PATCH bpf-next 09/10] selftests/bpf: migrate bpf flow dissectors tests to test_progs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
>> ---

[...]

>> +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




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux