From 3774237baadb1647f91b3c24a99b9d3cd4904159 Mon Sep 17 00:00:00 2001 Message-Id: <3774237baadb1647f91b3c24a99b9d3cd4904159.1361183855.git.minovotn@redhat.com> In-Reply-To: <8a5181c3fa0b1efb69153485808afcb612d0aa60.1361183855.git.minovotn@redhat.com> References: <8a5181c3fa0b1efb69153485808afcb612d0aa60.1361183855.git.minovotn@redhat.com> From: Vlad Yasevich Date: Thu, 14 Feb 2013 22:48:26 +0100 Subject: [PATCH 5/5] e1000: Discard oversized packets based on SBP|LPE RH-Author: Vlad Yasevich Message-id: <1360882106-11660-3-git-send-email-vyasevic@redhat.com> Patchwork-id: 48530 O-Subject: [RHEL-6.5 kvm PATCH 2/2] e1000: Discard oversized packets based on SBP|LPE Bugzilla: 910842 RH-Acked-by: Paolo Bonzini RH-Acked-by: Amos Kong RH-Acked-by: Stefan Hajnoczi RH-Acked-by: Petr Matousek 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 2c0331f4f7d241995452b99afaf0aab00493334a) Signed-off-by: Vlad Yasevich --- hw/e1000.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) Signed-off-by: Michal Novotny --- hw/e1000.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/e1000.c b/hw/e1000.c index e9ed1aa..f1665a4 100644 --- a/hw/e1000.c +++ b/hw/e1000.c @@ -57,6 +57,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: @@ -778,8 +780,9 @@ e1000_receive(VLANClientState *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.11.7