From: Xin Long <lucien....@gmail.com>

Upstream commit:
    commit c122fda271717f4fc618e0a31e833941fd5f1efd
    Author: Xin Long <lucien....@gmail.com>
    Date:   Sun Oct 1 22:00:55 2017 +0800

    ip_gre: set tunnel hlen properly in erspan_tunnel_init

    According to __gre_tunnel_init, tunnel->hlen should be set as the
    headers' length between inner packet and outer iphdr.

    It would be used especially to calculate a proper mtu when updating
    mtu in tnl_update_pmtu. Now without setting it, a bigger mtu value
    than expected would be updated, which hurts performance a lot.

    This patch is to fix it by setting tunnel->hlen with:
       tunnel->tun_hlen + tunnel->encap_hlen + sizeof(struct erspanhdr)

    Fixes: 84e54fe0a5ea ("gre: introduce native tunnel support for ERSPAN")
    Signed-off-by: Xin Long <lucien....@gmail.com>
    Signed-off-by: David S. Miller <da...@davemloft.net>

Cc: Xin Long <lucien....@gmail.com>
Signed-off-by: Greg Rose <gvrose8...@gmail.com>
---
 datapath/linux/compat/ip_gre.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c
index 1a8dc76..70c6a9f 100644
--- a/datapath/linux/compat/ip_gre.c
+++ b/datapath/linux/compat/ip_gre.c
@@ -1044,7 +1044,9 @@ static int erspan_tunnel_init(struct net_device *dev)
 
        tunnel->tun_hlen = 8;
        tunnel->parms.iph.protocol = IPPROTO_GRE;
-       t_hlen = tunnel->hlen + sizeof(struct iphdr) + sizeof(struct erspanhdr);
+       tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen +
+                      sizeof(struct erspanhdr);
+       t_hlen = tunnel->hlen + sizeof(struct iphdr);
 
        dev->needed_headroom = LL_MAX_HEADER + t_hlen + 4;
        dev->mtu = ETH_DATA_LEN - t_hlen - 4;
-- 
1.8.3.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to