Skip to content

Commit 81fbc81

Browse files
edumazetdavem330
authored andcommitted
ipv6/gro: insert temporary HBH/jumbo header
Following patch will add GRO_IPV6_MAX_SIZE, allowing gro to build BIG TCP ipv6 packets (bigger than 64K). This patch changes ipv6_gro_complete() to insert a HBH/jumbo header so that resulting packet can go through IPv6/TCP stacks. Signed-off-by: Eric Dumazet <[email protected]> Acked-by: Alexander Duyck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 09f3d1a commit 81fbc81

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

net/ipv6/ip6_offload.c

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,15 +342,43 @@ static struct sk_buff *ip4ip6_gro_receive(struct list_head *head,
342342
INDIRECT_CALLABLE_SCOPE int ipv6_gro_complete(struct sk_buff *skb, int nhoff)
343343
{
344344
const struct net_offload *ops;
345-
struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + nhoff);
345+
struct ipv6hdr *iph;
346346
int err = -ENOSYS;
347+
u32 payload_len;
347348

348349
if (skb->encapsulation) {
349350
skb_set_inner_protocol(skb, cpu_to_be16(ETH_P_IPV6));
350351
skb_set_inner_network_header(skb, nhoff);
351352
}
352353

353-
iph->payload_len = htons(skb->len - nhoff - sizeof(*iph));
354+
payload_len = skb->len - nhoff - sizeof(*iph);
355+
if (unlikely(payload_len > IPV6_MAXPLEN)) {
356+
struct hop_jumbo_hdr *hop_jumbo;
357+
int hoplen = sizeof(*hop_jumbo);
358+
359+
/* Move network header left */
360+
memmove(skb_mac_header(skb) - hoplen, skb_mac_header(skb),
361+
skb->transport_header - skb->mac_header);
362+
skb->data -= hoplen;
363+
skb->len += hoplen;
364+
skb->mac_header -= hoplen;
365+
skb->network_header -= hoplen;
366+
iph = (struct ipv6hdr *)(skb->data + nhoff);
367+
hop_jumbo = (struct hop_jumbo_hdr *)(iph + 1);
368+
369+
/* Build hop-by-hop options */
370+
hop_jumbo->nexthdr = iph->nexthdr;
371+
hop_jumbo->hdrlen = 0;
372+
hop_jumbo->tlv_type = IPV6_TLV_JUMBO;
373+
hop_jumbo->tlv_len = 4;
374+
hop_jumbo->jumbo_payload_len = htonl(payload_len + hoplen);
375+
376+
iph->nexthdr = NEXTHDR_HOP;
377+
iph->payload_len = 0;
378+
} else {
379+
iph = (struct ipv6hdr *)(skb->data + nhoff);
380+
iph->payload_len = htons(payload_len);
381+
}
354382

355383
nhoff += sizeof(*iph) + ipv6_exthdrs_len(iph, &ops);
356384
if (WARN_ON(!ops || !ops->callbacks.gro_complete))

0 commit comments

Comments
 (0)