summaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@kernel.org>2022-01-24 19:45:11 -0700
committerJakub Kicinski <kuba@kernel.org>2022-01-25 14:44:55 -0800
commitab14f1802cfb2d7ca120bbf48e3ba6712314ffc3 (patch)
treec96c04a12016c292bf82db5bb5efc40b58b20786 /net/core
parent6b0671a23dd6cc949d12fa8d65171856159cd17b (diff)
downloadlinux-ab14f1802cfb2d7ca120bbf48e3ba6712314ffc3.tar.bz2
net: Adjust sk_gso_max_size once when set
sk_gso_max_size is set based on the dst dev. Both users of it adjust the value by the same offset - (MAX_TCP_HEADER + 1). Rather than compute the same adjusted value on each call do the adjustment once when set. Signed-off-by: David Ahern <dsahern@kernel.org> Reviewed-by: Eric Dumazet <edumazet@google.com> Link: https://lore.kernel.org/r/20220125024511.27480-1-dsahern@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/sock.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 4ff806d71921..cccf21f3618d 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -2266,6 +2266,7 @@ void sk_setup_caps(struct sock *sk, struct dst_entry *dst)
sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM;
/* pairs with the WRITE_ONCE() in netif_set_gso_max_size() */
sk->sk_gso_max_size = READ_ONCE(dst->dev->gso_max_size);
+ sk->sk_gso_max_size -= (MAX_TCP_HEADER + 1);
/* pairs with the WRITE_ONCE() in netif_set_gso_max_segs() */
max_segs = max_t(u32, READ_ONCE(dst->dev->gso_max_segs), 1);
}