Skip to content

Commit 741d069

Browse files
gentoo-rootkuba-moo
authored andcommitted
net/ipv6: Drop HBH for BIG TCP on TX side
BIG TCP IPv6 inserts a hop-by-hop extension header to indicate the real IPv6 payload length when it doesn't fit into the 16-bit field in the IPv6 header itself. While it helps tools parse the packet, it also requires every driver that supports TSO and BIG TCP to remove this 8-byte extension header. It might not sound that bad until we try to apply it to tunneled traffic. Currently, the drivers don't attempt to strip HBH if skb->encapsulation = 1. Moreover, trying to do so would require dissecting different tunnel protocols and making corresponding adjustments on case-by-case basis, which would slow down the fastpath (potentially also requiring adjusting checksums in outer headers). At the same time, BIG TCP IPv4 doesn't insert any extra headers and just calculates the payload length from skb->len, significantly simplifying implementing BIG TCP for tunnels. Stop inserting HBH when building BIG TCP GSO SKBs. Signed-off-by: Alice Mikityanska <alice@isovalent.com> Acked-by: Paolo Abeni <pabeni@redhat.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Link: https://patch.msgid.link/20260205133925.526371-3-alice.kernel@fastmail.im Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent b2936b4 commit 741d069

2 files changed

Lines changed: 3 additions & 18 deletions

File tree

include/linux/ipv6.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ struct inet6_skb_parm {
177177
#define IP6SKB_L3SLAVE 64
178178
#define IP6SKB_JUMBOGRAM 128
179179
#define IP6SKB_SEG6 256
180-
#define IP6SKB_FAKEJUMBO 512
181180
#define IP6SKB_MULTIPATH 1024
182181
#define IP6SKB_MCROUTE 2048
183182
};

net/ipv6/ip6_output.c

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,7 @@ ip6_finish_output_gso_slowpath_drop(struct net *net, struct sock *sk,
179179
static int ip6_finish_output_gso(struct net *net, struct sock *sk,
180180
struct sk_buff *skb, unsigned int mtu)
181181
{
182-
if (unlikely(!(IP6CB(skb)->flags & IP6SKB_FAKEJUMBO) &&
183-
!skb_gso_validate_network_len(skb, mtu)))
182+
if (unlikely(!skb_gso_validate_network_len(skb, mtu)))
184183
return ip6_finish_output_gso_slowpath_drop(net, sk, skb, mtu);
185184

186185
return ip6_finish_output2(net, sk, skb);
@@ -273,8 +272,6 @@ int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
273272
struct in6_addr *first_hop = &fl6->daddr;
274273
struct dst_entry *dst = skb_dst(skb);
275274
struct inet6_dev *idev = ip6_dst_idev(dst);
276-
struct hop_jumbo_hdr *hop_jumbo;
277-
int hoplen = sizeof(*hop_jumbo);
278275
struct net *net = sock_net(sk);
279276
unsigned int head_room;
280277
struct net_device *dev;
@@ -287,7 +284,7 @@ int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
287284
rcu_read_lock();
288285

289286
dev = dst_dev_rcu(dst);
290-
head_room = sizeof(struct ipv6hdr) + hoplen + LL_RESERVED_SPACE(dev);
287+
head_room = sizeof(struct ipv6hdr) + LL_RESERVED_SPACE(dev);
291288
if (opt)
292289
head_room += opt->opt_nflen + opt->opt_flen;
293290

@@ -313,19 +310,8 @@ int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
313310
&fl6->saddr);
314311
}
315312

316-
if (unlikely(seg_len > IPV6_MAXPLEN)) {
317-
hop_jumbo = __skb_push(skb, hoplen);
318-
319-
hop_jumbo->nexthdr = proto;
320-
hop_jumbo->hdrlen = 0;
321-
hop_jumbo->tlv_type = IPV6_TLV_JUMBO;
322-
hop_jumbo->tlv_len = 4;
323-
hop_jumbo->jumbo_payload_len = htonl(seg_len + hoplen);
324-
325-
proto = IPPROTO_HOPOPTS;
313+
if (unlikely(seg_len > IPV6_MAXPLEN))
326314
seg_len = 0;
327-
IP6CB(skb)->flags |= IP6SKB_FAKEJUMBO;
328-
}
329315

330316
__skb_push(skb, sizeof(struct ipv6hdr));
331317
skb_reset_network_header(skb);

0 commit comments

Comments
 (0)