In some cases it is useful to be able to use different MTU than the default one. Especially when dealing against non-Linux networking stack. For this reason add possibility to change the MTU of the device. Signed-off-by: Mika Westerberg --- drivers/net/thunderbolt/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/thunderbolt/main.c b/drivers/net/thunderbolt/main.c index 57b226afeb84..20bac55a3e20 100644 --- a/drivers/net/thunderbolt/main.c +++ b/drivers/net/thunderbolt/main.c @@ -1257,12 +1257,23 @@ static void tbnet_get_stats64(struct net_device *dev, stats->rx_missed_errors = net->stats.rx_missed_errors; } +static int tbnet_change_mtu(struct net_device *dev, int new_mtu) +{ + /* Keep the MTU within supported range */ + if (new_mtu < 68 || new_mtu > (TBNET_MAX_MTU - ETH_HLEN)) + return -EINVAL; + + dev->mtu = new_mtu; + return 0; +} + static const struct net_device_ops tbnet_netdev_ops = { .ndo_open = tbnet_open, .ndo_stop = tbnet_stop, .ndo_start_xmit = tbnet_start_xmit, .ndo_set_mac_address = eth_mac_addr, .ndo_get_stats64 = tbnet_get_stats64, + .ndo_change_mtu = tbnet_change_mtu, }; static void tbnet_generate_mac(struct net_device *dev) -- 2.50.1