virtio_net: enable big packets for large MTU values
authorMichael S. Tsirkin <mst@redhat.com>
Wed, 8 Mar 2017 00:14:25 +0000 (02:14 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 7 Apr 2017 13:38:59 +0000 (16:38 +0300)
If one enables e.g. jumbo frames without mergeable
buffers, packets won't fit in 1500 byte buffers
we use. Switch to big packet mode instead.
TODO: make sizing more exact, possibly extend small
packet mode to use larger pages.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/net/virtio_net.c

index ea9890d619670e1abfba75fe608c2925d824cb1c..006f1a6031029392476eb9995c5e9dc69e24ccea 100644 (file)
@@ -2367,6 +2367,10 @@ static int virtnet_probe(struct virtio_device *vdev)
                        dev->mtu = mtu;
                        dev->max_mtu = mtu;
                }
+
+               /* TODO: size buffers correctly in this case. */
+               if (dev->mtu > ETH_DATA_LEN)
+                       vi->big_packets = true;
        }
 
        if (vi->any_header_sg)