aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid Wragg <david@weave.works>2016-02-09 19:05:58 -0500
committerDavid S. Miller <davem@davemloft.net>2016-02-10 05:50:03 -0500
commit7e059158d57b79159eaf1f504825d19866ef2c42 (patch)
tree08f87eb3b0e08a48203e1ec95b2ddd00b91ca412 /net
parent55e5bfb53cff286c1c1ff49f51325dc15c7fea63 (diff)
vxlan, gre, geneve: Set a large MTU on ovs-created tunnel devices
Prior to 4.3, openvswitch tunnel vports (vxlan, gre and geneve) could transmit vxlan packets of any size, constrained only by the ability to send out the resulting packets. 4.3 introduced netdevs corresponding to tunnel vports. These netdevs have an MTU, which limits the size of a packet that can be successfully encapsulated. The default MTU values are low (1500 or less), which is awkwardly small in the context of physical networks supporting jumbo frames, and leads to a conspicuous change in behaviour for userspace. Instead, set the MTU on openvswitch-created netdevs to be the relevant maximum (i.e. the maximum IP packet size minus any relevant overhead), effectively restoring the behaviour prior to 4.3. Signed-off-by: David Wragg <david@weave.works> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/ip_gre.c8
-rw-r--r--net/ipv4/ip_tunnel.c20
-rw-r--r--net/openvswitch/vport-vxlan.c2
3 files changed, 27 insertions, 3 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 7c51c4e1661f..56fdf4e0dce4 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -1240,6 +1240,14 @@ struct net_device *gretap_fb_dev_create(struct net *net, const char *name,
1240 err = ipgre_newlink(net, dev, tb, NULL); 1240 err = ipgre_newlink(net, dev, tb, NULL);
1241 if (err < 0) 1241 if (err < 0)
1242 goto out; 1242 goto out;
1243
1244 /* openvswitch users expect packet sizes to be unrestricted,
1245 * so set the largest MTU we can.
1246 */
1247 err = __ip_tunnel_change_mtu(dev, IP_MAX_MTU, false);
1248 if (err)
1249 goto out;
1250
1243 return dev; 1251 return dev;
1244out: 1252out:
1245 free_netdev(dev); 1253 free_netdev(dev);
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index c7bd72e9b544..89e8861e05fc 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -943,17 +943,31 @@ done:
943} 943}
944EXPORT_SYMBOL_GPL(ip_tunnel_ioctl); 944EXPORT_SYMBOL_GPL(ip_tunnel_ioctl);
945 945
946int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu) 946int __ip_tunnel_change_mtu(struct net_device *dev, int new_mtu, bool strict)
947{ 947{
948 struct ip_tunnel *tunnel = netdev_priv(dev); 948 struct ip_tunnel *tunnel = netdev_priv(dev);
949 int t_hlen = tunnel->hlen + sizeof(struct iphdr); 949 int t_hlen = tunnel->hlen + sizeof(struct iphdr);
950 int max_mtu = 0xFFF8 - dev->hard_header_len - t_hlen;
950 951
951 if (new_mtu < 68 || 952 if (new_mtu < 68)
952 new_mtu > 0xFFF8 - dev->hard_header_len - t_hlen)
953 return -EINVAL; 953 return -EINVAL;
954
955 if (new_mtu > max_mtu) {
956 if (strict)
957 return -EINVAL;
958
959 new_mtu = max_mtu;
960 }
961
954 dev->mtu = new_mtu; 962 dev->mtu = new_mtu;
955 return 0; 963 return 0;
956} 964}
965EXPORT_SYMBOL_GPL(__ip_tunnel_change_mtu);
966
967int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu)
968{
969 return __ip_tunnel_change_mtu(dev, new_mtu, true);
970}
957EXPORT_SYMBOL_GPL(ip_tunnel_change_mtu); 971EXPORT_SYMBOL_GPL(ip_tunnel_change_mtu);
958 972
959static void ip_tunnel_dev_free(struct net_device *dev) 973static void ip_tunnel_dev_free(struct net_device *dev)
diff --git a/net/openvswitch/vport-vxlan.c b/net/openvswitch/vport-vxlan.c
index 1605691d9414..de9cb19efb6a 100644
--- a/net/openvswitch/vport-vxlan.c
+++ b/net/openvswitch/vport-vxlan.c
@@ -91,6 +91,8 @@ static struct vport *vxlan_tnl_create(const struct vport_parms *parms)
91 struct vxlan_config conf = { 91 struct vxlan_config conf = {
92 .no_share = true, 92 .no_share = true,
93 .flags = VXLAN_F_COLLECT_METADATA, 93 .flags = VXLAN_F_COLLECT_METADATA,
94 /* Don't restrict the packets that can be sent by MTU */
95 .mtu = IP_MAX_MTU,
94 }; 96 };
95 97
96 if (!options) { 98 if (!options) {