Hi Charlie, Thanks for your patch! On Fri, Feb 23, 2024 at 11:12 PM Charlie Jenkins <charlie@xxxxxxxxxxxx> wrote: > The test cases for ip_fast_csum and csum_ipv6_magic were not properly > aligning the IP header, which were causing failures on architectures > that do not support misaligned accesses like some ARM platforms. To > solve this, align the data along (14 + NET_IP_ALIGN) bytes which is the > standard alignment of an IP header and must be supported by the > architecture. > > Furthermore, all architectures except the m68k pad "struct > csum_ipv6_magic_data" to 44 bits. To make compatible with the m68k, > manually pad this structure to 44 bits. s/bits/bytes/ everywhere > > Fixes: 6f4c45cbcb00 ("kunit: Add tests for csum_ipv6_magic and ip_fast_csum") > Signed-off-by: Charlie Jenkins <charlie@xxxxxxxxxxxx> > Reviewed-by: Guenter Roeck <linux@xxxxxxxxxxxx> > Acked-by: Palmer Dabbelt <palmer@xxxxxxxxxxxx> > --- > The ip_fast_csum and csum_ipv6_magic tests did not work on all > architectures due to differences in misaligned access support. > Fix those issues by changing endianness of data and aligning the data. > > This patch relies upon a patch from Christophe: > > [PATCH net] kunit: Fix again checksum tests on big endian CPUs > > https://lore.kernel.org/lkml/73df3a9e95c2179119398ad1b4c84cdacbd8dfb6.1708684443.git.christophe.leroy@xxxxxxxxxx/t/ > --- > Changes in v10: > - Christophe Leroy graciously decided to re-write my patch to fit his > style so I have dropped my endianness+sparse changes and have based by > alignment fixes on his patch. The link to his patch can be seen above. > - I dropped Guenter's tested-by but kept his reviewed-by since only the base > was changed. > - Link to v9: https://lore.kernel.org/r/20240221-fix_sparse_errors_checksum_tests-v9-0-bff4d73ab9d1@xxxxxxxxxxxx > --- a/lib/checksum_kunit.c > +++ b/lib/checksum_kunit.c > @@ -595,28 +473,31 @@ static void test_ip_fast_csum(struct kunit *test) > static void test_csum_ipv6_magic(struct kunit *test) > { > #if defined(CONFIG_NET) > - const struct in6_addr *saddr; > - const struct in6_addr *daddr; > + struct csum_ipv6_magic_data { > + const struct in6_addr saddr; > + const struct in6_addr daddr; > + __le32 len; > + __wsum csum; > + unsigned char proto; > + unsigned char pad[3]; > + } *data; If having a size of 44 bytes is critical, you really want to add a BUILD_BUG_ON() check for that. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds