From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49305) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvWGx-0004Lb-OC for qemu-devel@nongnu.org; Wed, 16 Jan 2013 11:55:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TvWGp-00073I-Po for qemu-devel@nongnu.org; Wed, 16 Jan 2013 11:55:31 -0500 Sender: fluxion From: Michael Roth Date: Wed, 16 Jan 2013 10:49:16 -0600 Message-Id: <1358354963-9070-15-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1358354963-9070-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1358354963-9070-1-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 14/21] e1000: Discard oversized packets based on SBP|LPE List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, qemu-stable@nongnu.org From: Michael Contreras Discard packets longer than 16384 when !SBP to match the hardware behavior. Signed-off-by: Michael Contreras Signed-off-by: Stefan Hajnoczi (cherry picked from commit 2c0331f4f7d241995452b99afaf0aab00493334a) Signed-off-by: Michael Roth --- hw/e1000.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/e1000.c b/hw/e1000.c index 5537ad2..e772c8e 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: @@ -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; } -- 1.7.9.5