From: "Daniel Zahka" <daniel.zahka@gmail.com>
To: "Todd Freed" <toddfreed@meta.com>, <netdev@vger.kernel.org>
Cc: "Boris Pismenny" <borisp@nvidia.com>,
"Saeed Mahameed" <saeedm@nvidia.com>,
"Leon Romanovsky" <leon@kernel.org>,
"Tariq Toukan" <tariqt@nvidia.com>,
"Mark Bloch" <mbloch@nvidia.com>,
"Andrew Lunn" <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@kernel.org>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Daniel Zahka" <daniel.zahka@gmail.com>,
"Willem de Bruijn" <willemdebruijn.kernel@gmail.com>,
"Simon Horman" <horms@kernel.org>,
"Shuah Khan" <shuah@kernel.org>,
"Cosmin Ratiu" <cratiu@nvidia.com>,
"Raed Salem" <raeds@nvidia.com>,
"Rahul Rameshbabu" <rrameshbabu@nvidia.com>,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, "Björn Töpel" <bjorn@kernel.org>,
"Dragos Tatulea" <dtatulea@nvidia.com>
Subject: Re: [PATCH net v3 1/4] net/mlx5e: psp: tso: replace only the length in checksum seed
Date: Tue, 27 Oct 2026 11:16:50 -0400 [thread overview]
Message-ID: <DMFPXSDO64VR.2AYG2NTUEYFRF@gmail.com> (raw)
In-Reply-To: <20261023234640.1459291-2-toddfreed@meta.com>
On Fri Oct 23, 2026 at 7:46 PM EDT, Todd Freed wrote:
> for psp tcp with tso,
>
> - __tcp_transmit_skb() -> tcp_v6_send_check() or tcp_v4_send_check()
> computes the checksum seed using the addresses on the socket and the
> total length, then
>
> - mlx5e_psp_handle_tx_skb() recomputes the checksum seed using
> addresses from the packet's l3 header, and the length of one segment
>
> the length difference is expected by the device. however, the
> difference in addresses is incorrect in cases where the l3 header daddr
> is an intermediate hop (e.g. IPV6_RTHDR). this causes every segment of
> the tso packet to go out with a bad tcp checksum, in this case.
>
> the fix is to replace only the length in the seed which tcp had already
> computed. this is also what tcp_gso_segment() does.
>
> tested on connectx-7 with the rest of this series applied, with a psp
> tcp socket whose segment routing header's first hop isn't the final
> destination, and the peer checking tcp checksums in software.
>
> Fixes: e5a1861a298e ("net/mlx5e: Implement PSP Tx data path")
> Signed-off-by: Todd Freed <toddfreed@meta.com>
> ---
> .../mellanox/mlx5/core/en_accel/psp_rxtx.c | 21 ++++++++-----------
> 1 file changed, 9 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp_rxtx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp_rxtx.c
> index 348fd7a96261..d9c2742b3c24 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp_rxtx.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/psp_rxtx.c
> @@ -177,18 +177,15 @@ bool mlx5e_psp_handle_tx_skb(struct net_device *netdev,
> return false;
> }
> if (skb_is_gso(skb)) {
> - int len = skb_shinfo(skb)->gso_size + inner_tcp_hdrlen(skb);
> - struct tcphdr *th = inner_tcp_hdr(skb);
> -
> - if (skb->protocol == htons(ETH_P_IP)) {
> - const struct iphdr *ip = ip_hdr(skb);
> -
> - th->check = ~tcp_v4_check(len, ip->saddr, ip->daddr, 0);
> - } else {
> - const struct ipv6hdr *ip6 = ipv6_hdr(skb);
> -
> - th->check = ~tcp_v6_check(len, &ip6->saddr, &ip6->daddr, 0);
> - }
> + u32 seg_len = skb_shinfo(skb)->gso_size + inner_tcp_hdrlen(skb);
> + u32 len = skb->len - skb_inner_transport_offset(skb);
> +
> + /* update just the length component of the checksum seed
> + * tcp computed the seed with the total length, but mlx5
> + * devices are expecting the segment length
> + */
> + inet_proto_csum_replace4(&inner_tcp_hdr(skb)->check, skb,
> + htonl(len), htonl(seg_len), true);
> }
>
> return true;
Thanks. Makes sense to me. The bot has a mega nit about the commit
message that may be worth addressing next version, but otherwise:
Acked-by: Daniel Zahka <daniel.zahka@gmail.com>
next prev parent reply other threads:[~2026-10-27 15:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 23:46 [PATCH net v3 0/4] psp: fix transport mode with ipv6 extension headers Todd Freed
2026-10-23 23:46 ` [PATCH net v3 1/4] net/mlx5e: psp: tso: replace only the length in checksum seed Todd Freed
2026-10-24 23:48 ` netdev-bot+sashiko
2026-10-27 15:16 ` Daniel Zahka [this message]
2026-10-23 23:46 ` [PATCH net v3 2/4] psp: support ipv6 extension headers in psp_dev_rcv() decap Todd Freed
2026-10-24 23:48 ` netdev-bot+sashiko
2026-10-26 22:05 ` Todd Bert Freed
2026-10-27 0:58 ` Jakub Kicinski
2026-10-27 10:30 ` Björn Töpel
2026-10-27 17:57 ` Todd Bert Freed
2026-10-27 15:27 ` Daniel Zahka
2026-10-27 16:50 ` Todd Bert Freed
2026-10-23 23:46 ` [PATCH net v3 3/4] psp: support ipv6 extension headers in psp_dev_encapsulate() Todd Freed
2026-10-23 23:46 ` [PATCH net v3 4/4] selftests: drv-net: psp: test ipv6 tcp socket with extension headers Todd Freed
2026-10-24 23:48 ` netdev-bot+sashiko
2026-10-26 22:10 ` Todd Bert Freed
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=DMFPXSDO64VR.2AYG2NTUEYFRF@gmail.com \
--to=daniel.zahka@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=bjorn@kernel.org \
--cc=borisp@nvidia.com \
--cc=cratiu@nvidia.com \
--cc=davem@davemloft.net \
--cc=dtatulea@nvidia.com \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mbloch@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=raeds@nvidia.com \
--cc=rrameshbabu@nvidia.com \
--cc=saeedm@nvidia.com \
--cc=shuah@kernel.org \
--cc=tariqt@nvidia.com \
--cc=toddfreed@meta.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