Skip to contentSkip to conversation

virtio_net: enable big packets for large MTU values

PATCH In review Michael S. Tsirkin 2 participants 3 messages Mar 29, 2017 – Mar 30, 2017

Subsystems (4)
lore
Share & tools
lore

Michael S. Tsirkin

author maintainer
#0 lore raw

PATCH 1/1 virtio_net: enable big packets for large MTU values

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.

---
 drivers/net/virtio_net.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/virtio_net.c +4 -0
index e0fb3707..9dc31dc 100644
@@ -2428,6 +2428,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)
Signature · 1 line
MST
author maintainer
#1 lore raw
Quoted 7 lines · Michael S. Tsirkin

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.

Fixes 14de9d114a82 ("virtio-net: Add initial MTU advice feature")
Quoted 21 lines
---
 drivers/net/virtio_net.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/virtio_net.c +4 -0
index e0fb3707..9dc31dc 100644
@@ -2428,6 +2428,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)
Signature · 1 line
MST
#2 lore raw
In reply to Michael S. Tsirkin
Quoted 16 lines · Michael S. Tsirkin

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.

---
  drivers/net/virtio_net.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/net/virtio_net.c +0 -0
index e0fb3707..9dc31dc 100644

drivers/net/virtio_net.c static int virtnet_probe(struct virtio_device *vdev) · line 2437

Quoted 10 lines
drivers/net/virtio_net.c +4 -0
@@ -2428,6 +2428,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)

Ok, I think maybe we should fail the probe of small buffer in this case and decrease the max_mtu to ETH_DATA_LEN if small buffer is used (since user are allowed to increase the mtu).

Thanks
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization