Skip to content

Commit 8d95dc4

Browse files
nbd168Paolo Abeni
authored andcommitted
net: add code for TCP fraglist GRO
This implements fraglist GRO similar to how it's handled in UDP, however no functional changes are added yet. The next change adds a heuristic for using fraglist GRO instead of regular GRO. Acked-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name> Reviewed-by: Eric Dumazet <edumazet@google.com> Reviewed-by: David Ahern <dsahern@kernel.org> Reviewed-by: Willem de Bruijn <willemb@google.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent bee88cd commit 8d95dc4

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

net/ipv4/tcp_offload.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,18 @@ struct sk_buff *tcp_gro_receive(struct list_head *head, struct sk_buff *skb)
334334
flush |= (ntohl(th2->seq) + skb_gro_len(p)) ^ ntohl(th->seq);
335335
flush |= skb_cmp_decrypted(p, skb);
336336

337+
if (unlikely(NAPI_GRO_CB(p)->is_flist)) {
338+
flush |= (__force int)(flags ^ tcp_flag_word(th2));
339+
flush |= skb->ip_summed != p->ip_summed;
340+
flush |= skb->csum_level != p->csum_level;
341+
flush |= NAPI_GRO_CB(p)->count >= 64;
342+
343+
if (flush || skb_gro_receive_list(p, skb))
344+
mss = 1;
345+
346+
goto out_check_final;
347+
}
348+
337349
if (flush || skb_gro_receive(p, skb)) {
338350
mss = 1;
339351
goto out_check_final;
@@ -400,6 +412,15 @@ INDIRECT_CALLABLE_SCOPE int tcp4_gro_complete(struct sk_buff *skb, int thoff)
400412
const struct iphdr *iph = ip_hdr(skb);
401413
struct tcphdr *th = tcp_hdr(skb);
402414

415+
if (unlikely(NAPI_GRO_CB(skb)->is_flist)) {
416+
skb_shinfo(skb)->gso_type |= SKB_GSO_FRAGLIST | SKB_GSO_TCPV4;
417+
skb_shinfo(skb)->gso_segs = NAPI_GRO_CB(skb)->count;
418+
419+
__skb_incr_checksum_unnecessary(skb);
420+
421+
return 0;
422+
}
423+
403424
th->check = ~tcp_v4_check(skb->len - thoff, iph->saddr,
404425
iph->daddr, 0);
405426

net/ipv6/tcpv6_offload.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ INDIRECT_CALLABLE_SCOPE int tcp6_gro_complete(struct sk_buff *skb, int thoff)
3232
const struct ipv6hdr *iph = ipv6_hdr(skb);
3333
struct tcphdr *th = tcp_hdr(skb);
3434

35+
if (unlikely(NAPI_GRO_CB(skb)->is_flist)) {
36+
skb_shinfo(skb)->gso_type |= SKB_GSO_FRAGLIST | SKB_GSO_TCPV6;
37+
skb_shinfo(skb)->gso_segs = NAPI_GRO_CB(skb)->count;
38+
39+
__skb_incr_checksum_unnecessary(skb);
40+
41+
return 0;
42+
}
43+
3544
th->check = ~tcp_v6_check(skb->len - thoff, &iph->saddr,
3645
&iph->daddr, 0);
3746
skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV6;

0 commit comments

Comments
 (0)