aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Contreras <michael@inetric.com>2012-12-05 13:31:30 -0500
committerDoug Goldstein <cardoe@cardoe.com>2013-01-18 21:02:08 -0600
commitb939b4497b3be038374cbae0bb0f3114de2bb771 (patch)
tree0e12c41c29cbdf0c989b838265aa68d8529076cb
parentbuffered_file: do not send more than s->bytes_xfer bytes per tick (diff)
downloadqemu-kvm-b939b4497b3be038374cbae0bb0f3114de2bb771.tar.gz
qemu-kvm-b939b4497b3be038374cbae0bb0f3114de2bb771.tar.bz2
qemu-kvm-b939b4497b3be038374cbae0bb0f3114de2bb771.zip
e1000: Discard oversized packets based on SBP|LPE
Discard packets longer than 16384 when !SBP to match the hardware behavior. Signed-off-by: Michael Contreras <michael@inetric.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> (cherry picked from commit 2c0331f4f7d241995452b99afaf0aab00493334a)
-rw-r--r--hw/e1000.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/hw/e1000.c b/hw/e1000.c
index b1d850888..fa3d4dc54 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -61,6 +61,8 @@ static int debugflags = DBGBIT(TXERR) | DBGBIT(GENERAL);
/* this is the size past which hardware will drop packets when setting LPE=0 */
#define MAXIMUM_ETHERNET_VLAN_SIZE 1522
+/* this is the size past which hardware will drop packets when setting LPE=1 */
+#define MAXIMUM_ETHERNET_LPE_SIZE 16384
/*
* HW models:
@@ -799,8 +801,9 @@ e1000_receive(NetClientState *nc, const uint8_t *buf, size_t size)
}
/* Discard oversized packets if !LPE and !SBP. */
- if (size > MAXIMUM_ETHERNET_VLAN_SIZE
- && !(s->mac_reg[RCTL] & E1000_RCTL_LPE)
+ if ((size > MAXIMUM_ETHERNET_LPE_SIZE ||
+ (size > MAXIMUM_ETHERNET_VLAN_SIZE
+ && !(s->mac_reg[RCTL] & E1000_RCTL_LPE)))
&& !(s->mac_reg[RCTL] & E1000_RCTL_SBP)) {
return size;
}