From d7feb4bb75432ae7134ae12b375919a2503bd270 Mon Sep 17 00:00:00 2001 Message-Id: <d7feb4bb75432ae7134ae12b375919a2503bd270.1361968543.git.minovotn@redhat.com> In-Reply-To: <70ddcf214d647fcdc7158d5a4f0fc3b3f7a6caee.1361968543.git.minovotn@redhat.com> References: <70ddcf214d647fcdc7158d5a4f0fc3b3f7a6caee.1361968543.git.minovotn@redhat.com> From: Vlad Yasevich <vyasevic@redhat.com> Date: Thu, 14 Feb 2013 21:39:16 +0100 Subject: [PATCH 2/2] e1000: Discard oversized packets based on SBP|LPE RH-Author: Vlad Yasevich <vyasevic@redhat.com> Message-id: <1360877956-21999-3-git-send-email-vyasevic@redhat.com> Patchwork-id: 48528 O-Subject: [RHEL-5.10 kvm PATCH 2/2] e1000: Discard oversized packets based on SBP|LPE Bugzilla: 910840 RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com> RH-Acked-by: Amos Kong <akong@redhat.com> RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com> RH-Acked-by: Petr Matousek <pmatouse@redhat.com> From: Michael Contreras <michael@inetric.com> 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> (manually cherry-picked from 2c0331f4f7d241995452b99afaf0aab00493334a) Signed-off-by: Vlad Yasevich <vyasevic@redhat.com> --- qemu/hw/e1000.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) Signed-off-by: Michal Novotny <minovotn@redhat.com> --- qemu/hw/e1000.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/qemu/hw/e1000.c b/qemu/hw/e1000.c index a3feb93..2739b4d 100644 --- a/qemu/hw/e1000.c +++ b/qemu/hw/e1000.c @@ -65,6 +65,8 @@ enum { E1000_DEVID = E1000_DEV_ID_82540EM }; /* 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 /* * May need to specify additional MAC-to-PHY entries -- @@ -656,8 +658,9 @@ e1000_receive(void *opaque, const uint8_t *buf, int size) return; /* 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; } -- 1.7.11.7