summaryrefslogtreecommitdiff
path: root/net/core/gro.c
diff options
context:
space:
mode:
authorCoco Li <lixiaoyan@google.com>2022-01-05 13:48:38 +0300
committerDavid S. Miller <davem@davemloft.net>2022-01-06 15:27:05 +0300
commiteac1b93c14d645ef147b049ace0d5230df755548 (patch)
tree1cbed37768a8189a8ff3cd4c8ca7e542e3595aca /net/core/gro.c
parent007747a984ea5e895b7d8b056b24ebf431e1e71d (diff)
downloadlinux-eac1b93c14d645ef147b049ace0d5230df755548.tar.xz
gro: add ability to control gro max packet size
Eric Dumazet suggested to allow users to modify max GRO packet size. We have seen GRO being disabled by users of appliances (such as wifi access points) because of claimed bufferbloat issues, or some work arounds in sch_cake, to split GRO/GSO packets. Instead of disabling GRO completely, one can chose to limit the maximum packet size of GRO packets, depending on their latency constraints. This patch adds a per device gro_max_size attribute that can be changed with ip link command. ip link set dev eth0 gro_max_size 16000 Suggested-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Coco Li <lixiaoyan@google.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/gro.c')
-rw-r--r--net/core/gro.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/core/gro.c b/net/core/gro.c
index 8ec8b44596da..a11b286d1495 100644
--- a/net/core/gro.c
+++ b/net/core/gro.c
@@ -132,10 +132,14 @@ int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb)
unsigned int headlen = skb_headlen(skb);
unsigned int len = skb_gro_len(skb);
unsigned int delta_truesize;
+ unsigned int gro_max_size;
unsigned int new_truesize;
struct sk_buff *lp;
- if (unlikely(p->len + len >= 65536 || NAPI_GRO_CB(skb)->flush))
+ /* pairs with WRITE_ONCE() in netif_set_gro_max_size() */
+ gro_max_size = READ_ONCE(p->dev->gro_max_size);
+
+ if (unlikely(p->len + len >= gro_max_size || NAPI_GRO_CB(skb)->flush))
return -E2BIG;
lp = NAPI_GRO_CB(p)->last;