On 2/27/24 12:14, Helge Deller wrote:
On 2/27/24 19:53, Guenter Roeck wrote:
IPv6 checksum tests with unaligned addresses resulted in unexpected
failures.
Expected expected == csum_result, but
expected == 46591 (0xb5ff)
csum_result == 46381 (0xb52d)
with alignment offset 1
Oddly enough, the problem disappeared after adding test code into
the beginning of csum_ipv6_magic().
As it turns out, the 'sum' parameter of csum_ipv6_magic() is declared as
__wsum, which is a 32-bit variable type. However, it is treated as 64-bit
variable in the assembler code.
Nice catch!
That kind of bugs is actually the reason why I start to prefer
C-code over inline assembly, even if C might perform slower.
I've applied that patch to the parisc git tree, but do you think
you can come up with a better patch title, e.g.
"strip upper 32bits of sum in csum_ipv6_magic()" ?
Sure. My initial fix was way more complicated, and I didn't update
the description after I figured out what was actually going on and
found the simpler fix. I'll resend.
Thanks,
Guenter