* [PATCH v2] net/mlx5e: don't assume psp tx skbs are ipv6 csum handling
@ 2026-01-26 19:38 Daniel Zahka
2026-01-27 12:56 ` Eric Dumazet
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Daniel Zahka @ 2026-01-26 19:38 UTC (permalink / raw)
To: Boris Pismenny, Saeed Mahameed, Leon Romanovsky, Tariq Toukan,
Mark Bloch, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Rahul Rameshbabu, Raed Salem,
Cosmin Ratiu
Cc: netdev, linux-rdma, linux-kernel, Daniel Zahka
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
---
Changes in v2:
- move declarations down into branches where they are used.
- Link to v1: https://lore.kernel.org/r/20260123-dzahka-fix-tx-csum-partial-v1-1-7b0107693883@gmail.com
---
.../net/ethernet/mellanox/mlx5/core/en_accel/psp_rxtx.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 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..ef7f5338540f 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,8 +177,6 @@ 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;
- struct tcphdr *th;
if (!mlx5e_psp_set_state(priv, skb, psp_st))
return true;
@@ -190,11 +188,18 @@ 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);
+ int len = skb_shinfo(skb)->gso_size + inner_tcp_hdrlen(skb);
+ struct tcphdr *th = inner_tcp_hdr(skb);
- th->check = ~tcp_v6_check(skb_shinfo(skb)->gso_size + inner_tcp_hdrlen(skb), &ip6->saddr,
- &ip6->daddr, 0);
+ 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);
+ }
}
return true;
---
base-commit: 709bbb015538dfd5c97308b77c950d41a4d95cd3
change-id: 20260122-dzahka-fix-tx-csum-partial-952e8dc28375
Best regards,
--
Daniel Zahka <daniel.zahka@gmail.com>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] net/mlx5e: don't assume psp tx skbs are ipv6 csum handling
2026-01-26 19:38 [PATCH v2] net/mlx5e: don't assume psp tx skbs are ipv6 csum handling Daniel Zahka
@ 2026-01-27 12:56 ` Eric Dumazet
2026-01-27 13:17 ` Cosmin Ratiu
2026-01-29 4:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Eric Dumazet @ 2026-01-27 12:56 UTC (permalink / raw)
To: Daniel Zahka
Cc: Boris Pismenny, Saeed Mahameed, Leon Romanovsky, Tariq Toukan,
Mark Bloch, Andrew Lunn, David S. Miller, Jakub Kicinski,
Paolo Abeni, Rahul Rameshbabu, Raed Salem, Cosmin Ratiu, netdev,
linux-rdma, linux-kernel
On Mon, Jan 26, 2026 at 8:38 PM Daniel Zahka <daniel.zahka@gmail.com> 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>
Reviewed-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] net/mlx5e: don't assume psp tx skbs are ipv6 csum handling
2026-01-26 19:38 [PATCH v2] net/mlx5e: don't assume psp tx skbs are ipv6 csum handling Daniel Zahka
2026-01-27 12:56 ` Eric Dumazet
@ 2026-01-27 13:17 ` Cosmin Ratiu
2026-01-29 4:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Cosmin Ratiu @ 2026-01-27 13:17 UTC (permalink / raw)
To: andrew+netdev@lunn.ch, edumazet@google.com, davem@davemloft.net,
Tariq Toukan, Rahul Rameshbabu, Raed Salem, Mark Bloch,
kuba@kernel.org, pabeni@redhat.com, leon@kernel.org,
Saeed Mahameed, Boris Pismenny, daniel.zahka@gmail.com
Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
linux-kernel@vger.kernel.org
On Mon, 2026-01-26 at 11:38 -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
> ---
> Changes in v2:
> - move declarations down into branches where they are used.
> - Link to v1:
> https://lore.kernel.org/r/20260123-dzahka-fix-tx-csum-partial-v1-1-7b0107693883@gmail.com
> ---
> .../net/ethernet/mellanox/mlx5/core/en_accel/psp_rxtx.c | 17
> +++++++++++------
> 1 file changed, 11 insertions(+), 6 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..ef7f5338540f 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,8 +177,6 @@ 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;
> - struct tcphdr *th;
>
> if (!mlx5e_psp_set_state(priv, skb, psp_st))
> return true;
> @@ -190,11 +188,18 @@ 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);
> + int len = skb_shinfo(skb)->gso_size +
> inner_tcp_hdrlen(skb);
> + struct tcphdr *th = inner_tcp_hdr(skb);
>
> - th->check = ~tcp_v6_check(skb_shinfo(skb)->gso_size
> + inner_tcp_hdrlen(skb), &ip6->saddr,
> - &ip6->daddr, 0);
> + 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);
> + }
> }
>
> return true;
>
> ---
> base-commit: 709bbb015538dfd5c97308b77c950d41a4d95cd3
> change-id: 20260122-dzahka-fix-tx-csum-partial-952e8dc28375
>
> Best regards,
Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] net/mlx5e: don't assume psp tx skbs are ipv6 csum handling
2026-01-26 19:38 [PATCH v2] net/mlx5e: don't assume psp tx skbs are ipv6 csum handling Daniel Zahka
2026-01-27 12:56 ` Eric Dumazet
2026-01-27 13:17 ` Cosmin Ratiu
@ 2026-01-29 4:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-01-29 4:10 UTC (permalink / raw)
To: Daniel Zahka
Cc: borisp, saeedm, leon, tariqt, mbloch, andrew+netdev, davem,
edumazet, kuba, pabeni, rrameshbabu, raeds, cratiu, netdev,
linux-rdma, linux-kernel
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 26 Jan 2026 11:38:17 -0800 you 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>
>
> [...]
Here is the summary with links:
- [v2] net/mlx5e: don't assume psp tx skbs are ipv6 csum handling
https://git.kernel.org/netdev/net/c/a62f7d62d2b1
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-01-29 4:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-26 19:38 [PATCH v2] net/mlx5e: don't assume psp tx skbs are ipv6 csum handling Daniel Zahka
2026-01-27 12:56 ` Eric Dumazet
2026-01-27 13:17 ` Cosmin Ratiu
2026-01-29 4:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox