From: "Galazka, Krzysztof" <krzysztof.galazka@intel.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org,
Przemek Kitszel <przemyslaw.kitszel@intel.com>
Subject: Re: [Intel-wired-lan] [PATCH iwl-net] selftests/net: Fix csum test for short packets
Date: Tue, 27 Aug 2024 19:54:37 +0200 [thread overview]
Message-ID: <0c0f51d5-8ff1-44f5-8607-cee88479aa62@intel.com> (raw)
In-Reply-To: <66c5fa663e274_dc0c22942f@willemb.c.googlers.com.notmuch>
On 2024-08-21 16:32, Willem de Bruijn wrote:
> Krzysztof Galazka wrote:
>> For IPv4 and IPv6 packets shorter than minimum Ethernet
>> frame payload, recvmsg returns lenght including padding.
>
> nit: length
>
>> Use length from header for checksum verification to avoid
>> csum test failing on correct packets.
>>
>> Fixes: 1d0dc857b5d8 (selftests: drv-net: add checksum tests)
>> Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
>> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
>
> This is not Intel driver specific, so can be sent straight to net
>
>> ---
>> tools/testing/selftests/net/lib/csum.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/tools/testing/selftests/net/lib/csum.c b/tools/testing/selftests/net/lib/csum.c
>> index b9f3fc3c3426..3dbaf2ecd59e 100644
>> --- a/tools/testing/selftests/net/lib/csum.c
>> +++ b/tools/testing/selftests/net/lib/csum.c
>> @@ -658,6 +658,9 @@ static int recv_verify_packet_ipv4(void *nh, int len)
>> if (len < sizeof(*iph) || iph->protocol != proto)
>> return -1;
>>
>> + /* For short packets recvmsg returns length with padding, fix that */
>> + len = ntohs(iph->tot_len);
>> +
>
> Are you running into this while running the standard testsuite in
> csum.py, or a specific custom invocation?
It was with standard testsuite in csum.py. Not on every run but quite often.
>
> Since the checksum is an L3 feature, trusting the L3 length field for
> this makes sense (as long as the packet wasn't truncated).
Ah, I haven't thought about truncated packets. I'll add condition to
update length returned by recvmsg only if it's greater then expected.
Thanks,
Krzysiek
next prev parent reply other threads:[~2024-08-27 17:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-21 14:24 [Intel-wired-lan] [PATCH iwl-net] selftests/net: Fix csum test for short packets Krzysztof Galazka
2024-08-21 14:32 ` Willem de Bruijn
2024-08-27 17:54 ` Galazka, Krzysztof [this message]
2024-08-21 17:43 ` Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0c0f51d5-8ff1-44f5-8607-cee88479aa62@intel.com \
--to=krzysztof.galazka@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=netdev@vger.kernel.org \
--cc=przemyslaw.kitszel@intel.com \
--cc=willemdebruijn.kernel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox