From: Xin Long <lucien....@gmail.com> Date: Wed, 20 Dec 2017 01:05:32 +0800
> On Wed, Dec 20, 2017 at 12:12 AM, David Miller <da...@davemloft.net> wrote: >> You're going to have to find a way to fix this without >> invoking ->update_pmtu() on every single transmit. That's >> really excessive, especially for an operation which is >> going to be a NOP %99.9999 of the time. > understand, I couldn't find a better way, and all iptunnels are > doing it in this way. > > Or is it possible to go with an unlikely here ? > > if (unlikely(skb_dst(skb) && mtu < dst_mtu(skb_dst(skb)))) > skb_dst(skb)->ops->update_pmtu(skb_dst(skb), NULL, > skb, mtu); > > ... > how about doing it in vxlan_get_route(): > @@ -1896,6 +1896,13 @@ static struct rtable *vxlan_get_route(struct > vxlan_dev *vxlan, struct net_device > *saddr = fl4.saddr; > if (use_cache) > dst_cache_set_ip4(dst_cache, &rt->dst, fl4.saddr); > + > + if (skb_dst(skb)) { > + int mtu = dst_mtu(ndst) - VXLAN_HEADROOM; > + > + skb_dst(skb)->ops->update_pmtu(skb_dst(skb), NULL, > + skb, mtu); > + } > > > This would do it only when no dst_cache and it has to do real route lookup. > > Note that even when update_pmtu is hit, mostly it will do nothing and > just return > as usually new mtu >= skb_dst(skb)'s pmtu. Ok, yeah, this is really difficult. I'll apply your patch for now, but generally speaking we have to handle this issue better.