lib/checksum_kunit.c | 460 +++++++++++++++++++++++---------------------------- 1 file changed, 203 insertions(+), 257 deletions(-)
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@rivosinc.com>
---
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@rivosinc.com
---
Charlie Jenkins (2):
lib: checksum: Fix type casting in checksum kunits
lib: checksum: Use aligned accesses for ip_fast_csum and csum_ipv6_magic tests
lib/checksum_kunit.c | 460 +++++++++++++++++++++++----------------------------
1 file changed, 203 insertions(+), 257 deletions(-)
---
base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d
change-id: 20240119-fix_sparse_errors_checksum_tests-26b86b34d784
--
- Charlie
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@rivosinc.com>
> ---
> 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@rivosinc.com
>
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
On Tue, Jan 23, 2024 at 03:22:30PM -0800, Guenter Roeck wrote: > 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@rivosinc.com> > > --- > > 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@rivosinc.com > > > > 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 Apologies for that, some garbage values snuck in. I'll send a new version. - Charlie >
© 2016 - 2025 Red Hat, Inc.