* [PATCH net v6 1/8] net/mlx5e: ring the tx doorbell when an accel offload drops a packet
[not found] <20261117203137.804424-1-toddfreed@meta.com>
@ 2026-11-17 20:31 ` Todd Freed
2026-11-18 14:08 ` Dragos Tatulea
2026-11-17 20:31 ` [PATCH net v6 2/8] psp: don't encapsulate ipv6 packets with extension headers Todd Freed
` (4 subsequent siblings)
5 siblings, 1 reply; 8+ messages in thread
From: Todd Freed @ 2026-11-17 20:31 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Andrew Lunn, Björn Töpel,
Boris Pismenny, Cosmin Ratiu, Daniel Zahka, David Ahern,
Dragos Tatulea, Eric Dumazet, Ido Schimmel, Jakub Kicinski,
John Fastabend, Leon Romanovsky, linux-kernel, linux-kselftest,
linux-rdma, Mark Bloch, Paolo Abeni, Raed Salem, Rahul Rameshbabu,
Sabrina Dubroca, Saeed Mahameed, Shuah Khan, Simon Horman,
Tariq Toukan, Wei Wang, Willem de Bruijn, stable
when mlx5e_accel_tx_begin() drops the skb, e.g. because psp can't
encapsulate it, mlx5e_xmit() returns without posting anything. the skbs
before it in a bulk dequeue may have been posted with xmit_more, which
defers the doorbell to the next one, and an mpwqe session may be open.
the device then doesn't see them until the next transmit on that sq, and
since the queue isn't stopped, the tx watchdog doesn't fire.
flush the sq on this drop like the dma error paths do: close the mpwqe
session, post a nop and ring the doorbell.
mlx5e_tx_flush() doesn't check whether the nop leaves less than
stop_room in the sq. for the dma error paths that is rare, but a run of
offload drops would post nops without stopping the queue, and could
overrun wqes in flight. so check it in mlx5e_tx_flush(), like the other
producers do. the completion of the nop wakes the queue again.
the next patch makes the psp drop reachable from user space, with an
ipv6 extension header set on a psp socket.
Fixes: 2ac9cfe78223 ("net/mlx5e: IPSec, Add Innova IPSec offload TX data path")
Cc: stable@vger.kernel.org
Signed-off-by: Todd Freed <toddfreed@meta.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
index 14479da98f42..006bf976def1 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
@@ -365,6 +365,7 @@ static void mlx5e_tx_flush(struct mlx5e_txqsq *sq)
};
wqe = mlx5e_post_nop(&sq->wq, sq->sqn, &sq->pc);
+ mlx5e_tx_check_stop(sq);
mlx5e_notify_hw(&sq->wq, sq->pc, sq->uar_map, &wqe->ctrl);
}
@@ -672,8 +673,13 @@ netdev_tx_t mlx5e_xmit(struct sk_buff *skb, struct net_device *dev)
}
/* May send SKBs and WQEs. */
- if (unlikely(!mlx5e_accel_tx_begin(dev, sq, skb, &accel)))
+ if (unlikely(!mlx5e_accel_tx_begin(dev, sq, skb, &accel))) {
+ /* The skb was dropped: ring the doorbell which the previous
+ * ones may have deferred to it
+ */
+ mlx5e_tx_flush(sq);
return NETDEV_TX_OK;
+ }
mlx5e_sq_xmit_prepare(sq, skb, &accel, &attr);
--
2.53.1-Meta
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH net v6 1/8] net/mlx5e: ring the tx doorbell when an accel offload drops a packet
2026-11-17 20:31 ` [PATCH net v6 1/8] net/mlx5e: ring the tx doorbell when an accel offload drops a packet Todd Freed
@ 2026-11-18 14:08 ` Dragos Tatulea
0 siblings, 0 replies; 8+ messages in thread
From: Dragos Tatulea @ 2026-11-18 14:08 UTC (permalink / raw)
To: Todd Freed, netdev
Cc: David S. Miller, Andrew Lunn, Björn Töpel,
Boris Pismenny, Cosmin Ratiu, Daniel Zahka, David Ahern,
Eric Dumazet, Ido Schimmel, Jakub Kicinski, John Fastabend,
Leon Romanovsky, linux-kernel, linux-kselftest, linux-rdma,
Mark Bloch, Paolo Abeni, Raed Salem, Rahul Rameshbabu,
Sabrina Dubroca, Saeed Mahameed, Shuah Khan, Simon Horman,
Tariq Toukan, Wei Wang, Willem de Bruijn, stable
On 17.11.26 21:31, Todd Freed wrote:
> when mlx5e_accel_tx_begin() drops the skb, e.g. because psp can't
> encapsulate it, mlx5e_xmit() returns without posting anything. the skbs
> before it in a bulk dequeue may have been posted with xmit_more, which
> defers the doorbell to the next one, and an mpwqe session may be open.
> the device then doesn't see them until the next transmit on that sq, and
> since the queue isn't stopped, the tx watchdog doesn't fire.
>
> flush the sq on this drop like the dma error paths do: close the mpwqe
> session, post a nop and ring the doorbell.
>
> mlx5e_tx_flush() doesn't check whether the nop leaves less than
> stop_room in the sq. for the dma error paths that is rare, but a run of
> offload drops would post nops without stopping the queue, and could
> overrun wqes in flight. so check it in mlx5e_tx_flush(), like the other
> producers do. the completion of the nop wakes the queue again.
>
> the next patch makes the psp drop reachable from user space, with an
> ipv6 extension header set on a psp socket.
>
> Fixes: 2ac9cfe78223 ("net/mlx5e: IPSec, Add Innova IPSec offload TX data path")
> Cc: stable@vger.kernel.org
> Signed-off-by: Todd Freed <toddfreed@meta.com>
LGTM. Couldn't find any side effects besides the additonal NOP + db
dance which is ok.
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Thanks,
Dragos
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH net v6 2/8] psp: don't encapsulate ipv6 packets with extension headers
[not found] <20261117203137.804424-1-toddfreed@meta.com>
2026-11-17 20:31 ` [PATCH net v6 1/8] net/mlx5e: ring the tx doorbell when an accel offload drops a packet Todd Freed
@ 2026-11-17 20:31 ` Todd Freed
2026-11-17 20:31 ` [PATCH net v6 3/8] net: don't fragment decrypted skbs Todd Freed
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Todd Freed @ 2026-11-17 20:31 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Andrew Lunn, Björn Töpel,
Boris Pismenny, Cosmin Ratiu, Daniel Zahka, David Ahern,
Dragos Tatulea, Eric Dumazet, Ido Schimmel, Jakub Kicinski,
John Fastabend, Leon Romanovsky, linux-kernel, linux-kselftest,
linux-rdma, Mark Bloch, Paolo Abeni, Raed Salem, Rahul Rameshbabu,
Sabrina Dubroca, Saeed Mahameed, Shuah Khan, Simon Horman,
Tariq Toukan, Wei Wang, Willem de Bruijn, stable
psp_dev_encapsulate() inserts the udp+psp headers at the transport
header, rewrites the protocol of the fixed ip header to udp, and writes
tcp as the psp next header. so tcp must directly follow the fixed
header.
if the packet is an ipv6 packet with extension headers, udp+psp is
placed after them, but the next header indicating the l4 protocol is on
the last extension header in the chain, not in the fixed header.
therefore this produces a malformed packet.
in addition to being malformed, with mlx5 this kind of packet goes out
unencrypted. since the tx association encodes intent to send encrypted
packets, drop such packets instead.
a psp tcp socket emits such packets if certain socket options are set on
it (e.g. IPV6_DSTOPTS). refusing the combination of such socket options
with psp association would be helpful but is not implemented here. since
extension headers can also come from a route the datapath check is
needed anyway.
the check also covers ipv4: the l4 protocol must be tcp, and the
transport header must follow the ip header and its options. packets of
a psp tcp socket always pass it.
Fixes: fc724515741a ("psp: provide encapsulation helper for drivers")
Cc: stable@vger.kernel.org
Signed-off-by: Todd Freed <toddfreed@meta.com>
---
net/psp/psp_main.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/net/psp/psp_main.c b/net/psp/psp_main.c
index 273b010d2355..c071f507261b 100644
--- a/net/psp/psp_main.c
+++ b/net/psp/psp_main.c
@@ -245,6 +245,24 @@ static void psp_write_headers(struct net *net, struct sk_buff *skb, __be32 spi,
memset(&psph->iv, 0, sizeof(psph->iv));
}
+/* UDP+PSP goes in at the transport header, the protocol of the fixed IP
+ * header becomes UDP, and TCP the PSP next header: TCP must directly follow
+ * the fixed header. It doesn't with IPv6 extension headers, whose last one
+ * holds the L4 protocol.
+ */
+static bool psp_dev_encap_ok(const struct sk_buff *skb)
+{
+ u32 network_len = skb_network_header_len(skb);
+
+ if (skb->protocol == htons(ETH_P_IP))
+ return ip_hdr(skb)->protocol == IPPROTO_TCP &&
+ network_len == ip_hdrlen(skb);
+ if (skb->protocol == htons(ETH_P_IPV6))
+ return ipv6_hdr(skb)->nexthdr == IPPROTO_TCP &&
+ network_len == sizeof(struct ipv6hdr);
+ return false;
+}
+
/* Encapsulate a TCP packet with PSP by adding the UDP+PSP headers and filling
* them in.
*/
@@ -255,8 +273,7 @@ bool psp_dev_encapsulate(struct net *net, struct sk_buff *skb, __be32 spi,
u32 ethr_len = skb_mac_header_len(skb);
u32 bufflen = ethr_len + network_len;
- if (skb->protocol != htons(ETH_P_IP) &&
- skb->protocol != htons(ETH_P_IPV6))
+ if (!psp_dev_encap_ok(skb))
return false;
if (skb_cow_head(skb, PSP_ENCAP_HLEN))
--
2.53.1-Meta
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH net v6 3/8] net: don't fragment decrypted skbs
[not found] <20261117203137.804424-1-toddfreed@meta.com>
2026-11-17 20:31 ` [PATCH net v6 1/8] net/mlx5e: ring the tx doorbell when an accel offload drops a packet Todd Freed
2026-11-17 20:31 ` [PATCH net v6 2/8] psp: don't encapsulate ipv6 packets with extension headers Todd Freed
@ 2026-11-17 20:31 ` Todd Freed
2026-11-17 20:31 ` [PATCH net v6 4/8] ipv4: icmp: don't quote decrypted payload in icmp errors Todd Freed
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Todd Freed @ 2026-11-17 20:31 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Andrew Lunn, Björn Töpel,
Boris Pismenny, Cosmin Ratiu, Daniel Zahka, David Ahern,
Dragos Tatulea, Eric Dumazet, Ido Schimmel, Jakub Kicinski,
John Fastabend, Leon Romanovsky, linux-kernel, linux-kselftest,
linux-rdma, Mark Bloch, Paolo Abeni, Raed Salem, Rahul Rameshbabu,
Sabrina Dubroca, Saeed Mahameed, Shuah Khan, Simon Horman,
Tariq Toukan, Wei Wang, Willem de Bruijn, stable
on transmit, skb->decrypted means the device must encrypt the skb.
if it can't do that, then the packet should be dropped, not transmitted
in the clear.
ip_do_fragment() and ip6_fragment() on a decrypted skb produce
fragments which have skb->decrypted unset, and can be sent out
unencrypted.
tx of individually encrypted fragments would not work anyway, because
encrypting needs the L4 header, which non-initial fragments do not have.
ktls could encrypt in sw before fragmenting. that would not work for psp
offload which does not have a software fallback path.
tcp sizes segments to the mtu, so psp and ktls socket packets normally
won't reach this path. an ipv4 tcp socket can be made to send fragments
by setting a route mtu above the device mtu and disabling pmtud on the
socket (IP_PMTUDISC_OMIT). the selftest later in the series does this.
emitting fragments from an ipv6 tcp socket requires more steps, but is
also possible. the test setup here uses ipvs, which sets ignore_df on
forwarded packets. in ip6_fragment(), check skb->decrypted after the
too-big checks, so that a local socket still gets PKT_TOOBIG for path
mtu discovery.
tested with tls tx offload on mlx5 (connectx-7), over ipv4. without
this patch some fragments after the first go out in cleartext, with it
they're dropped (IpFragFails) and the connection stalls.
tested over ipv6, with tls tx offload and psp on mlx5 (connectx-7),
through an ipvs dr service with a local client. without this patch,
fragments after the first go out in cleartext, and the peer reassembles
them; with it they're dropped (Ip6FragFails).
Fixes: e8f69799810c ("net/tls: Add generic NIC offload infrastructure")
Fixes: 659a2899a57d ("tcp: add datapath logic for PSP with inline key exchange")
Cc: stable@vger.kernel.org
Signed-off-by: Todd Freed <toddfreed@meta.com>
---
net/ipv4/ip_output.c | 8 ++++++++
net/ipv6/ip6_output.c | 9 +++++++++
2 files changed, 17 insertions(+)
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index d42d776af273..94a40e7ed534 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -770,6 +770,14 @@ int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
struct ip_frag_state state;
int err = 0;
+ /* PSP and TLS offload need the packet's L4 header, which non-initial
+ * fragments do not have.
+ */
+ if (unlikely(skb_is_decrypted(skb))) {
+ err = -EMSGSIZE;
+ goto fail;
+ }
+
/* for offloaded checksums cleanup checksum before fragmentation */
if (skb->ip_summed == CHECKSUM_PARTIAL) {
err = ip_check_csum_start(skb);
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index cb648c839431..5b19683f08e0 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -929,6 +929,15 @@ int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
mtu = IPV6_MIN_MTU;
}
+ /* PSP and TLS offload need the packet's L4 header, which non-initial
+ * fragments do not have. Checked after the too-big checks above,
+ * so that PMTUD for a local socket works.
+ */
+ if (unlikely(skb_is_decrypted(skb))) {
+ err = -EMSGSIZE;
+ goto fail;
+ }
+
if (np) {
u32 frag_size = READ_ONCE(np->frag_size);
--
2.53.1-Meta
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH net v6 4/8] ipv4: icmp: don't quote decrypted payload in icmp errors
[not found] <20261117203137.804424-1-toddfreed@meta.com>
` (2 preceding siblings ...)
2026-11-17 20:31 ` [PATCH net v6 3/8] net: don't fragment decrypted skbs Todd Freed
@ 2026-11-17 20:31 ` Todd Freed
2026-11-17 20:31 ` [PATCH net v6 5/8] ipv6: icmpv6: don't quote decrypted payload in icmpv6 errors Todd Freed
2026-11-17 20:31 ` [PATCH net v6 8/8] net/mlx5e: psp: tso: replace only the length in checksum seed Todd Freed
5 siblings, 0 replies; 8+ messages in thread
From: Todd Freed @ 2026-11-17 20:31 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Andrew Lunn, Björn Töpel,
Boris Pismenny, Cosmin Ratiu, Daniel Zahka, David Ahern,
Dragos Tatulea, Eric Dumazet, Ido Schimmel, Jakub Kicinski,
John Fastabend, Leon Romanovsky, linux-kernel, linux-kselftest,
linux-rdma, Mark Bloch, Paolo Abeni, Raed Salem, Rahul Rameshbabu,
Sabrina Dubroca, Saeed Mahameed, Shuah Khan, Simon Horman,
Tariq Toukan, Wei Wang, Willem de Bruijn, stable
an icmp error quotes as much of the invoking packet as fits in 576
bytes. if the device had decrypted the packet (as indicated by
skb->decrypted) then the icmp error is sending part of it back out onto
the network in cleartext.
the two offloads encrypt different parts of the packet:
- ktls encrypts the tcp payload. the tcp header is in the clear on the
wire, so a quote of the ip header and the tcp header, without the
payload, would be fine.
- psp encryption also covers the tcp header. the quote could include
just the ip header, but then that's not really useful. linux receivers
want to look at the l4 layer on the quoted packet to look up the
related flow, so such a truncated icmp error packet is just dropped
(icmp_socket_deliver()).
a decrypted psp skb carries SKB_EXT_PSP, so the two could be told apart,
and an error about a ktls skb could still quote up to the tcp header.
but then whether the tcp header of a psp packet goes out in cleartext
would depend on the extension not being lost anywhere between the
device and here, while skb->decrypted is what the device itself set. so
don't send an error about a received decrypted skb at all.
on tx, skb->decrypted is also set. an error about a locally originated
skb (skb_iif is 0) is sent in full as before, if it is routed to a local
address (RTCF_LOCAL on the route to the packet's source address).
iptables REJECT, and nft reject in the ip and inet families, send their
icmp error with icmp_send(), through nf_send_unreach(). so now, a
received packet which the device decrypted, and which hits such a reject
rule in the INPUT or FORWARD chain, is dropped without a reply, like a
drop rule. nft reject in the netdev and bridge families builds its own
error (nf_reject_skb_v4_unreach()); a separate nf-next patch applies the
same rule there.
packets which weren't decrypted are rejected as before, and so are
locally originated ones in the OUTPUT chain, if the error goes to a
local address as above.
the next patch does the same for icmpv6.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261023234640.1459291-1-toddfreed%40meta.com
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Suggested-by: Björn Töpel <bjorn@kernel.org>
Fixes: 784abe24c903 ("net: Add decrypted field to skb")
Cc: stable@vger.kernel.org
Signed-off-by: Todd Freed <toddfreed@meta.com>
---
net/ipv4/icmp.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 90c0e22c29be..e11008aa4cec 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -979,6 +979,18 @@ void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info,
if (rt->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST))
goto ende;
+ /* Don't send parts of a decrypted skb onto the network. A received skb
+ * was decrypted by the device, and the transport header may have been
+ * encrypted. The different offloads can't be distinguished in all cases
+ * so simply don't send the error.
+ *
+ * A locally originated skb to be encrypted may be quoted if its source
+ * address (target of the error) is local.
+ */
+ if (unlikely(skb_is_decrypted(skb_in)) &&
+ (skb_in->skb_iif || !(rt->rt_flags & RTCF_LOCAL)))
+ goto ende;
+
/* peer icmp_ratelimit */
if (!icmpv4_xrlim_allow(net, rt, &fl4, type, code, apply_ratelimit))
goto ende;
--
2.53.1-Meta
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH net v6 5/8] ipv6: icmpv6: don't quote decrypted payload in icmpv6 errors
[not found] <20261117203137.804424-1-toddfreed@meta.com>
` (3 preceding siblings ...)
2026-11-17 20:31 ` [PATCH net v6 4/8] ipv4: icmp: don't quote decrypted payload in icmp errors Todd Freed
@ 2026-11-17 20:31 ` Todd Freed
2026-11-17 20:31 ` [PATCH net v6 8/8] net/mlx5e: psp: tso: replace only the length in checksum seed Todd Freed
5 siblings, 0 replies; 8+ messages in thread
From: Todd Freed @ 2026-11-17 20:31 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Andrew Lunn, Björn Töpel,
Boris Pismenny, Cosmin Ratiu, Daniel Zahka, David Ahern,
Dragos Tatulea, Eric Dumazet, Ido Schimmel, Jakub Kicinski,
John Fastabend, Leon Romanovsky, linux-kernel, linux-kselftest,
linux-rdma, Mark Bloch, Paolo Abeni, Raed Salem, Rahul Rameshbabu,
Sabrina Dubroca, Saeed Mahameed, Shuah Khan, Simon Horman,
Tariq Toukan, Wei Wang, Willem de Bruijn, stable
an icmpv6 error quotes as much of the invoking packet as fits in the
minimum ipv6 mtu. if the device had decrypted the packet (as indicated
by skb->decrypted) then the icmpv6 error is sending part of it back out
onto the network in cleartext.
as in the previous patch for icmp, don't send an error about a received
decrypted skb at all: psp also encrypts the l4 header, and telling it
apart from ktls rx device offload would rely on SKB_EXT_PSP not being
lost on the way. linux receivers would drop an error whose quote stops
before the l4 header anyway (icmpv6_notify()). this covers ip6tables
REJECT and nft reject in the ip6 and inet families; the netdev and
bridge families are left to the nf-next patch, as for icmp.
on tx, skb->decrypted is also set. an error about a locally originated
skb (skb_iif is 0) is sent in full as before, if its route goes to a
local address (RTF_LOCAL), like RTCF_LOCAL in the previous patch.
an error about a received decrypted skb is dropped before the rate
limit, so that it doesn't use up the peer's and the global icmpv6
credit. the check of a locally originated skb needs the route of the
error, which is looked up after the rate limit.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261023234640.1459291-1-toddfreed%40meta.com
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Suggested-by: Björn Töpel <bjorn@kernel.org>
Fixes: 784abe24c903 ("net: Add decrypted field to skb")
Cc: stable@vger.kernel.org
Signed-off-by: Todd Freed <toddfreed@meta.com>
---
net/ipv6/icmp.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index d8203ebad882..574a42d279e0 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -778,6 +778,15 @@ void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
np = inet6_sk(sk);
+ /* Don't send parts of a decrypted skb onto the network, see
+ * __icmp_send(): no error about a received skb. Before the rate
+ * limit, so that such an error costs no credit. The check of a
+ * locally originated skb below needs the route of the error, which
+ * is looked up after the rate limit.
+ */
+ if (unlikely(skb_is_decrypted(skb) && skb->skb_iif))
+ goto out_unlock;
+
if (!icmpv6_xrlim_allow(sk, type, &fl6, apply_ratelimit))
goto out_unlock;
@@ -799,6 +808,15 @@ void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
if (IS_ERR(dst))
goto out_unlock;
+ /* An error about a locally originated decrypted skb is sent only if
+ * it is routed to a local address.
+ */
+ if (unlikely(skb_is_decrypted(skb)) &&
+ !(dst_rt6_info(dst)->rt6i_flags & RTF_LOCAL)) {
+ dst_release(dst);
+ goto out_unlock;
+ }
+
ipc6.hlimit = ip6_sk_dst_hoplimit(np, &fl6, dst);
msg.skb = skb;
--
2.53.1-Meta
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH net v6 8/8] net/mlx5e: psp: tso: replace only the length in checksum seed
[not found] <20261117203137.804424-1-toddfreed@meta.com>
` (4 preceding siblings ...)
2026-11-17 20:31 ` [PATCH net v6 5/8] ipv6: icmpv6: don't quote decrypted payload in icmpv6 errors Todd Freed
@ 2026-11-17 20:31 ` Todd Freed
2026-11-18 14:24 ` Dragos Tatulea
5 siblings, 1 reply; 8+ messages in thread
From: Todd Freed @ 2026-11-17 20:31 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Andrew Lunn, Björn Töpel,
Boris Pismenny, Cosmin Ratiu, Daniel Zahka, David Ahern,
Dragos Tatulea, Eric Dumazet, Ido Schimmel, Jakub Kicinski,
John Fastabend, Leon Romanovsky, linux-kernel, linux-kselftest,
linux-rdma, Mark Bloch, Paolo Abeni, Raed Salem, Rahul Rameshbabu,
Sabrina Dubroca, Saeed Mahameed, Shuah Khan, Simon Horman,
Tariq Toukan, Wei Wang, Willem de Bruijn, stable
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, for example,
- ipv4 source route option (IP_OPTIONS with lsrr or ssrr)
- ipv6 IPV6_RTHDR header (conceptually ; ipv6 extension headers are not
properly supported on this path yet)
in these cases every segment of the tso packet to go out with a bad tcp
checksum
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 a psp tcp socket whose ipv4 loose source
route'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")
Acked-by: Daniel Zahka <daniel.zahka@gmail.com>
Cc: stable@vger.kernel.org
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;
--
2.53.1-Meta
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH net v6 8/8] net/mlx5e: psp: tso: replace only the length in checksum seed
2026-11-17 20:31 ` [PATCH net v6 8/8] net/mlx5e: psp: tso: replace only the length in checksum seed Todd Freed
@ 2026-11-18 14:24 ` Dragos Tatulea
0 siblings, 0 replies; 8+ messages in thread
From: Dragos Tatulea @ 2026-11-18 14:24 UTC (permalink / raw)
To: Todd Freed, netdev
Cc: David S. Miller, Andrew Lunn, Björn Töpel,
Boris Pismenny, Cosmin Ratiu, Daniel Zahka, David Ahern,
Eric Dumazet, Ido Schimmel, Jakub Kicinski, John Fastabend,
Leon Romanovsky, linux-kernel, linux-kselftest, linux-rdma,
Mark Bloch, Paolo Abeni, Raed Salem, Rahul Rameshbabu,
Sabrina Dubroca, Saeed Mahameed, Shuah Khan, Simon Horman,
Tariq Toukan, Wei Wang, Willem de Bruijn, stable
On 17.11.26 21:31, 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
No cap in first char of sentence makes reading the commit message
harder. For example is this sentence standalone or a continuation?
Sorry for cramping your style.
> in addresses is incorrect in cases where the l3 header daddr is an
> intermediate hop, for example,
>
> - ipv4 source route option (IP_OPTIONS with lsrr or ssrr)
> - ipv6 IPV6_RTHDR header (conceptually ; ipv6 extension headers are not
> properly supported on this path yet)
>
> in these cases every segment of the tso packet to go out with a bad tcp
> checksum
What did you mean with "to go out" here? Goes out? Or is a verb missing?
>
> 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 a psp tcp socket whose ipv4 loose source
> route'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")
> Acked-by: Daniel Zahka <daniel.zahka@gmail.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Todd Freed <toddfreed@meta.com>
Other than that:
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Thanks,
Dragos
^ permalink raw reply [flat|nested] 8+ messages in thread