[ovs-dev] [PATCHv2 2/6] datapath: geneve: Relax MTU constraints.

Joe Stringer joe at ovn.org
Fri Feb 19 18:44:37 UTC 2016


From: David Wragg <david at weave.works>

Upstream commit:
    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.

    Signed-off-by: David Wragg <david at weave.works>
    Signed-off-by: David S. Miller <davem at davemloft.net>

Upstream: 55e5bfb53cff ("geneve: Relax MTU constraints")
Signed-off-by: Joe Stringer <joe at ovn.org>
---
 datapath/linux/compat/geneve.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/datapath/linux/compat/geneve.c b/datapath/linux/compat/geneve.c
index 297593ce6e1a..29a65a0a49d2 100644
--- a/datapath/linux/compat/geneve.c
+++ b/datapath/linux/compat/geneve.c
@@ -742,6 +742,17 @@ static netdev_tx_t geneve_dev_xmit(struct sk_buff *skb, struct net_device *dev)
 	return NETDEV_TX_OK;
 }
 
+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 const struct net_device_ops geneve_netdev_ops = {
 #ifdef HAVE_DEV_TSTATS
 	.ndo_init		= geneve_init,
@@ -751,7 +762,7 @@ static const struct net_device_ops geneve_netdev_ops = {
 	.ndo_open		= geneve_open,
 	.ndo_stop		= geneve_stop,
 	.ndo_start_xmit		= geneve_dev_xmit,
-	.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,
 };
-- 
2.1.4




More information about the dev mailing list