From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=59278 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oxkd5-0003ce-Mp for qemu-devel@nongnu.org; Mon, 20 Sep 2010 13:58:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oxkd4-0003rz-EL for qemu-devel@nongnu.org; Mon, 20 Sep 2010 13:58:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:15854) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oxkd4-0003ru-6D for qemu-devel@nongnu.org; Mon, 20 Sep 2010 13:58:14 -0400 Date: Mon, 20 Sep 2010 19:52:12 +0200 From: "Michael S. Tsirkin" Message-ID: <20100920175212.GB30611@redhat.com> References: <1284842625-13920-1-git-send-email-stefanha@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1284842625-13920-1-git-send-email-stefanha@linux.vnet.ibm.com> Subject: [Qemu-devel] Re: [PATCH] e1000: Pad short frames to minimum size (60 bytes) List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi , Anthony Liguori Cc: 638955@bugs.launchpad.net, qemu-devel@nongnu.org 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 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 >