From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: netdev@vger.kernel.org
Cc: Yehezkel Bernat <YehezkelShB@gmail.com>,
Ian MacDonald <ian@netstatz.com>,
Salvatore Bonaccorso <carnil@debian.org>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Jay Vosburgh <jv@jvosburgh.net>,
Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: [PATCH net-next v2 2/5] net: thunderbolt: Allow changing MTU of the device
Date: Mon, 15 Dec 2025 13:11:06 +0100 [thread overview]
Message-ID: <20251215121109.4042218-3-mika.westerberg@linux.intel.com> (raw)
In-Reply-To: <20251215121109.4042218-1-mika.westerberg@linux.intel.com>
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@linux.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
next prev parent reply other threads:[~2025-12-15 12:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-15 12:11 [PATCH net-next v2 0/5] net: thunderbolt: Various improvements Mika Westerberg
2025-12-15 12:11 ` [PATCH net-next v2 1/5] net: thunderbolt: Allow changing MAC address of the device Mika Westerberg
2025-12-15 12:11 ` Mika Westerberg [this message]
2025-12-15 12:11 ` [PATCH net-next v2 3/5] net: ethtool: Add define for SPEED_80000 Mika Westerberg
2025-12-15 12:11 ` [PATCH net-next v2 4/5] bonding: 3ad: Add support " Mika Westerberg
2025-12-15 12:11 ` [PATCH net-next v2 5/5] net: thunderbolt: Allow reading link settings Mika Westerberg
2025-12-15 14:46 ` [PATCH net-next v2 0/5] net: thunderbolt: Various improvements Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251215121109.4042218-3-mika.westerberg@linux.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=YehezkelShB@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=carnil@debian.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=ian@netstatz.com \
--cc=jv@jvosburgh.net \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).