[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iKav+CyauFvgaiN4fyavVjEsa=wn2Wrdf6mopSrN=ecWQ@mail.gmail.com>
Date: Mon, 9 May 2022 19:20:08 -0700
From: Eric Dumazet <edumazet@...gle.com>
To: kernel test robot <lkp@...el.com>
Cc: Eric Dumazet <eric.dumazet@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, kbuild-all@...ts.01.org,
netdev <netdev@...r.kernel.org>,
Alexander Duyck <alexanderduyck@...com>,
Coco Li <lixiaoyan@...gle.com>
Subject: Re: [PATCH v5 net-next 02/13] net: allow gso_max_size to exceed 65536
On Mon, May 9, 2022 at 7:09 PM Eric Dumazet <edumazet@...gle.com> wrote:
>
>
> Alexander used :
>
> + if (sk->sk_gso_max_size > GSO_LEGACY_MAX_SIZE &&
> + (!IS_ENABLED(CONFIG_IPV6) || sk->sk_family
> != AF_INET6 ||
> + !sk_is_tcp(sk) ||
> ipv6_addr_v4mapped(&sk->sk_v6_rcv_saddr)))
> + sk->sk_gso_max_size = GSO_LEGACY_MAX_SIZE;
>
> I guess we could simply allow gso_max_size to be bigger than
> GSO_LEGACY_MAX_SIZE only
> if IS_ENABLED(CONFIG_IPV6)
>
> So the above code could really be:
>
> #if IS_ENABLED(CONFIG_IPV6)
> if (sk->sk_gso_max_size > GSO_LEGACY_MAX_SIZE &&
> (sk->sk_family != AF_INET6 ||
> !sk_is_tcp(sk) ||
> ipv6_addr_v4mapped(&sk->sk_v6_rcv_saddr)))
> sk->sk_gso_max_size = GSO_LEGACY_MAX_SIZE;
> #endif
In v6, I will squash the following diff to Alexander patch:
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index dfd57a647c97ed0f400ffe89c73919367a900f75..6bd9e09b34ec583a05a929ca979511e6423dbeb7
100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2271,8 +2271,13 @@ struct net_device {
/* TCP minimal MSS is 8 (TCP_MIN_GSO_SIZE),
* and shinfo->gso_segs is a 16bit field.
+ * If IPV6 is not enabled, we keep legacy value.
*/
+#if IS_ENABLED(CONFIG_IPV6)
#define GSO_MAX_SIZE (8 * GSO_MAX_SEGS)
+#else
+#define GSO_MAX_SIZE GSO_LEGACY_MAX_SIZE
+#endif
unsigned int gso_max_size;
#define TSO_LEGACY_MAX_SIZE 65536
diff --git a/net/core/dev.c b/net/core/dev.c
index 7349f75891d5724a060781abc80a800bdf835f74..4be3695846520af18a687cdcaa70c5f327ba94e8
100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3003,7 +3003,7 @@ EXPORT_SYMBOL(netif_set_real_num_queues);
*/
void netif_set_tso_max_size(struct net_device *dev, unsigned int size)
{
- dev->tso_max_size = size;
+ dev->tso_max_size = min(GSO_MAX_SIZE, size);
if (size < READ_ONCE(dev->gso_max_size))
netif_set_gso_max_size(dev, size);
}
diff --git a/net/core/sock.c b/net/core/sock.c
index f7c3171078b6fccd25757e8fe54dd56a2a674238..2a931f396472108ccedcd3d08189c63775caecff
100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -2312,10 +2312,13 @@ 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);
+#if IS_ENABLED(CONFIG_IPV6)
if (sk->sk_gso_max_size > GSO_LEGACY_MAX_SIZE &&
- (!IS_ENABLED(CONFIG_IPV6) || sk->sk_family
!= AF_INET6 ||
- !sk_is_tcp(sk) ||
ipv6_addr_v4mapped(&sk->sk_v6_rcv_saddr)))
+ (sk->sk_family != AF_INET6 ||
+ !sk_is_tcp(sk) ||
+ ipv6_addr_v4mapped(&sk->sk_v6_rcv_saddr)))
sk->sk_gso_max_size = GSO_LEGACY_MAX_SIZE;
+#endif
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);
Powered by blists - more mailing lists