Commit 39da5814 authored by Mark McLoughlin's avatar Mark McLoughlin Committed by Rusty Russell

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: default avatarMark McLoughlin <markmc@redhat.com>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 6976a1d6
...@@ -613,6 +613,17 @@ static struct ethtool_ops virtnet_ethtool_ops = { ...@@ -613,6 +613,17 @@ static struct ethtool_ops virtnet_ethtool_ops = {
.set_tso = ethtool_op_set_tso, .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) static int virtnet_probe(struct virtio_device *vdev)
{ {
int err; int err;
...@@ -628,6 +639,7 @@ static int virtnet_probe(struct virtio_device *vdev) ...@@ -628,6 +639,7 @@ static int virtnet_probe(struct virtio_device *vdev)
dev->open = virtnet_open; dev->open = virtnet_open;
dev->stop = virtnet_close; dev->stop = virtnet_close;
dev->hard_start_xmit = start_xmit; dev->hard_start_xmit = start_xmit;
dev->change_mtu = virtnet_change_mtu;
dev->features = NETIF_F_HIGHDMA; dev->features = NETIF_F_HIGHDMA;
#ifdef CONFIG_NET_POLL_CONTROLLER #ifdef CONFIG_NET_POLL_CONTROLLER
dev->poll_controller = virtnet_netpoll; dev->poll_controller = virtnet_netpoll;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment