[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1302af8c-f1b7-4015-8655-c7fdaff63d69@roeck-us.net>
Date: Mon, 12 Feb 2024 10:26:44 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Charlie Jenkins <charlie@...osinc.com>
Cc: Al Viro <viro@...iv.linux.org.uk>, David Laight
<David.Laight@...lab.com>, Palmer Dabbelt <palmer@...belt.com>,
Andrew Morton <akpm@...ux-foundation.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 2/2] lib: checksum: Use aligned accesses for
ip_fast_csum and csum_ipv6_magic tests
On 2/12/24 10:09, Charlie Jenkins wrote:
[ ... ]
>> Almost. Turns out the csum parameter of csum_ipv6_magic() needs to be in
>> network byte order, and the length parameter needs to be in host byte order.
>> So instead of
>> data.len = data_ptr->len;
>> data.csum = (__force __wsum)htonl((__force u32)data_ptr->csum);
>> it needs to be something like
>> data.len = ntohl(data_ptr->len);
>> data.csum = data_ptr->csum;
>>
>> Also, as you mentioned, either the returned checksum or the expected
>> checksum needs to be converted for the comparison because one is in
>> network byte order and the other in host byte order.
>>
>> Address conversions are indeed not needed.
>>
>> Thanks,
>> Guenter
>
> Aww that makes sense thank you. I was reversing everything except len
> and the solution was to only reverse len... Thank you for figuring that
> out for me.
>
> I will send out another version with your change. Should I add a
> signed-off-by with your tag for this patch?
>
No need. I'll send you a Tested-by: tag on the final version (if it works ;-).
Thanks,
Guenter
Powered by blists - more mailing lists