lkml.org 
[lkml]   [2024]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v6 2/2] lib: checksum: Use aligned accesses for ip_fast_csum and csum_ipv6_magic tests
From
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


\
 
 \ /
  Last update: 2024-05-27 14:59    [W:0.070 / U:0.524 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site