Skip to content

Commit

Permalink
datapath: stt: Relax MTU constraints.
Browse files Browse the repository at this point in the history
Currently, even if the entire path supports jumbo frames, the STT netdev
limits the path MTU to 1500 bytes, and cannot be configured otherwise.
Relax the constraints on modifying the device MTU, and set it to the
maximum by default.

Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Jesse Gross <jesse@kernel.org>
  • Loading branch information
joestringer committed Feb 19, 2016
1 parent 917b3b4 commit 3a93413
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion datapath/linux/compat/stt.c
Expand Up @@ -1683,14 +1683,38 @@ static int stt_stop(struct net_device *dev)
return 0;
}

static int __stt_change_mtu(struct net_device *dev, int new_mtu, bool strict)
{
int max_mtu = IP_MAX_MTU - STT_HEADER_LEN - sizeof(struct iphdr)
- dev->hard_header_len;

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 stt_change_mtu(struct net_device *dev, int new_mtu)
{
return __stt_change_mtu(dev, new_mtu, true);
}

static const struct net_device_ops stt_netdev_ops = {
.ndo_init = stt_init,
.ndo_uninit = stt_uninit,
.ndo_open = stt_open,
.ndo_stop = stt_stop,
.ndo_start_xmit = stt_dev_xmit,
.ndo_get_stats64 = ip_tunnel_get_stats64,
.ndo_change_mtu = eth_change_mtu,
.ndo_change_mtu = stt_change_mtu,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = eth_mac_addr,
};
Expand Down Expand Up @@ -1782,6 +1806,10 @@ static int stt_configure(struct net *net, struct net_device *dev,
if (find_dev(net, dst_port))
return -EBUSY;

err = __stt_change_mtu(dev, IP_MAX_MTU, false);
if (err)
return err;

err = register_netdevice(dev);
if (err)
return err;
Expand Down

0 comments on commit 3a93413

Please sign in to comment.