Skip to contentSkip to conversation

virtio_net: Fix MAX_PACKET_LEN to support 802.1Q VLANs

PATCH In review Alex Williamson 3 participants 3 messages Jan 20, 2009 – Jan 26, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio_net: Fix MAX_PACKET_LEN to support 802.1Q VLANs

802.1Q expanded the maximum ethernet frame size by 4 bytes for the VLAN tag. We're not taking this into account in virtio_net, which means the buffers we provide to the backend in the virtqueue RX ring aren't big enough to hold a full MTU VLAN packet. For QEMU/KVM, this results in the backend exiting with a packet truncation error.

---

 drivers/net/virtio_net.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/virtio_net.c +2 -1
index 43f6523..63ef2a8 100644
@@ -24,6 +24,7 @@
 #include <linux/virtio.h>
 #include <linux/virtio_net.h>
 #include <linux/scatterlist.h>
+#include <linux/if_vlan.h>
 
 static int napi_weight = 128;
 module_param(napi_weight, int, 0444);
@@ -33,7 +34,7 @@ module_param(csum, bool, 0444);
 module_param(gso, bool, 0444);
 
 /* FIXME: MTU in config. */
-#define MAX_PACKET_LEN (ETH_HLEN+ETH_DATA_LEN)
+#define MAX_PACKET_LEN (ETH_HLEN + VLAN_HLEN + ETH_DATA_LEN)
 #define GOOD_COPY_LEN	128
 
 struct virtnet_info
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Alex Williamson

802.1Q expanded the maximum ethernet frame size by 4 bytes for the VLAN tag. We're not taking this into account in virtio_net, which means the buffers we provide to the backend in the virtqueue RX ring aren't big enough to hold a full MTU VLAN packet. For QEMU/KVM, this results in the backend exiting with a packet truncation error.

Note 1: this only matters if the guest isn't using mergeable receive buffers or GSO

Note 2: IMHO, this should go in 2.6.29 and stable

Cheers,
Mark.

maintainer
#2 lore raw

From: Mark McLoughlin <[email protected]>
Date: Tue, 20 Jan 2009 16:59:26 +0000

Quoted 8 lines · Alex Williamson
Quoted 7 lines

802.1Q expanded the maximum ethernet frame size by 4 bytes for the VLAN tag. We're not taking this into account in virtio_net, which means the buffers we provide to the backend in the virtqueue RX ring aren't big enough to hold a full MTU VLAN packet. For QEMU/KVM, this results in the backend exiting with a packet truncation error.

Quoted 8 lines
Quoted 1 line

Note 1: this only matters if the guest isn't using mergeable receive buffers or GSO

Note 2: IMHO, this should go in 2.6.29 and stable

Applied and queued up for -stable, thanks everyone!