From: Cosmin Ratiu <cratiu@nvidia.com>
To: "andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>,
"edumazet@google.com" <edumazet@google.com>,
"davem@davemloft.net" <davem@davemloft.net>,
Tariq Toukan <tariqt@nvidia.com>,
Rahul Rameshbabu <rrameshbabu@nvidia.com>,
Raed Salem <raeds@nvidia.com>, Mark Bloch <mbloch@nvidia.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"leon@kernel.org" <leon@kernel.org>,
Saeed Mahameed <saeedm@nvidia.com>,
Boris Pismenny <borisp@nvidia.com>,
"daniel.zahka@gmail.com" <daniel.zahka@gmail.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net/mlx5e: don't assume psp tx skbs are ipv6 csum handling
Date: Mon, 26 Jan 2026 09:15:33 +0000 [thread overview]
Message-ID: <dddaf1c5923576042112c2edad2f285306b839cb.camel@nvidia.com> (raw)
In-Reply-To: <20260123-dzahka-fix-tx-csum-partial-v1-1-7b0107693883@gmail.com>
On Fri, 2026-01-23 at 10:11 -0800, Daniel Zahka wrote:
> mlx5e_psp_handle_tx_skb() assumes skbs are ipv6 when doing a partial
> TCP checksum with tso. Make correctly mlx5e_psp_handle_tx_skb()
> handle
> ipv4 packets.
>
> Fixes: e5a1861a298e ("net/mlx5e: Implement PSP Tx data path")
> Signed-off-by: Daniel Zahka <daniel.zahka@gmail.com>
> ---
> This is a bug when an ipv4 tx skb passes through
> mlx5e_psp_handle_tx_skb() and tso is requested. It was previously
> undetected in my testing because my setup involves cx7's on both
> ends,
> and mlx5e_handle_csum() marks PSP rx skb's with csum_unnecessary.
>
> To reproduce the problem just turn off NETIF_F_RXCSUM and observe:
> nstat -a | grep TcpInCsumErrors
> ---
> .../net/ethernet/mellanox/mlx5/core/en_accel/psp_rxtx.c | 15
> +++++++++++----
> 1 file changed, 11 insertions(+), 4 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 c17ea0fcd8ef..15a344ad471d 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
> @@ -178,7 +178,9 @@ bool mlx5e_psp_handle_tx_skb(struct net_device
> *netdev,
> struct mlx5e_priv *priv = netdev_priv(netdev);
> struct net *net = sock_net(skb->sk);
> const struct ipv6hdr *ip6;
> + const struct iphdr *ip;
> struct tcphdr *th;
> + int len;
All four of these should be declared lower down in their respective if
branches.
>
> if (!mlx5e_psp_set_state(priv, skb, psp_st))
> return true;
> @@ -190,11 +192,16 @@ bool mlx5e_psp_handle_tx_skb(struct net_device
> *netdev,
> return false;
> }
> if (skb_is_gso(skb)) {
> - ip6 = ipv6_hdr(skb);
> th = inner_tcp_hdr(skb);
> -
> - th->check = ~tcp_v6_check(skb_shinfo(skb)->gso_size
> + inner_tcp_hdrlen(skb), &ip6->saddr,
> - &ip6->daddr, 0);
> + len = skb_shinfo(skb)->gso_size +
> inner_tcp_hdrlen(skb);
> +
> + if (skb->protocol == htons(ETH_P_IP)) {
> + ip = ip_hdr(skb);
> + th->check = ~tcp_v4_check(len, ip->saddr,
> ip->daddr, 0);
> + } else {
> + ip6 = ipv6_hdr(skb);
> + th->check = ~tcp_v6_check(len, &ip6->saddr,
> &ip6->daddr, 0);
> + }
> }
>
> return true;
>
> ---
> base-commit: 4a3dba48188208e4f66822800e042686784d29d1
> change-id: 20260122-dzahka-fix-tx-csum-partial-952e8dc28375
>
> Best regards,
Otherwise LGTM!
Cosmin.
prev parent reply other threads:[~2026-01-26 9:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-23 18:11 Daniel Zahka
2026-01-26 9:15 ` Cosmin Ratiu [this message]
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=dddaf1c5923576042112c2edad2f285306b839cb.camel@nvidia.com \
--to=cratiu@nvidia.com \
--cc=andrew+netdev@lunn.ch \
--cc=borisp@nvidia.com \
--cc=daniel.zahka@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@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=tariqt@nvidia.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
all inboxes | Powered by JetHome®