From: "Ed Swierk" <eswierk@arastra.com>
To: netdev@vger.kernel.org, maxk@qualcomm.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] Configurable tap interface MTU
Date: Tue, 11 Sep 2007 07:42:46 -0700 [thread overview]
Message-ID: <e6c711510709110742v4d2da644ha63b0a6d47c1230b@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 422 bytes --]
This patch makes it possible to change the MTU on a tap interface.
Increasing the MTU beyond the 1500-byte default is useful for
applications that interoperate with Ethernet devices supporting jumbo
frames.
The patch caps the MTU somewhat arbitrarily at 16000 bytes. This is
slightly lower than the value used by the e1000 driver, so it seems
like a safe upper limit.
Signed-off-by: Ed Swierk <eswierk@arastra.com>
---
[-- Attachment #2: tap-change-mtu.patch --]
[-- Type: application/octet-stream, Size: 931 bytes --]
Index: linux-2.6.22.6/drivers/net/tun.c
===================================================================
--- linux-2.6.22.6.orig/drivers/net/tun.c
+++ linux-2.6.22.6/drivers/net/tun.c
@@ -171,6 +171,18 @@ tun_net_mclist(struct net_device *dev)
}
}
+#define MIN_MTU 68
+#define MAX_MTU 16000
+
+static int
+tun_net_change_mtu(struct net_device *dev, int new_mtu)
+{
+ if (new_mtu < MIN_MTU || new_mtu > MAX_MTU)
+ return -EINVAL;
+ dev->mtu = new_mtu;
+ return 0;
+}
+
static struct net_device_stats *tun_net_stats(struct net_device *dev)
{
struct tun_struct *tun = netdev_priv(dev);
@@ -200,6 +212,7 @@ static void tun_net_init(struct net_devi
dev->set_multicast_list = tun_net_mclist;
ether_setup(dev);
+ dev->change_mtu = tun_net_change_mtu;
/* random address already created for us by tun_set_iff, use it */
memcpy(dev->dev_addr, tun->dev_addr, min(sizeof(tun->dev_addr), sizeof(dev->dev_addr)) );
next reply other threads:[~2007-09-11 14:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-11 14:42 Ed Swierk [this message]
2007-09-11 17:20 ` Rick Jones
2007-09-12 3:29 ` Herbert Xu
2007-09-12 16:54 ` Ed Swierk
2007-09-16 19:22 ` David Miller
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=e6c711510709110742v4d2da644ha63b0a6d47c1230b@mail.gmail.com \
--to=eswierk@arastra.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maxk@qualcomm.com \
--cc=netdev@vger.kernel.org \
/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
all inboxes | Powered by JetHome®