From: "Michael S. Tsirkin" <mst@redhat.com>
To: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
Anthony Liguori <anthony@codemonkey.ws>
Cc: 638955@bugs.launchpad.net, qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH] e1000: Pad short frames to minimum size (60 bytes)
Date: Mon, 20 Sep 2010 19:52:12 +0200 [thread overview]
Message-ID: <20100920175212.GB30611@redhat.com> (raw)
In-Reply-To: <1284842625-13920-1-git-send-email-stefanha@linux.vnet.ibm.com>
On Sat, Sep 18, 2010 at 09:43:45PM +0100, Stefan Hajnoczi wrote:
> The OpenIndiana (Solaris) e1000g driver drops frames that are too long
> or too short. It expects to receive frames of at least the Ethernet
> minimum size. ARP requests in particular are small and will be dropped
> if they are not padded appropriately, preventing a Solaris VM from
> becoming visible on the network.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
I'll put this patch on my tree: let's be consistent and fix e1000,
it is also a good approach for 0.13 I think.
Anthony - could you pick this up for 0.13 please?
If someone wants to then strip it off from all devices and tweak, it can
be done.
> ---
> hw/e1000.c | 10 ++++++++++
> 1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/hw/e1000.c b/hw/e1000.c
> index 7d7d140..bc983f9 100644
> --- a/hw/e1000.c
> +++ b/hw/e1000.c
> @@ -55,6 +55,7 @@ static int debugflags = DBGBIT(TXERR) | DBGBIT(GENERAL);
>
> #define IOPORT_SIZE 0x40
> #define PNPMMIO_SIZE 0x20000
> +#define MIN_BUF_SIZE 60
>
> /*
> * HW models:
> @@ -635,10 +636,19 @@ e1000_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
> uint32_t rdh_start;
> uint16_t vlan_special = 0;
> uint8_t vlan_status = 0, vlan_offset = 0;
> + uint8_t min_buf[MIN_BUF_SIZE];
>
> if (!(s->mac_reg[RCTL] & E1000_RCTL_EN))
> return -1;
>
> + /* Pad to minimum Ethernet frame length */
> + if (size < sizeof(min_buf)) {
> + memcpy(min_buf, buf, size);
> + memset(&min_buf[size], 0, sizeof(min_buf) - size);
> + buf = min_buf;
> + size = sizeof(min_buf);
> + }
> +
> if (size > s->rxbuf_size) {
> DBGOUT(RX, "packet too large for buffers (%lu > %d)\n",
> (unsigned long)size, s->rxbuf_size);
> --
> 1.7.1
>
next prev parent reply other threads:[~2010-09-20 17:58 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-18 20:43 [Qemu-devel] [PATCH] e1000: Pad short frames to minimum size (60 bytes) Stefan Hajnoczi
2010-09-18 20:57 ` Hervé Poussineau
2010-09-18 21:12 ` Stefan Hajnoczi
2010-09-20 8:42 ` Kevin Wolf
2010-09-20 8:51 ` Edgar E. Iglesias
2010-09-20 9:13 ` Stefan Hajnoczi
2010-09-18 21:27 ` Edgar E. Iglesias
2010-09-19 6:36 ` Stefan Hajnoczi
2010-09-19 11:18 ` Michael S. Tsirkin
2010-09-19 12:04 ` Edgar E. Iglesias
2010-09-19 12:03 ` Michael S. Tsirkin
2010-09-20 8:50 ` Kevin Wolf
2010-09-20 9:03 ` Edgar E. Iglesias
2010-09-20 9:34 ` Stefan Hajnoczi
2010-09-20 10:42 ` Michael S. Tsirkin
2010-09-20 20:31 ` Anthony Liguori
2010-09-20 20:35 ` Michael S. Tsirkin
2010-09-20 20:40 ` Edgar E. Iglesias
2010-09-20 20:44 ` Michael S. Tsirkin
2010-09-20 20:51 ` [Bug 638955] " Edgar E. Iglesias
2010-09-21 9:17 ` Michael S. Tsirkin
2010-09-21 9:21 ` Edgar E. Iglesias
2010-09-21 9:16 ` [Bug 638955] " Stefan Hajnoczi
2011-02-21 21:13 ` [Qemu-devel] " Stefan Weil
2010-09-20 17:52 ` Michael S. Tsirkin [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-09-15 13:29 [Qemu-devel] [Bug 638955] [NEW] emulated netcards don't work with recent sunos kernel daniel pecka
2010-09-17 8:47 ` [Qemu-devel] [Bug 638955] " daniel pecka
2010-09-17 15:52 ` daniel pecka
2010-09-20 8:02 ` daniel pecka
2010-09-20 9:47 ` Stefan Hajnoczi
2010-09-20 20:57 ` [Bug 638955] Re: [Qemu-devel] [PATCH] e1000: Pad short frames to minimum size (60 bytes) Anthony Liguori
2010-09-20 21:02 ` Edgar E. Iglesias
2010-09-21 8:49 ` [Qemu-devel] [Bug 638955] Re: emulated netcards don't work with recent sunos kernel daniel pecka
2010-10-02 19:23 ` daniel pecka
2010-10-12 14:40 ` [Qemu-devel] " Stefan Hajnoczi
2011-01-03 13:40 ` [Qemu-devel] " daniel pecka
2011-01-04 9:36 ` [Qemu-devel] " Stefan Hajnoczi
2011-01-04 10:04 ` [Qemu-devel] " daniel pecka
2011-01-04 17:51 ` Stefan Weil
2011-01-29 17:41 ` Daniel Kvasnicka
2011-02-28 19:06 ` geppz
2011-03-01 9:50 ` [Qemu-devel] " Stefan Hajnoczi
2011-03-01 15:14 ` [Qemu-devel] " geppz
2011-03-05 20:14 ` Stefan Hajnoczi
2011-03-06 12:32 ` Stefan Hajnoczi
2011-03-07 18:43 ` geppz
2014-10-05 20:57 ` dblade
2014-10-06 8:53 ` Stefan Hajnoczi
2014-10-07 1:46 ` dblade
2015-09-08 22:14 ` Jan Vlug
2015-09-10 19:44 ` Jan Vlug
2016-08-12 4:58 ` T. Huth
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=20100920175212.GB30611@redhat.com \
--to=mst@redhat.com \
--cc=638955@bugs.launchpad.net \
--cc=anthony@codemonkey.ws \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.