On Tue, Nov 3, 2020 at 5:41 AM Oliver Herms
<[email protected]> wrote:
>
> Due to the legacy usage of hard_header_len for SIT tunnels while
> already using infrastructure from net/ipv4/ip_tunnel.c the
> calculation of the path MTU in tnl_update_pmtu is incorrect.
> This leads to unnecessary creation of MTU exceptions for any
> flow going over a SIT tunnel.
>
> As SIT tunnels do not have a header themsevles other than their
> transport (L3, L2) headers we're leaving hard_header_len set to zero
> as tnl_update_pmtu is already taking care of the transport headers
> sizes.
>
> This will also help avoiding unnecessary IPv6 GC runs and spinlock
> contention seen when using SIT tunnels and for more than
> net.ipv6.route.gc_thresh flows.
Thanks. Yes, this is long overdue.
The hard_header_len issue was also recently discussed in the context
of GRE in commit fdafed459998 ("ip_gre: set dev->hard_header_len and
dev->needed_headroom properly").
Question is whether we should reserve room in needed_headroom instead.
AFAIK this existing update logic in ip6_tnl_xmit is sufficient
"
/* Calculate max headroom for all the headers and adjust
* needed_headroom if necessary.
*/
max_headroom = LL_RESERVED_SPACE(dst->dev) + sizeof(struct ipv6hdr)
+ dst->header_len + t->hlen;
if (max_headroom > dev->needed_headroom)
dev->needed_headroom = max_headroom;
"
> Fixes: c54419321455 ("GRE: Refactor GRE tunneling code.")
How did you arrive at this SHA1?
> Signed-off-by: Oliver Herms <[email protected]>
> ---
> net/ipv6/sit.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
> index 5e2c34c0ac97..5e7983cb6154 100644
> --- a/net/ipv6/sit.c
> +++ b/net/ipv6/sit.c
> @@ -1128,7 +1128,6 @@ static void ipip6_tunnel_bind_dev(struct net_device
> *dev)
> if (tdev && !netif_is_l3_master(tdev)) {
> int t_hlen = tunnel->hlen + sizeof(struct iphdr);
>
> - dev->hard_header_len = tdev->hard_header_len + sizeof(struct
> iphdr);
> dev->mtu = tdev->mtu - t_hlen;
> if (dev->mtu < IPV6_MIN_MTU)
> dev->mtu = IPV6_MIN_MTU;
> @@ -1426,7 +1425,6 @@ static void ipip6_tunnel_setup(struct net_device *dev)
> dev->priv_destructor = ipip6_dev_free;
>
> dev->type = ARPHRD_SIT;
> - dev->hard_header_len = LL_MAX_HEADER + t_hlen;
> dev->mtu = ETH_DATA_LEN - t_hlen;
> dev->min_mtu = IPV6_MIN_MTU;
> dev->max_mtu = IP6_MAX_MTU - t_hlen;
> --
> 2.25.1
>