[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250516184849.27d795c1@kernel.org>
Date: Fri, 16 May 2025 18:48:49 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Oleksij Rempel <o.rempel@...gutronix.de>
Cc: "David S. Miller" <davem@...emloft.net>, Eric Dumazet
<edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Simon Horman
<horms@...nel.org>, kernel@...gutronix.de, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, Maxime Chevallier <maxime.chevallier@...tlin.com>
Subject: Re: [PATCH net-next v4 3/4] net: selftests: add checksum mode
support and SW checksum handling
On Thu, 15 May 2025 10:30:59 +0200 Oleksij Rempel wrote:
> +enum net_test_checksum_mode {
> + NET_TEST_CHECKSUM_COMPLETE,
Why COMPLETE? that means skb has checksum of the complete data.
If packet requires no checksumming you should probably use CHECKSUM_NONE
> + switch (iph->protocol) {
> + case IPPROTO_TCP:
> + if (!pskb_may_pull(skb,
> + transport_offset + sizeof(struct tcphdr)))
Why are you so diligently checking if you can pull for the SW sum but
not for the HW sum? Both of them update the same header fields :)
> +static int net_test_setup_hw_csum(struct sk_buff *skb, struct iphdr *iph)
> +{
> + u16 csum_offset;
> +
> + skb->ip_summed = CHECKSUM_PARTIAL;
> + skb->csum = 0;
> +
> + switch (iph->protocol) {
> + case IPPROTO_TCP:
> + if (!tcp_hdr(skb))
> + return -EINVAL;
> + tcp_hdr(skb)->check = 0;
this filed should be filled with pseudo header checksum for HW offload,
not with 0, like the existing code did
--
pw-bot: cr
Powered by blists - more mailing lists