Set a large MTU on ovs-created tunnel devices
Subsystems (4)
v2 cover Set a large MTU on ovs-created tunnel devices
Prior to 4.3, 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 value for the MTUs 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.
This patch series sets 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.
Where appropriate, the limits on MTU values when set on the netdevs directly are also relaxed.
Changes in v2:
* Extend to all openvswitch tunnel types, i.e. gre and geneve as well
* Use IP_MAX_MTU
David Wragg (3):
vxlan: Relax the MTU constraints
geneve: Relax MTU constraints
vxlan, gre, geneve: Set a large MTU on ovs-created tunnel devices
drivers/net/geneve.c | 29 +++++++++++++++++++++----- drivers/net/vxlan.c | 47 ++++++++++++++++++++++++++++++------------- include/net/ip_tunnels.h | 1 + net/ipv4/ip_gre.c | 7 +++++++ net/ipv4/ip_tunnel.c | 21 ++++++++++++++++--- net/openvswitch/vport-vxlan.c | 2 ++ 6 files changed, 85 insertions(+), 22 deletions(-)
Signature · 6 lines
2.5.0 _______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
A message that is not in the archive (sent off-list or not yet received): 1455036424-6403-1-git-send-email-david-1SEAoVOfG6VEzL6FDj/[email protected]
PATCH v2 2/3 geneve: Relax MTU constraints
Allow the MTU of geneve devices to be set to large values, in order to exploit underlying networks with larger frame sizes.
GENEVE does not have a fixed encapsulation overhead (an openvswitch rule can add variable length options), so there is no relevant maximum MTU to enforce. A maximum of IP_MAX_MTU is used instead. Encapsulated packets that are too big for the underlying network will get dropped on the floor.
--- drivers/net/geneve.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/net/geneve.c +11 -1
@@ -1039,6 +1039,16 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev)return geneve_xmit_skb (skb, dev, info); } +static int geneve_change_mtu (struct net_device *dev,int new_mtu) +{ +/* GENEVE overhead is not fixed, so we can't enforce a more +precise max MTU. */ +if (new_mtu <68 || new_mtu >IP_MAX_MTU ) +return -EINVAL ; + dev->mtu = new_mtu; +return 0 ; +} +static int geneve_fill_metadata_dst (struct net_device *dev,struct sk_buff *skb) {struct ip_tunnel_info *info =skb_tunnel_info (skb);
@@ -1083,7 +1093,7 @@ static const struct net_device_ops geneve_netdev_ops = { .ndo_stop = geneve_stop, .ndo_start_xmit = geneve_xmit, .ndo_get_stats64 = ip_tunnel_get_stats64, - .ndo_change_mtu = eth_change_mtu, + .ndo_change_mtu = geneve_change_mtu, .ndo_validate_addr = eth_validate_addr, .ndo_set_mac_address = eth_mac_addr, .ndo_fill_metadata_dst = geneve_fill_metadata_dst,
Signature · 6 lines
2.5.0 _______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
Re: [PATCH net v2 2/3] geneve: Relax MTU constraints
Quoted 19 lines · David Wragg
Allow the MTU of geneve devices to be set to large values, in order to exploit underlying networks with larger frame sizes.
GENEVE does not have a fixed encapsulation overhead (an openvswitch rule can add variable length options), so there is no relevant maximum MTU to enforce. A maximum of
IP_MAX_MTUis used instead. Encapsulated packets that are too big for the underlying network will get dropped on the floor.Signed-off-by David Wragg <[email protected]>--- drivers/net/geneve.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)drivers/net/geneve.c +0
-0
drivers/net/geneve.c static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev) · line 1045
Quoted 7 lines
drivers/net/geneve.c +4
-0@@ -1039,6 +1039,16 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev)return geneve_xmit_skb (skb, dev, info); } +static int geneve_change_mtu (struct net_device *dev,int new_mtu) +{ +/* GENEVE overhead is not fixed, so we can't enforce a more +precise max MTU. */
The networking code formats comments:
/* Like
* this.
*/
drivers/net/geneve.c static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev) · line 1054
Quoted 9 lines
drivers/net/geneve.c +6
-0+if (new_mtu <68 || new_mtu >IP_MAX_MTU ) +return -EINVAL ; + dev->mtu = new_mtu; +return 0 ; +} +static int geneve_fill_metadata_dst (struct net_device *dev,struct sk_buff *skb) {struct ip_tunnel_info *info =skb_tunnel_info (skb);
[...]
MBR, Sergei
A message that is not in the archive (sent off-list or not yet received): 56BA2D6D.6090408-M4DtvfQ/[email protected]
Re: [PATCH net v2 2/3] geneve: Relax MTU constraints
Quoted 5 lines · Sergei Shtylyov
The networking code formats comments:
/* Like
* this.
*/
Thanks. And I noticed another silly mistake. Will respin.
David
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev
Re: [PATCH net v2 2/3] geneve: Relax MTU constraints
In reply to David WraggQuoted 9 lines · David Wragg
Allow the MTU of geneve devices to be set to large values, in order to exploit underlying networks with larger frame sizes.
GENEVE does not have a fixed encapsulation overhead (an openvswitch rule can add variable length options), so there is no relevant maximum MTU to enforce. A maximum of
IP_MAX_MTUis used instead. Encapsulated packets that are too big for the underlying network will get dropped on the floor.
This defeats the purpose of having an MTU. The advertised MTU indicates how large a packet that the interface if willing to handle. Upper layers use this information, and if they need to send a packet larger than MTU they take appropriate action such as fragmenting packet or sending an ICMP PTB error. If a packets are sent on the interface that are smaller than MTU and are being "dropped on the floor" for being too big, a sender would get no indication at all why its packets are being dropped.
The correct thing to do is determine the maximum amount of encapsulation overhead that can ever be set in a packet and use for setting the MTU. For instance, when RCO is enable in GUE, the size of the option is included in tunnel->encap_hlen even though it will not be used in all packets (via ip_tunnel_change_mtu). If there is no way to determine a maximum overhead a priori from configuration, then maximum overhead could be assumed to be maximum possible encapsulation header size which for Geneve is 132 bytes IIRC.
Tom
Quoted 38 lines
Signed-off-by David Wragg <[email protected]>--- drivers/net/geneve.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)drivers/net/geneve.c +11
-2@@ -1039,6 +1039,16 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev)return geneve_xmit_skb (skb, dev, info); } +static int geneve_change_mtu (struct net_device *dev,int new_mtu) +{ +/* GENEVE overhead is not fixed, so we can't enforce a more +precise max MTU. */ +if (new_mtu <68 || new_mtu >IP_MAX_MTU ) +return -EINVAL ; + dev->mtu = new_mtu; +return 0 ; +} +static int geneve_fill_metadata_dst (struct net_device *dev,struct sk_buff *skb) {struct ip_tunnel_info *info =skb_tunnel_info (skb);@@ -1083,7 +1093,7 @@ static const struct net_device_ops geneve_netdev_ops = { .ndo_stop = geneve_stop, .ndo_start_xmit = geneve_xmit, .ndo_get_stats64 = ip_tunnel_get_stats64, - .ndo_change_mtu = eth_change_mtu, + .ndo_change_mtu = geneve_change_mtu, .ndo_validate_addr = eth_validate_addr, .ndo_set_mac_address = eth_mac_addr, .ndo_fill_metadata_dst = geneve_fill_metadata_dst, --2.5.0
Re: [PATCH net v2 2/3] geneve: Relax MTU constraints
Quoted 8 lines · Tom Herbert
The correct thing to do is determine the maximum amount of encapsulation overhead that can ever be set in a packet and use for setting the MTU. For instance, when RCO is enable in GUE, the size of the option is included in
tunnel->encap_hleneven though it will not be used in all packets (viaip_tunnel_change_mtu). If there is no way to determine a maximum overhead a priori from configuration, then maximum overhead could be assumed to be maximum possible encapsulation header size which for Geneve is 132 bytes IIRC.
Ok, I'll come up with a patch to address this.
David
Re: [PATCH net v2 2/3] geneve: Relax MTU constraints
Quoted 11 lines · David Wragg
Quoted 8 lines · Tom Herbert
The correct thing to do is determine the maximum amount of encapsulation overhead that can ever be set in a packet and use for setting the MTU. For instance, when RCO is enable in GUE, the size of the option is included in
tunnel->encap_hleneven though it will not be used in all packets (viaip_tunnel_change_mtu). If there is no way to determine a maximum overhead a priori from configuration, then maximum overhead could be assumed to be maximum possible encapsulation header size which for Geneve is 132 bytes IIRC.Ok, I'll come up with a patch to address this.
I don't think that this really applies in this situation. The concerns here relate to what the MTU is actually set to but this patch affects the range of MTUs allowed to be set by the user. I don't see a reason to disallow the user from setting a precise value if they know what it should be.
In any case, I don't think it is likely to have much impact. By default with tunnels the output device is not fixed and therefore the base MTU that is used is IP_MAX_MTU. Subtracting some tunnel overhead amount from this is still likely quite a bit higher than any physical MTU.
If you really want, I would subtract the base Geneve header size from IP_MAX_MTU to get the true max but it's probably not a big deal in any case.
Re: [PATCH net v2 2/3] geneve: Relax MTU constraints
Quoted 11 lines · Jesse Gross
Quoted 10 lines · David Wragg
Quoted 8 lines · Tom Herbert
The correct thing to do is determine the maximum amount of encapsulation overhead that can ever be set in a packet and use for setting the MTU. For instance, when RCO is enable in GUE, the size of the option is included in
tunnel->encap_hleneven though it will not be used in all packets (viaip_tunnel_change_mtu). If there is no way to determine a maximum overhead a priori from configuration, then maximum overhead could be assumed to be maximum possible encapsulation header size which for Geneve is 132 bytes IIRC.
Quoted 8 lines
Quoted 1 line
Ok, I'll come up with a patch to address this.
I don't think that this really applies in this situation. The concerns here relate to what the MTU is actually set to but this patch affects the range of MTUs allowed to be set by the user. I don't see a reason to disallow the user from setting a precise value if they know what it should be.
Right, but if the user sets a bad value and packets are silently dropped on the floor then that seems like a bad result that could have easily been prevented.
Quoted 9 lines
In any case, I don't think it is likely to have much impact. By default with tunnels the output device is not fixed and therefore the base MTU that is used is
IP_MAX_MTU. Subtracting some tunnel overhead amount from this is still likely quite a bit higher than any physical MTU.If you really want, I would subtract the base Geneve header size from
IP_MAX_MTUto get the true max but it's probably not a big deal in any case.
A message that is not in the archive (sent off-list or not yet received): CALx6S36kvXJUZM8_vEmF8L3bxnRiBh98Rs0wAd-HGBJ9Yyde_Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH net v2 2/3] geneve: Relax MTU constraints
Quoted 20 lines · Tom Herbert
Quoted 11 lines · Jesse Gross
Quoted 10 lines · David Wragg
Quoted 8 lines · Tom Herbert
The correct thing to do is determine the maximum amount of encapsulation overhead that can ever be set in a packet and use for setting the MTU. For instance, when RCO is enable in GUE, the size of the option is included in
tunnel->encap_hleneven though it will not be used in all packets (viaip_tunnel_change_mtu). If there is no way to determine a maximum overhead a priori from configuration, then maximum overhead could be assumed to be maximum possible encapsulation header size which for Geneve is 132 bytes IIRC.Quoted 8 lines
Quoted 1 line
Ok, I'll come up with a patch to address this.
I don't think that this really applies in this situation. The concerns here relate to what the MTU is actually set to but this patch affects the range of MTUs allowed to be set by the user. I don't see a reason to disallow the user from setting a precise value if they know what it should be.
Quoted 3 lines
Right, but if the user sets a bad value and packets are silently dropped on the floor then that seems like a bad result that could have easily been prevented.
Sure, we might as well prevent the extreme edge cases that can never be valid. In the case of Geneve though, this would be the minimum header size, not the maximum, since it's possible that the user actually knows how big the options are that they want to use.
But as I said, the practical impact is low because IP_MAX_MTU is so much larger than the MTU of real devices. There will always be many values that the MTU can be set to that result in dropped packets. This is true of all tunnel types.
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev
Re: [PATCH net v2 2/3] geneve: Relax MTU constraints
Quoted 30 lines · Jesse Gross
Quoted 20 lines · Tom Herbert
Quoted 11 lines · Jesse Gross
Quoted 10 lines · David Wragg
Quoted 8 lines · Tom Herbert
The correct thing to do is determine the maximum amount of encapsulation overhead that can ever be set in a packet and use for setting the MTU. For instance, when RCO is enable in GUE, the size of the option is included in
tunnel->encap_hleneven though it will not be used in all packets (viaip_tunnel_change_mtu). If there is no way to determine a maximum overhead a priori from configuration, then maximum overhead could be assumed to be maximum possible encapsulation header size which for Geneve is 132 bytes IIRC.Quoted 8 lines
Quoted 1 line
Ok, I'll come up with a patch to address this.
I don't think that this really applies in this situation. The concerns here relate to what the MTU is actually set to but this patch affects the range of MTUs allowed to be set by the user. I don't see a reason to disallow the user from setting a precise value if they know what it should be.
Quoted 3 lines
Right, but if the user sets a bad value and packets are silently dropped on the floor then that seems like a bad result that could have easily been prevented.
Sure, we might as well prevent the extreme edge cases that can never be valid. In the case of Geneve though, this would be the minimum header size, not the maximum, since it's possible that the user actually knows how big the options are that they want to use.
Quoted 4 lines
But as I said, the practical impact is low because
IP_MAX_MTUis so much larger than the MTU of real devices. There will always be many values that the MTU can be set to that result in dropped packets. This is true of all tunnel types.
I agree with Jesse, and if there was a debate about lifting the MTU limit on all tunnel types to IP_MAX_MTU, I'd be for that.
But for the other tunnel types, I followed the precedent of the code that was already there, and geneve might as well be consistent.
Patch sent to the lists.
David
Re: [PATCH net v2 2/3] geneve: Relax MTU constraints
Quoted 36 lines · David Wragg
Quoted 30 lines · Jesse Gross
Quoted 20 lines · Tom Herbert
Quoted 11 lines · Jesse Gross
Quoted 10 lines · David Wragg
Quoted 8 lines · Tom Herbert
The correct thing to do is determine the maximum amount of encapsulation overhead that can ever be set in a packet and use for setting the MTU. For instance, when RCO is enable in GUE, the size of the option is included in
tunnel->encap_hleneven though it will not be used in all packets (viaip_tunnel_change_mtu). If there is no way to determine a maximum overhead a priori from configuration, then maximum overhead could be assumed to be maximum possible encapsulation header size which for Geneve is 132 bytes IIRC.Quoted 8 lines
Quoted 1 line
Ok, I'll come up with a patch to address this.
I don't think that this really applies in this situation. The concerns here relate to what the MTU is actually set to but this patch affects the range of MTUs allowed to be set by the user. I don't see a reason to disallow the user from setting a precise value if they know what it should be.
Quoted 3 lines
Right, but if the user sets a bad value and packets are silently dropped on the floor then that seems like a bad result that could have easily been prevented.
Sure, we might as well prevent the extreme edge cases that can never be valid. In the case of Geneve though, this would be the minimum header size, not the maximum, since it's possible that the user actually knows how big the options are that they want to use.
Quoted 4 lines
But as I said, the practical impact is low because
IP_MAX_MTUis so much larger than the MTU of real devices. There will always be many values that the MTU can be set to that result in dropped packets. This is true of all tunnel types.
Quoted 6 lines
I agree with Jesse, and if there was a debate about lifting the MTU limit on all tunnel types to
IP_MAX_MTU, I'd be for that.But for the other tunnel types, I followed the precedent of the code that was already there, and geneve might as well be consistent.
Please implement like in ip_tunnel_change_mtu (or better yet call it), that is the precedent for tunnels.
Tom
Quoted 3 lines
Patch sent to the lists.
David
Re: [PATCH net v2 2/3] geneve: Relax MTU constraints
Quoted 2 lines · Tom Herbert
Please implement like in
ip_tunnel_change_mtu(or better yet call it), that is the precedent for tunnels.
I've made geneve_change_mtu follow ip_tunnel_change_mtu in v2.
If it were to call it instead, are you suggesting just passing in t_hlen? Or restructuring geneve.c to re-use the whole ip_tunnel infrastructure?
Also, I'm not sure where the 0xFFF8 comes from in __ip_tunnel_change_mtu. Any ideas why 0xFFF8 rather than 0xffff? It goes all the way back to the inital import of the kernel into git.
David
David Miller
maintainerRe: [PATCH net v2 2/3] geneve: Relax MTU constraints
From: David Wragg <[email protected]>
Date: Thu, 18 Feb 2016 16:54:14 +0000
Quoted 6 lines
Quoted 2 lines · Tom Herbert
Please implement like in
ip_tunnel_change_mtu(or better yet call it), that is the precedent for tunnels.I've made
geneve_change_mtufollowip_tunnel_change_mtuin v2.
Quoted 7 lines
If it were to call it instead, are you suggesting just passing in
t_hlen? Or restructuringgeneve.cto re-use the wholeip_tunnelinfrastructure?Also, I'm not sure where the
0xFFF8comes from in__ip_tunnel_change_mtu. Any ideas why0xFFF8rather than0xffff? It goes all the way back to the inital import of the kernel into git.
Some 8 byte multiple requirement, perhaps to do with fragmentation.
A message that is not in the archive (sent off-list or not yet received): 86bn7e2c3t.fsf-1SEAoVOfG6VEzL6FDj/[email protected]
Re: [PATCH net v2 2/3] geneve: Relax MTU constraints
Quoted 10 lines · David Wragg
Quoted 2 lines · Tom Herbert
Please implement like in
ip_tunnel_change_mtu(or better yet call it), that is the precedent for tunnels.I've made
geneve_change_mtufollowip_tunnel_change_mtuin v2.If it were to call it instead, are you suggesting just passing in
t_hlen? Or restructuringgeneve.cto re-use the wholeip_tunnelinfrastructure?
I'll leave that to you to decide if that is feasible or makes sense, but ip_tunnel does do some other interesting things. Support for geneve could easily be implemented using ip_tunnel_encap facility. The default MTU on the device is set based on the MTU of the outgoing interface and tunnel overhead-- this should mitigate the possibility of a lot of fragmentation happening within the tunnel. Also, the output infrastructure caches the route for the tunnel which is a nice performance win.
Quoted 4 lines
Also, I'm not sure where the
0xFFF8comes from in__ip_tunnel_change_mtu. Any ideas why0xFFF8rather than0xffff? It goes all the way back to the inital import of the kernel into git.
Yes, that's pretty ugly. Feel free to replace that with a #define or at least put a comment about it for the benefit of future generations.
Thanks,
Tom
Quoted 1 line
David
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev
PATCH v2 1/3 vxlan: Relax the MTU constraints
In reply to David WraggAllow the MTU of vxlan devices without an underlying device to be set to larger values (up to a maximum based on IP packet limits and vxlan overhead).
Previously, their MTUs could not be set to higher than the conventional ethernet value of 1500. This is a very arbitrary value in the context of vxlan, and prevented vxlan devices from being able to take advantage of jumbo frames etc.
The default MTU remains 1500, for compatibility.
--- drivers/net/vxlan.c | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-)
drivers/net/vxlan.c +25 -11
@@ -2367,29 +2367,43 @@ static void vxlan_set_multicast_list(struct net_device *dev) { } -static int vxlan_change_mtu (struct net_device *dev,int new_mtu) +static int __vxlan_change_mtu (struct net_device *dev, +struct net_device *lowerdev, +struct vxlan_rdst *dst,int new_mtu,bool strict) { -struct vxlan_dev *vxlan =netdev_priv (dev); -struct vxlan_rdst *dst = &vxlan->default_dst; -struct net_device *lowerdev; -int max_mtu; +int max_mtu =IP_MAX_MTU ; - lowerdev =__dev_get_by_index (vxlan->net, dst->remote_ifindex); -if (lowerdev ==NULL ) -return eth_change_mtu (dev, new_mtu); +if (lowerdev) + max_mtu = lowerdev->mtu;if (dst->remote_ip.sa.sa_family ==AF_INET6 ) - max_mtu = lowerdev->mtu -VXLAN6_HEADROOM ; + max_mtu -=VXLAN6_HEADROOM ;else - max_mtu = lowerdev->mtu -VXLAN_HEADROOM ; + max_mtu -=VXLAN_HEADROOM ; -if (new_mtu <68 || new_mtu > max_mtu) +if (new_mtu <68 )return -EINVAL ; +if (new_mtu > max_mtu) { +if (strict) +return -EINVAL ; + + new_mtu = max_mtu; + } + dev->mtu = new_mtu;return 0 ; } +static int vxlan_change_mtu (struct net_device *dev,int new_mtu) +{ +struct vxlan_dev *vxlan =netdev_priv (dev); +struct vxlan_rdst *dst = &vxlan->default_dst; +struct net_device *lowerdev =__dev_get_by_index (vxlan->net, + dst->remote_ifindex); +return __vxlan_change_mtu (dev, lowerdev, dst, new_mtu, true); +} +static int egress_ipv4_tun_info (struct net_device *dev,struct sk_buff *skb,struct ip_tunnel_info *info,__be16 sport,__be16 dport)
Signature · 1 line
2.5.0
PATCH v2 3/3 vxlan, gre, geneve: Set a large MTU on ovs-created tunnel devices
In reply to David WraggPrior to 4.3, 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 value for the MTUs 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.
--- drivers/net/geneve.c | 17 +++++++++++++---- drivers/net/vxlan.c | 11 ++++++++--- include/net/ip_tunnels.h | 1 + net/ipv4/ip_gre.c | 7 +++++++ net/ipv4/ip_tunnel.c | 21 ++++++++++++++++++--- net/openvswitch/vport-vxlan.c | 2 ++ 6 files changed, 49 insertions(+), 10 deletions(-)
drivers/net/geneve.c +13 -4
@@ -1452,11 +1452,20 @@ struct net_device *geneve_dev_create_fb(struct net *net, const char *name, err =geneve_configure (net, dev, &geneve_remote_unspec,0 ,0 ,0 ,htons (dst_port), true,0 ); -if (err) { -free_netdev (dev); -return ERR_PTR (err); - } +if (err) + goto err; + +/* openvswitch users expect packet sizes to be unrestricted, +so set the largest MTU we can. */ + err =geneve_change_mtu (dev,IP_MAX_MTU ); +if (err) + goto err; +return dev; + + err: +free_netdev (dev); +return ERR_PTR (err); }EXPORT_SYMBOL_GPL (geneve_dev_create_fb);
drivers/net/vxlan.c +8 -3
@@ -2779,6 +2779,7 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev,int err;bool use_ipv6 = false;__be16 default_port = vxlan->cfg.dst_port; +struct net_device *lowerdev =NULL ; vxlan->net = src_net;
@@ -2799,9 +2800,7 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev, }if (conf->remote_ifindex) { -struct net_device *lowerdev - =__dev_get_by_index (src_net, conf->remote_ifindex); - + lowerdev =__dev_get_by_index (src_net, conf->remote_ifindex); dst->remote_ifindex = conf->remote_ifindex;if (!lowerdev) {
@@ -2825,6 +2824,12 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev, needed_headroom = lowerdev->hard_header_len; } +if (conf->mtu) { + err =__vxlan_change_mtu (dev, lowerdev, dst, conf->mtu, false); +if (err) +return err; + } +if (use_ipv6 || conf->flags &VXLAN_F_COLLECT_METADATA ) needed_headroom +=VXLAN6_HEADROOM ;else
include/net/ip_tunnels.h +1 -0
@@ -230,6 +230,7 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,int ip_tunnel_ioctl (struct net_device *dev,struct ip_tunnel_parm *p,int cmd);int ip_tunnel_encap (struct sk_buff *skb,struct ip_tunnel *t,u8 *protocol,struct flowi4 *fl4); +int __ip_tunnel_change_mtu (struct net_device *dev,int new_mtu,bool strict);int ip_tunnel_change_mtu (struct net_device *dev,int new_mtu); struct rtnl_link_stats64 *ip_tunnel_get_stats64(struct net_device *dev,
net/ipv4/ip_gre.c +7 -0
@@ -1240,6 +1240,13 @@ struct net_device *gretap_fb_dev_create(struct net *net, const char *name, err =ipgre_newlink (net, dev, tb,NULL );if (err <0 ) goto out; + +/* openvswitch users expect packet sizes to be unrestricted, +so set the largest MTU we can. */ + err =__ip_tunnel_change_mtu (dev,IP_MAX_MTU , false); +if (err) + goto out; +return dev; out:free_netdev (dev);
net/ipv4/ip_tunnel.c +18 -3
@@ -943,17 +943,32 @@ done: }EXPORT_SYMBOL_GPL (ip_tunnel_ioctl); -int ip_tunnel_change_mtu (struct net_device *dev,int new_mtu) +int __ip_tunnel_change_mtu (struct net_device *dev,int new_mtu,bool strict) {struct ip_tunnel *tunnel =netdev_priv (dev);int t_hlen = tunnel->hlen +sizeof (struct iphdr ); +int max_mtu =0xFFF8 - dev->hard_header_len - t_hlen; -if (new_mtu <68 || - new_mtu >0xFFF8 - dev->hard_header_len - t_hlen) +if (new_mtu <68 )return -EINVAL ; + +printk ("XXX %d %d\n" , new_mtu, max_mtu); +if (new_mtu > max_mtu) { +if (strict) +return -EINVAL ; + + new_mtu = max_mtu; + } + dev->mtu = new_mtu;return 0 ; } +EXPORT_SYMBOL_GPL (__ip_tunnel_change_mtu); + +int ip_tunnel_change_mtu (struct net_device *dev,int new_mtu) +{ +return __ip_tunnel_change_mtu (dev, new_mtu, true); +}EXPORT_SYMBOL_GPL (ip_tunnel_change_mtu);static void ip_tunnel_dev_free (struct net_device *dev)
net/openvswitch/vport-vxlan.c +2 -0
@@ -91,6 +91,8 @@ static struct vport *vxlan_tnl_create(const struct vport_parms *parms)struct vxlan_config conf = { .no_share = true, .flags =VXLAN_F_COLLECT_METADATA , +/* Don't restrict the packets that can be sent by MTU */ + .mtu =IP_MAX_MTU , };if (!options) {
Signature · 1 line
2.5.0