From: Xin Long <lucien.xin@gmail.com>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: davem <davem@davemloft.net>, Sabrina Dubroca <sd@queasysnail.net>,
network dev <netdev@vger.kernel.org>
Subject: Re: [PATCH net 2/2] geneve, vxlan: Don't set exceptions if skb->len < mtu
Date: Mon, 15 Oct 2018 15:01:31 +0900 [thread overview]
Message-ID: <CADvbK_fVyZA-MzmESYOQmp_pes+X61iftnYtNNU4Y_uqSg2LhQ@mail.gmail.com> (raw)
In-Reply-To: <97f93a69894ed49e6b914a8211ec813cc1bbc433.1539381018.git.sbrivio@redhat.com>
On Sat, Oct 13, 2018 at 6:54 AM Stefano Brivio <sbrivio@redhat.com> wrote:
>
> We shouldn't abuse exceptions: if the destination MTU is already higher
> than what we're transmitting, no exception should be created.
makes sense, shouldn't ip(6) tunnels also do this?
>
> Fixes: 52a589d51f10 ("geneve: update skb dst pmtu on tx path")
> Fixes: a93bf0ff4490 ("vxlan: update skb dst pmtu on tx path")
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
> Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
> ---
> drivers/net/geneve.c | 7 +++----
> drivers/net/vxlan.c | 4 ++--
> include/net/dst.h | 10 ++++++++++
> 3 files changed, 15 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
> index 61c4bfbeb41c..493cd382b8aa 100644
> --- a/drivers/net/geneve.c
> +++ b/drivers/net/geneve.c
> @@ -830,8 +830,8 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev,
> if (IS_ERR(rt))
> return PTR_ERR(rt);
>
> - skb_dst_update_pmtu(skb, dst_mtu(&rt->dst) -
> - GENEVE_IPV4_HLEN - info->options_len);
> + skb_tunnel_check_pmtu(skb, &rt->dst,
> + GENEVE_IPV4_HLEN + info->options_len);
>
> sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
> if (geneve->collect_md) {
> @@ -872,8 +872,7 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
> if (IS_ERR(dst))
> return PTR_ERR(dst);
>
> - skb_dst_update_pmtu(skb, dst_mtu(dst) -
> - GENEVE_IPV6_HLEN - info->options_len);
> + skb_tunnel_check_pmtu(skb, dst, GENEVE_IPV6_HLEN + info->options_len);
>
> sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
> if (geneve->collect_md) {
> diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
> index 22e0ce592e07..27bd586b94b0 100644
> --- a/drivers/net/vxlan.c
> +++ b/drivers/net/vxlan.c
> @@ -2194,7 +2194,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
> }
>
> ndst = &rt->dst;
> - skb_dst_update_pmtu(skb, dst_mtu(ndst) - VXLAN_HEADROOM);
> + skb_tunnel_check_pmtu(skb, ndst, VXLAN_HEADROOM);
>
> tos = ip_tunnel_ecn_encap(tos, old_iph, skb);
> ttl = ttl ? : ip4_dst_hoplimit(&rt->dst);
> @@ -2231,7 +2231,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
> goto out_unlock;
> }
>
> - skb_dst_update_pmtu(skb, dst_mtu(ndst) - VXLAN6_HEADROOM);
> + skb_tunnel_check_pmtu(skb, ndst, VXLAN6_HEADROOM);
>
> tos = ip_tunnel_ecn_encap(tos, old_iph, skb);
> ttl = ttl ? : ip6_dst_hoplimit(ndst);
> diff --git a/include/net/dst.h b/include/net/dst.h
> index 7f735e76ca73..6cf0870414c7 100644
> --- a/include/net/dst.h
> +++ b/include/net/dst.h
> @@ -527,4 +527,14 @@ static inline void skb_dst_update_pmtu(struct sk_buff *skb, u32 mtu)
> dst->ops->update_pmtu(dst, NULL, skb, mtu);
> }
>
> +static inline void skb_tunnel_check_pmtu(struct sk_buff *skb,
> + struct dst_entry *encap_dst,
> + int headroom)
> +{
> + u32 encap_mtu = dst_mtu(encap_dst);
> +
> + if (skb->len > encap_mtu - headroom)
> + skb_dst_update_pmtu(skb, encap_mtu - headroom);
> +}
> +
> #endif /* _NET_DST_H */
> --
> 2.19.1
>
next prev parent reply other threads:[~2018-10-15 13:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-12 21:53 [PATCH net 0/2] geneve, vxlan: Don't set exceptions if skb->len < mtu Stefano Brivio
2018-10-12 21:53 ` [PATCH net 1/2] geneve, vxlan: Don't check skb_dst() twice Stefano Brivio
2018-10-15 10:19 ` Nicolas Dichtel
2018-10-15 11:08 ` Stefano Brivio
2018-10-15 12:24 ` Nicolas Dichtel
2018-10-12 21:53 ` [PATCH net 2/2] geneve, vxlan: Don't set exceptions if skb->len < mtu Stefano Brivio
2018-10-15 6:01 ` Xin Long [this message]
2018-10-15 8:27 ` Stefano Brivio
2018-10-15 9:40 ` [PATCH net 0/2] " Xin Long
2018-10-18 4:51 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADvbK_fVyZA-MzmESYOQmp_pes+X61iftnYtNNU4Y_uqSg2LhQ@mail.gmail.com \
--to=lucien.xin@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=sbrivio@redhat.com \
--cc=sd@queasysnail.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).