]> xenbits.xensource.com Git - qemu-upstream-4.6-testing.git/commitdiff
e1000: Discard oversized packets based on SBP|LPE
authorMichael Contreras <michael@inetric.com>
Wed, 5 Dec 2012 18:31:30 +0000 (13:31 -0500)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Wed, 16 Jan 2013 04:37:17 +0000 (22:37 -0600)
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)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/e1000.c

index 5537ad2fc406446881caf1fa267b542d3e59bbfd..e772c8e3f64a68788328867b141c470e884b776e 100644 (file)
@@ -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:
@@ -809,8 +811,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;
     }