diff options
author | Mark McLoughlin <markmc@redhat.com> | 2008-11-26 08:58:11 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2008-12-02 06:42:49 -0500 |
commit | 39da5814db81e8fe9782ae5ea24c0fdfcf2adc96 (patch) | |
tree | 3483a6cc7af96d5cb5f1215afe3e67f4b80336cc /drivers/net | |
parent | 6976a1d6c222c50ac93d2273b9cf57e6fd047e59 (diff) |
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 'drivers/net')
-rw-r--r-- | drivers/net/virtio_net.c | 12 |
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 = { | |||
613 | .set_tso = ethtool_op_set_tso, | 613 | .set_tso = ethtool_op_set_tso, |
614 | }; | 614 | }; |
615 | 615 | ||
616 | #define MIN_MTU 68 | ||
617 | #define MAX_MTU 65535 | ||
618 | |||
619 | static int virtnet_change_mtu(struct net_device *dev, int new_mtu) | ||
620 | { | ||
621 | if (new_mtu < MIN_MTU || new_mtu > MAX_MTU) | ||
622 | return -EINVAL; | ||
623 | dev->mtu = new_mtu; | ||
624 | return 0; | ||
625 | } | ||
626 | |||
616 | static int virtnet_probe(struct virtio_device *vdev) | 627 | static int virtnet_probe(struct virtio_device *vdev) |
617 | { | 628 | { |
618 | int err; | 629 | int err; |
@@ -628,6 +639,7 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
628 | dev->open = virtnet_open; | 639 | dev->open = virtnet_open; |
629 | dev->stop = virtnet_close; | 640 | dev->stop = virtnet_close; |
630 | dev->hard_start_xmit = start_xmit; | 641 | dev->hard_start_xmit = start_xmit; |
642 | dev->change_mtu = virtnet_change_mtu; | ||
631 | dev->features = NETIF_F_HIGHDMA; | 643 | dev->features = NETIF_F_HIGHDMA; |
632 | #ifdef CONFIG_NET_POLL_CONTROLLER | 644 | #ifdef CONFIG_NET_POLL_CONTROLLER |
633 | dev->poll_controller = virtnet_netpoll; | 645 | dev->poll_controller = virtnet_netpoll; |