qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Contreras <michael@inetric.com>
To: qemu-devel@nongnu.org
Cc: Michael Contreras <michael@inetric.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Andreas Faerber <afaerber@suse.de>,
	Anthony Liguori <anthony@codemonkey.ws>
Subject: [Qemu-devel] [PATCH] e1000: Discard oversized packets based on SBP|LPE
Date: Wed, 5 Dec 2012 13:31:30 -0500	[thread overview]
Message-ID: <20121205183130.GA26052@inetric.com> (raw)
In-Reply-To: <20121205121317.GC6887@stefanha-thinkpad.redhat.com>

Discard packets longer than 16384 when !SBP to match the hardware behavior.

Signed-off-by: Michael Contreras <michael@inetric.com>
---
 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.8.0.1

       reply	other threads:[~2012-12-05 18:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20121205121317.GC6887@stefanha-thinkpad.redhat.com>
2012-12-05 18:31 ` Michael Contreras [this message]
2012-12-18 13:44   ` [Qemu-devel] [PATCH] e1000: Discard oversized packets based on SBP|LPE Stefan Hajnoczi
2012-12-18 16:20     ` Michael Tokarev
2012-12-18 16:49       ` Stefan Hajnoczi
2012-12-18 17:34         ` Michael Contreras
2012-12-19 11:42           ` Stefan Hajnoczi
2012-12-30  8:29           ` Michael Tokarev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121205183130.GA26052@inetric.com \
    --to=michael@inetric.com \
    --cc=afaerber@suse.de \
    --cc=anthony@codemonkey.ws \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).