gve: DQO: accept TSO packets with non-protocol gso_type bits
Subsystems (3)
PATCH v2 1/1 gve: DQO: accept TSO packets with non-protocol gso_type bits
Since commit 014c607f86ab ("gve: add support for UDP GSO for DQO format"), gve_prep_tso() matches shinfo->gso_type exactly. gso_type is a bitmask, though: SKB_GSO_DODGY is set on every GSO packet that comes from tun/tap, packet sockets or other untrusted sources, and SKB_GSO_TCP_ECN and SKB_GSO_TCP_FIXEDID can be set as well. Such packets hit the default case, gve_tx_add_skb_dqo() fails and gve_try_tx_skb() drops them, counting them in tx_dropped.
These packets do reach the driver: tcp_gso_segment() passes DODGY skbs through unsegmented to devices that support TSO, after recomputing gso_segs, so drivers must tolerate the bit.
This breaks virtual machines behind a tap on GCE instances using the DQO queue formats. Every TSO packet forwarded from a guest (gso_type SKB_GSO_TCPV4 | SKB_GSO_DODGY) is dropped, and guest uploads slow to a crawl of retransmissions or stall entirely, while the host's own TSO traffic (gso_type SKB_GSO_TCPV4) is unaffected. On an n4 instance (DQO-QPL) with a Cloud Hypervisor guest, a 64 MB upload from the guest went from a 60 s timeout at ~0.9 MB/s to 0.19 s with this change, with tx_dropped no longer increasing.
Host TCP with ECN is hit as well: gve advertises NETIF_F_TSO_ECN, so a TSO packet carrying CWR has SKB_GSO_TCP_ECN set and is dropped too.
Restore the bitmask test that commit 1b9f75634441 ("gve: ignore nonrelevant GSO type bits when processing TSO headers") introduced for the same problem, keeping the UDP GSO support.
While here, reload shinfo after skb_cow_head(). If the head was cloned, pskb_expand_head() moves skb_shared_info to the new head, and the pointer cached at function entry can then refer to memory that another clone frees.
---
v2:
- Reload shinfo after skb_cow_head() (Eric Dumazet, Sashiko review)
- Mention host TCP with ECN in the changelog (Eric Dumazet)
- Rebase on net, on top of commits 83769c23fb18, 3b430ea62340 and 296c83b5ccc8 (gve_can_send_tso() header length, MSS range checks)
- Carry Reviewed-by tags from v1
v1: https://lore.kernel.org/netdev/[email protected]/
drivers/net/ethernet/google/gve/gve_tx_dqo.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/ethernet/google/gve/gve_tx_dqo.c +7 -7
@@ -595,25 +595,25 @@ static int gve_prep_tso(struct sk_buff *skb) err =skb_cow_head (skb,0 );if (err <0 )return err; + shinfo =skb_shinfo (skb); l4_start =skb_transport_offset (skb); paylen = skb->len - l4_start; -switch (shinfo->gso_type) { -case SKB_GSO_TCPV4 : -case SKB_GSO_TCPV6 : +/* gso_type is a bitmask: SKB_GSO_DODGY, SKB_GSO_TCP_ECN and +* SKB_GSO_TCP_FIXEDID may be set alongside the protocol bit. +*/ +if (shinfo->gso_type & (SKB_GSO_TCPV4 |SKB_GSO_TCPV6 )) { tcp =tcp_hdr (skb);csum_replace_by_diff (&tcp->check, (__force __wsum )htonl (paylen)); header_len =skb_tcp_all_headers (skb); -break ; -case SKB_GSO_UDP_L4 : + }else if (shinfo->gso_type &SKB_GSO_UDP_L4 ) { udp =udp_hdr (skb);csum_replace_by_diff (&udp->check, (__force __wsum )htonl (paylen)); header_len =sizeof (struct udphdr ) + l4_start; -break ; -default : + }else {return -EINVAL ; }
base-commit: 11536ee3d3e0b1bd35b6f3f8df55a6053eb0c71d
Signature · 1 line
2.54.0 (Apple Git-157)
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:
Quoted 9 lines · On Fri, 25 Sep 2026 14:52:37 +0300 you wrote:
Since commit
014c607f86ab("gve: add support for UDP GSO for DQO format"),gve_prep_tso()matchesshinfo->gso_typeexactly.gso_typeis a bitmask, though:SKB_GSO_DODGYis set on every GSO packet that comes from tun/tap, packet sockets or other untrusted sources, andSKB_GSO_TCP_ECNandSKB_GSO_TCP_FIXEDIDcan be set as well. Such packets hit the default case,gve_tx_add_skb_dqo()fails andgve_try_tx_skb()drops them, counting them intx_dropped.[...]
Here is the summary with links:
- [net,v2] gve: DQO: accept TSO packets with non-protocol gso_type bits
https://git.kernel.org/netdev/net/c/f8932b2c0c9a
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html