summaryrefslogtreecommitdiffstats
path: root/drivers/net/virtio_net.c
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2008-11-26 14:58:11 +0100
committerRusty Russell <rusty@rustcorp.com.au>2008-12-02 12:42:49 +0100
commit39da5814db81e8fe9782ae5ea24c0fdfcf2adc96 (patch)
tree3483a6cc7af96d5cb5f1215afe3e67f4b80336cc /drivers/net/virtio_net.c
parentnet: percpu_counter_inc() should not be called in BH-disabled section (diff)
downloadlinux-39da5814db81e8fe9782ae5ea24c0fdfcf2adc96.tar.xz
linux-39da5814db81e8fe9782ae5ea24c0fdfcf2adc96.zip
virtio_net: large tx MTU support
We don't really have a max tx packet size limit, so allow configuring the device with up to 64k tx MTU. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to '')
-rw-r--r--drivers/net/virtio_net.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index e6b5d6ef9ea8..71ca29cc184d 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -613,6 +613,17 @@ static struct ethtool_ops virtnet_ethtool_ops = {
.set_tso = ethtool_op_set_tso,
};
+#define MIN_MTU 68
+#define MAX_MTU 65535
+
+static int virtnet_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 int virtnet_probe(struct virtio_device *vdev)
{
int err;
@@ -628,6 +639,7 @@ static int virtnet_probe(struct virtio_device *vdev)
dev->open = virtnet_open;
dev->stop = virtnet_close;
dev->hard_start_xmit = start_xmit;
+ dev->change_mtu = virtnet_change_mtu;
dev->features = NETIF_F_HIGHDMA;
#ifdef CONFIG_NET_POLL_CONTROLLER
dev->poll_controller = virtnet_netpoll;