From patchwork Tue Jan 8 10:45:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 210336 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3765F2C0084 for ; Tue, 8 Jan 2013 21:53:57 +1100 (EST) Received: from localhost ([::1]:51667 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsWhO-0001KU-8G for incoming@patchwork.ozlabs.org; Tue, 08 Jan 2013 05:46:26 -0500 Received: from eggs.gnu.org ([208.118.235.92]:46723) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsWgq-0008Iq-9T for qemu-devel@nongnu.org; Tue, 08 Jan 2013 05:45:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TsWgm-0006bs-A0 for qemu-devel@nongnu.org; Tue, 08 Jan 2013 05:45:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:7887) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsWgl-0006bj-Ll for qemu-devel@nongnu.org; Tue, 08 Jan 2013 05:45:47 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r08AjiM3012284 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 8 Jan 2013 05:45:45 -0500 Received: from localhost (ovpn-112-29.ams2.redhat.com [10.36.112.29]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r08AjhiU014253; Tue, 8 Jan 2013 05:45:44 -0500 From: Stefan Hajnoczi To: Date: Tue, 8 Jan 2013 11:45:36 +0100 Message-Id: <1357641939-20030-2-git-send-email-stefanha@redhat.com> In-Reply-To: <1357641939-20030-1-git-send-email-stefanha@redhat.com> References: <1357641939-20030-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Michael Contreras , Anthony Liguori , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 1/4] e1000: Discard oversized packets based on SBP|LPE X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@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 --- hw/e1000.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/e1000.c b/hw/e1000.c index 92fb00a..8fd1654 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; }