aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXin Long <lucien.xin@gmail.com>2017-10-01 10:00:55 -0400
committerDavid S. Miller <davem@davemloft.net>2017-10-02 01:30:32 -0400
commitc122fda271717f4fc618e0a31e833941fd5f1efd (patch)
tree3cb94ac33a0d66a34ddeaf8ba7aba32a43788518
parent5513d08d29511c263c00933c00dd7a82fffda3c9 (diff)
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.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv4/ip_gre.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 2a4ef9dc48ff..fad0bb1e3e9a 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -1245,7 +1245,9 @@ static int erspan_tunnel_init(struct net_device *dev)
1245 1245
1246 tunnel->tun_hlen = 8; 1246 tunnel->tun_hlen = 8;
1247 tunnel->parms.iph.protocol = IPPROTO_GRE; 1247 tunnel->parms.iph.protocol = IPPROTO_GRE;
1248 t_hlen = tunnel->hlen + sizeof(struct iphdr) + sizeof(struct erspanhdr); 1248 tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen +
1249 sizeof(struct erspanhdr);
1250 t_hlen = tunnel->hlen + sizeof(struct iphdr);
1249 1251
1250 dev->needed_headroom = LL_MAX_HEADER + t_hlen + 4; 1252 dev->needed_headroom = LL_MAX_HEADER + t_hlen + 4;
1251 dev->mtu = ETH_DATA_LEN - t_hlen - 4; 1253 dev->mtu = ETH_DATA_LEN - t_hlen - 4;