[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251127131521.2580237-3-mika.westerberg@linux.intel.com>
Date: Thu, 27 Nov 2025 14:15:20 +0100
From: Mika Westerberg <mika.westerberg@...ux.intel.com>
To: netdev@...r.kernel.org
Cc: Yehezkel Bernat <YehezkelShB@...il.com>,
Ian MacDonald <ian@...statz.com>,
Salvatore Bonaccorso <carnil@...ian.org>,
Andrew Lunn <andrew+netdev@...n.ch>,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Mika Westerberg <mika.westerberg@...ux.intel.com>
Subject: [PATCH net-next 2/3] net: thunderbolt: Allow changing MTU of the device
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 <mika.westerberg@...ux.intel.com>
---
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
Powered by blists - more mailing lists