1
From: Michael Contreras <michael@inetric.com>
2
Date: Mon, 3 Dec 2012 04:11:22 +0000 (-0800)
3
Subject: e1000: Discard packets that are too long if !SBP and !LPE
5
X-Git-Url: http://git.qemu.org/?p=qemu.git;a=commitdiff_plain;h=b0d9ffcd0251161c7c92f94804dcf599dfa3edeb
7
e1000: Discard packets that are too long if !SBP and !LPE
9
The e1000_receive function for the e1000 needs to discard packets longer than
10
1522 bytes if the SBP and LPE flags are disabled. The linux driver assumes
11
this behavior and allocates memory based on this assumption.
13
Signed-off-by: Michael Contreras <michael@inetric.com>
14
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
17
Index: xen-4.1.2/qemu/hw/e1000.c
18
===================================================================
19
--- xen-4.1.2.orig/qemu/hw/e1000.c 2011-04-28 09:38:36.000000000 +0200
20
+++ xen-4.1.2/qemu/hw/e1000.c 2013-01-07 18:58:08.762854040 +0100
21
@@ -55,6 +55,9 @@ static int debugflags = DBGBIT(TXERR) |
22
#define REG_IOADDR 0x0
23
#define REG_IODATA 0x4
25
+/* this is the size past which hardware will drop packets when setting LPE=0 */
26
+#define MAXIMUM_ETHERNET_VLAN_SIZE 1522
30
* E1000_DEV_ID_82540EM works with Windows and Linux
31
@@ -625,6 +628,13 @@ e1000_receive(void *opaque, const uint8_
35
+ /* Discard oversized packets if !LPE and !SBP. */
36
+ if (size > MAXIMUM_ETHERNET_VLAN_SIZE
37
+ && !(s->mac_reg[RCTL] & E1000_RCTL_LPE)
38
+ && !(s->mac_reg[RCTL] & E1000_RCTL_SBP)) {
42
if (!receive_filter(s, buf, size))