]>
Commit | Line | Data |
---|---|---|
a0a93ff7 TL |
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
2 | From: Thomas Lamprecht <t.lamprecht@proxmox.com> | |
3 | Date: Sat, 7 Jan 2023 13:50:22 +0100 | |
4 | Subject: [PATCH] Revert "gro: add support of (hw)gro packets to gro stack" | |
826eb0ff FG |
5 | MIME-Version: 1.0 |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
a0a93ff7 TL |
8 | |
9 | Seems to be the cause of a regression in network performance: | |
10 | https://lore.kernel.org/netdev/CAK8fFZ5pzMaw3U1KXgC_OK4shKGsN=HDcR62cfPOuL0umXE1Ww@mail.gmail.com/ | |
11 | ||
12 | This reverts commit 5eddb24901ee49eee23c0bfce6af2e83fd5679bd. | |
13 | ||
14 | Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com> | |
826eb0ff | 15 | Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com> |
a0a93ff7 TL |
16 | --- |
17 | net/core/gro.c | 18 ++++-------------- | |
18 | net/ipv4/tcp_offload.c | 17 ++--------------- | |
19 | 2 files changed, 6 insertions(+), 29 deletions(-) | |
20 | ||
21 | diff --git a/net/core/gro.c b/net/core/gro.c | |
22 | index bc9451743307..b4190eb08467 100644 | |
23 | --- a/net/core/gro.c | |
24 | +++ b/net/core/gro.c | |
25 | @@ -160,7 +160,6 @@ int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb) | |
26 | unsigned int gro_max_size; | |
27 | unsigned int new_truesize; | |
28 | struct sk_buff *lp; | |
29 | - int segs; | |
30 | ||
31 | /* pairs with WRITE_ONCE() in netif_set_gro_max_size() */ | |
32 | gro_max_size = READ_ONCE(p->dev->gro_max_size); | |
33 | @@ -176,7 +175,6 @@ int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb) | |
34 | return -E2BIG; | |
35 | } | |
36 | ||
37 | - segs = NAPI_GRO_CB(skb)->count; | |
38 | lp = NAPI_GRO_CB(p)->last; | |
39 | pinfo = skb_shinfo(lp); | |
40 | ||
41 | @@ -267,7 +265,7 @@ int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb) | |
42 | lp = p; | |
43 | ||
44 | done: | |
45 | - NAPI_GRO_CB(p)->count += segs; | |
46 | + NAPI_GRO_CB(p)->count++; | |
47 | p->data_len += len; | |
48 | p->truesize += delta_truesize; | |
49 | p->len += len; | |
50 | @@ -498,15 +496,8 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff | |
51 | BUILD_BUG_ON(!IS_ALIGNED(offsetof(struct napi_gro_cb, zeroed), | |
52 | sizeof(u32))); /* Avoid slow unaligned acc */ | |
53 | *(u32 *)&NAPI_GRO_CB(skb)->zeroed = 0; | |
54 | - NAPI_GRO_CB(skb)->flush = skb_has_frag_list(skb); | |
55 | + NAPI_GRO_CB(skb)->flush = skb_is_gso(skb) || skb_has_frag_list(skb); | |
56 | NAPI_GRO_CB(skb)->is_atomic = 1; | |
57 | - NAPI_GRO_CB(skb)->count = 1; | |
58 | - if (unlikely(skb_is_gso(skb))) { | |
59 | - NAPI_GRO_CB(skb)->count = skb_shinfo(skb)->gso_segs; | |
60 | - /* Only support TCP at the moment. */ | |
61 | - if (!skb_is_gso_tcp(skb)) | |
62 | - NAPI_GRO_CB(skb)->flush = 1; | |
63 | - } | |
64 | ||
65 | /* Setup for GRO checksum validation */ | |
66 | switch (skb->ip_summed) { | |
67 | @@ -554,10 +545,10 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff | |
68 | else | |
69 | gro_list->count++; | |
70 | ||
71 | + NAPI_GRO_CB(skb)->count = 1; | |
72 | NAPI_GRO_CB(skb)->age = jiffies; | |
73 | NAPI_GRO_CB(skb)->last = skb; | |
74 | - if (!skb_is_gso(skb)) | |
75 | - skb_shinfo(skb)->gso_size = skb_gro_len(skb); | |
76 | + skb_shinfo(skb)->gso_size = skb_gro_len(skb); | |
77 | list_add(&skb->list, &gro_list->list); | |
78 | ret = GRO_HELD; | |
79 | ||
80 | @@ -669,7 +660,6 @@ static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb) | |
81 | ||
82 | skb->encapsulation = 0; | |
83 | skb_shinfo(skb)->gso_type = 0; | |
84 | - skb_shinfo(skb)->gso_size = 0; | |
85 | if (unlikely(skb->slow_gro)) { | |
86 | skb_orphan(skb); | |
87 | skb_ext_reset(skb); | |
88 | diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c | |
89 | index 45dda7889387..a844a0d38482 100644 | |
90 | --- a/net/ipv4/tcp_offload.c | |
91 | +++ b/net/ipv4/tcp_offload.c | |
92 | @@ -255,15 +255,7 @@ struct sk_buff *tcp_gro_receive(struct list_head *head, struct sk_buff *skb) | |
93 | ||
94 | mss = skb_shinfo(p)->gso_size; | |
95 | ||
96 | - /* If skb is a GRO packet, make sure its gso_size matches prior packet mss. | |
97 | - * If it is a single frame, do not aggregate it if its length | |
98 | - * is bigger than our mss. | |
99 | - */ | |
100 | - if (unlikely(skb_is_gso(skb))) | |
101 | - flush |= (mss != skb_shinfo(skb)->gso_size); | |
102 | - else | |
103 | - flush |= (len - 1) >= mss; | |
104 | - | |
105 | + flush |= (len - 1) >= mss; | |
106 | flush |= (ntohl(th2->seq) + skb_gro_len(p)) ^ ntohl(th->seq); | |
107 | #ifdef CONFIG_TLS_DEVICE | |
108 | flush |= p->decrypted ^ skb->decrypted; | |
109 | @@ -277,12 +269,7 @@ struct sk_buff *tcp_gro_receive(struct list_head *head, struct sk_buff *skb) | |
110 | tcp_flag_word(th2) |= flags & (TCP_FLAG_FIN | TCP_FLAG_PSH); | |
111 | ||
112 | out_check_final: | |
113 | - /* Force a flush if last segment is smaller than mss. */ | |
114 | - if (unlikely(skb_is_gso(skb))) | |
115 | - flush = len != NAPI_GRO_CB(skb)->count * skb_shinfo(skb)->gso_size; | |
116 | - else | |
117 | - flush = len < mss; | |
118 | - | |
119 | + flush = len < mss; | |
120 | flush |= (__force int)(flags & (TCP_FLAG_URG | TCP_FLAG_PSH | | |
121 | TCP_FLAG_RST | TCP_FLAG_SYN | | |
122 | TCP_FLAG_FIN)); |