Re: [PATCH v2 0/2] lib: checksum: Fix issues with checksum tests

From: Guenter Roeck
Date: Tue Jan 23 2024 - 18:22:41 EST


On 1/23/24 13:58, Charlie Jenkins wrote:
The ip_fast_csum and csum_ipv6_magic tests did not have the data
types properly casted, and improperly misaligned data.

Signed-off-by: Charlie Jenkins <charlie@xxxxxxxxxxxx>
---
Changes in v2:
- Add additional patch to fix alignment issues
- Link to v1: https://lore.kernel.org/r/20240119-fix_sparse_errors_checksum_tests-v1-1-2d3df86d8d78@xxxxxxxxxxxx


I applied both patches but see the following.

KTAP version 1
# Subtest: checksum
# module: checksum_kunit
1..5
ok 1 test_csum_fixed_random_inputs
ok 2 test_csum_all_carry_inputs
ok 3 test_csum_no_carry_inputs
# test_ip_fast_csum: ASSERTION FAILED at lib/checksum_kunit.c:541
Expected ( u64)csum_result == ( u64)expected, but
( u64)csum_result == 27015 (0x6987)
( u64)expected == 55912 (0xda68)
not ok 4 test_ip_fast_csum
# test_csum_ipv6_magic: ASSERTION FAILED at lib/checksum_kunit.c:564
Expected ( u64)csum_result == ( u64)expected, but
( u64)csum_result == 42151 (0xa4a7)
( u64)expected == 5513 (0x1589)
not ok 5 test_csum_ipv6_magic
# checksum: pass:3 fail:2 skip:0 total:5
# Totals: pass:3 fail:2 skip:0 total:5
not ok 17 checksum

Old result, before applying the patches (v6.8-rc1):

KTAP version 1
# Subtest: checksum
# module: checksum_kunit
1..5
ok 1 test_csum_fixed_random_inputs
ok 2 test_csum_all_carry_inputs
ok 3 test_csum_no_carry_inputs
ok 4 test_ip_fast_csum
ok 5 test_csum_ipv6_magic
# checksum: pass:5 fail:0 skip:0 total:5
# Totals: pass:5 fail:0 skip:0 total:5
ok 17 checksum

This is with the imx25-pdk emulation in qemu.

Guenter