Commit e918085aaff34086e265f825dd469926b1aec4a4

Authored by Alex Williamson
Committed by David S. Miller
1 parent 801599b0cd

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.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
Acked-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 2 additions and 1 deletions Side-by-side Diff

drivers/net/virtio_net.c
... ... @@ -24,6 +24,7 @@
24 24 #include <linux/virtio.h>
25 25 #include <linux/virtio_net.h>
26 26 #include <linux/scatterlist.h>
  27 +#include <linux/if_vlan.h>
27 28  
28 29 static int napi_weight = 128;
29 30 module_param(napi_weight, int, 0444);
... ... @@ -33,7 +34,7 @@
33 34 module_param(gso, bool, 0444);
34 35  
35 36 /* FIXME: MTU in config. */
36   -#define MAX_PACKET_LEN (ETH_HLEN+ETH_DATA_LEN)
  37 +#define MAX_PACKET_LEN (ETH_HLEN + VLAN_HLEN + ETH_DATA_LEN)
37 38 #define GOOD_COPY_LEN 128
38 39  
39 40 struct virtnet_info